Automatic testing method and device, electronic equipment, storage medium and product
By combining common behavioral fragments in different test cases and executing them, the inefficiency of testing caused by repetitive operations in automated tests is solved, and the effect of improving test speed and saving resources is achieved.
Patent Information
- Application Number
- CN202411886899.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing automated testing methods will experience a large number of repetitive operations when testing multiple test cases of application software, resulting in inefficient testing and waste of computer resources.
By obtaining the target test cases, including behavioral fragments of at least two test cases, merging the behavioral fragments that are common in these test cases, and performing the merged behavioral fragments and the behavioral fragments to be tested.
It effectively improves the test speed, saves computer resources, reduces repetitive operations, thereby improving testing efficiency.
Smart Images

Figure CN119759778A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of software testing technology, and in particular to an automated testing method, device, electronic device, storage medium and product. Background Art
[0002] In order to meet the ever-changing needs of users, fix vulnerabilities, and improve performance, new versions of software need to be released frequently. It is almost impossible to conduct comprehensive manual testing after each update, which urgently requires an efficient and reliable testing method. Automated testing came into being to adapt to this rapid update rhythm.
[0003] When testing a function of application software, conventional automated testing methods need to execute the entire process of a test case, including environment preparation, operation to the specified page, verification of results, and recovery of the environment.
[0004] However, when the above method is used to perform automated testing on multiple test cases in the same application software, a large number of repetitive operations will occur, thereby reducing the test efficiency and wasting computer resources. Summary of the invention
[0005] The present invention provides an automated testing method, device, electronic device, storage medium and product to solve the problem of low testing efficiency caused by performing a large number of repetitive operations in existing automated testing methods.
[0006] According to one aspect of the present invention, there is provided an automated testing method, comprising:
[0007] Obtain a target test case, wherein the target test case includes at least two behavior fragments of test cases;
[0008] The merged behavior segment and the behavior segment to be tested in the target test case are executed, wherein the merged behavior segment includes the behavior segment common to the at least two test cases.
[0009] According to another aspect of the present invention, there is provided an automated testing device, comprising:
[0010] An acquisition module, used for acquiring a target test case, wherein the target test case includes at least two behavior fragments of the test case;
[0011] The test module is used to execute the merged behavior fragments and the behavior fragments to be tested in the target test case, wherein the merged behavior fragments include the behavior fragments common to the at least two test cases.
[0012] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0013] at least one processor; and a memory communicatively coupled to the at least one processor;
[0014] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the automated testing method described in any embodiment of the present invention.
[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the automated testing method described in any embodiment of the present invention when executed.
[0016] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the computer program implements the automated testing method described in any embodiment of the present invention.
[0017] The technical solution of the embodiment of the present invention solves the problem of low testing efficiency caused by executing a large number of repetitive operations in existing automated testing methods by merging and executing common behavior fragments in different test cases, thereby achieving the beneficial effects of increasing testing speed and saving computer resources.
[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A schematic diagram of a flow chart of an automated testing method provided in Embodiment 1 of the present invention;
[0021] Figure 2 A schematic diagram of a flow chart of an automated testing method provided in Embodiment 2 of the present invention;
[0022] Figure 3 A schematic diagram of a flow chart of an automated testing method provided for a specific embodiment of the present invention;
[0023] Figure 4A schematic flow chart of an automated testing method provided for another specific embodiment of the present invention;
[0024] Figure 5 A schematic diagram of the structure of an automated testing device provided in Embodiment 3 of the present invention;
[0025] Figure 6 A schematic diagram of the structure of an electronic device for an automated testing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only an embodiment of a part of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work should belong to the scope of protection of the present invention. It should be understood that the various steps recorded in the method implementation of the present invention can be performed in different orders and / or in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0027] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0030] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0031] Embodiment 1
[0032] Figure 1 A flow chart of an automated testing method provided for Embodiment 1 of the present invention is applicable to testing different functions of an application software. The method can be executed by an automated testing device, wherein the device can be implemented by software and / or hardware and is generally integrated on an electronic device. In this embodiment, the electronic device includes but is not limited to: computer equipment.
[0033] like Figure 1 As shown, an automated testing method provided by Embodiment 1 of the present invention includes the following steps:
[0034] S110: Obtain a target test case, where the target test case includes at least two behavior fragments of test cases.
[0035] Among them, the target test case may include multiple test cases of the same application software, each test case is used to test a software function, and a test case may include multiple behavior fragments. The behavior fragment can be understood as the operations performed by the user on the display screen of the electronic device, such as single-click, slide, double-click, three-finger swipe, etc.
[0036] It can be understood that the behavior fragment is executed on the page, and after executing a behavior fragment on the current page, a new page will be entered.
[0037] The target test case in this embodiment is written based on different test cases of an application software, and the common behavior fragments in different test cases are merged into a first merged behavior fragment and a second merged behavior fragment; the target test case also includes execution fragments other than the common behavior fragments in different test cases to test different software functions within the same application software.
[0038] S120: Execute the merged behavior segment and the behavior segment to be tested in the target test case, wherein the merged behavior segment includes the behavior segment common to the at least two test cases.
[0039] When the tester compiles the target test case, the common behavior fragments in different test cases of the same application software are compiled into a merged behavior fragment and marked with the test step number. When performing automated testing, the merged behavior fragment in the target test case is only executed once.
[0040] In this embodiment, the merged behavior fragment may include a first merged behavior fragment and a second merged behavior fragment; the first merged behavior fragment may include multiple common behavior fragments, generally the first few behavior fragments of different test cases of an application software are common behavior fragments, and the first few behavior fragments are compiled into the first merged behavior fragment; the second merged behavior fragment may include a common behavior fragment, generally the last behavior fragment of different test cases of an application software is a common behavior fragment, and the last behavior fragment is compiled into the second merged behavior fragment.
[0041] Among them, the conditions that two behavior fragments need to meet for being common behavior fragments include: if the two behavior fragments are the first behavior fragments in the test case, the corresponding pages after the behavior fragments are executed are the same; if the two behavior fragments are not the first behavior fragments in the test case, the corresponding pages before the two behavior fragments are executed are the same and the corresponding pages after the two behavior fragments are executed are also the same.
[0042] For example, if the first four behavior segments in two test cases are screen initialization, entering a certain application software, application software initialization, and clicking on my playlist, then the first merged behavior segment obtained after merging includes screen initialization, entering a certain application software, application software initialization, and clicking on my playlist.
[0043] In this embodiment, an intermediate page can be obtained after executing the merged behavior fragments in the target test case.
[0044] In this embodiment, the behavior segments to be tested may be all the behavior segments in the target test case except the merged behavior segments, and the behavior segments to be tested may also be the behavior segments selected by the tester from all the behavior segments in the target test case except the merged behavior segments. It is understandable that when a function of the application software needs to be tested, the tester may select the behavior segment corresponding to the function as the behavior segment to be tested.
[0045] In this embodiment, the behavior fragment to be tested can be executed in the following two ways:
[0046] Method 1: On the middle page, execute multiple behavior fragments to be tested in the order of test step numbers;
[0047] Method 2: On the middle page, the behavior fragments to be tested in multiple test cases are executed in parallel, and the behavior fragments to be tested in one test case are executed in the order of the test step numbers.
[0048] In this embodiment, when executing the target test case, automated testing is performed according to the test step numbers corresponding to the behavior fragments.
[0049] An automated testing method provided in a first embodiment of the present invention first obtains a target test case, wherein the target test case includes behavioral fragments of at least two test cases; then executes a merged behavioral fragment in the target test case and a behavioral fragment to be tested, wherein the merged behavioral fragment includes a common behavioral fragment in the at least two test cases. The above method can effectively improve the test speed and save computer resources by merging common behavioral fragments in different test cases into a merged behavioral fragment for execution.
[0050] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0051] Further, the target test case includes: a first merged behavior fragment marked as the first step to be executed; a second merged behavior fragment marked as the last step to be executed; at least one different behavior fragment, the different behavior fragment includes a behavior fragment other than the first merged behavior fragment and the second merged behavior fragment in each test case, and the different behavior fragment is marked with a corresponding test item number and a corresponding test step number;
[0052] Different behavior fragments in a test case are marked with the same test item number, and different behavior fragments in a test item are marked with corresponding test step numbers.
[0053] Exemplarily, the three different behavior segments in test item 1 can be marked as test step 2, test step 3 and test step 4; the four different behavior segments in test item 2 can also be marked as test step 2, test step 3, test step 4 and test step 5.
[0054] Exemplarily, the three different behavior segments in test item 1 can be marked as test step 2, test step 3 and test step 4; the four different behavior segments in test item 2 can also be marked as test step 5, test step 6, test step 7 and test step 8.
[0055] Embodiment 2
[0056] Figure 2 This is a flow chart of an automated testing method provided by Embodiment 2 of the present invention. Embodiment 2 is optimized on the basis of the above embodiments. For details not yet provided in this embodiment, please refer to Embodiment 1.
[0057] like Figure 2 As shown, an automated testing method provided by Embodiment 2 of the present invention includes the following steps:
[0058] S210: Obtain a target test case, where the target test case includes at least two behavior fragments of test cases.
[0059] S220 . Obtain a first merged behavior segment according to the mark executed in the first step, and execute the first merged behavior segment to obtain an intermediate page.
[0060] Among them, since the first merged behavior segment is marked as the first step to be executed in advance, the first merged behavior segment can be obtained according to the mark, and the first merged behavior segment is put into the first step to be executed.
[0061] S230. On the intermediate page, execute the different behavior fragment according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case.
[0062] Among them, the behavior fragment to be tested includes at least one different behavior fragment in the target test case. Since each different behavior fragment is marked with the test item number and the corresponding test step number, it can be executed in the order of the test item number from small to large, and different behavior fragments with the same test item number can be executed in the order of the test step numbers corresponding to the different behavior fragments from small to large.
[0063] Furthermore, the target test case also includes behavior fragment recovery and behavior fragment assertion.
[0064] Among them, behavior fragment recovery can be understood as the operation of restoring the page before the execution of a behavior fragment after the execution of the execution fragment is completed; behavior fragment assertion can be understood as comparing the page displayed after the execution of a behavior fragment with the expected page, and returning the comparison result.
[0065] In this embodiment, after completing the test of a software function, executing the behavior fragment recovery can restore the current page to the middle page, so that the next behavior fragment can be executed on the middle page to complete the test of another software function; after completing the test of a software function, executing the behavior fragment assertion can determine whether the current page is consistent with the expected displayed page.
[0066] For example, if you test the song collection function in an application software, execute the behavior fragment assertion to determine whether the page displayed after the behavior fragment of clicking the collection button shows that the collection is successful. If so, return pass to indicate that the function test is successful; if not, return fail to indicate that the function test failed.
[0067] Among them, each behavior fragment is compiled with a corresponding behavior fragment recovery, but not every behavior fragment corresponding to the behavior fragment recovery needs to be executed. Only when there is no executable behavior fragment on the page displayed after executing a behavior fragment, the behavior fragment recovery corresponding to the behavior fragment will be executed. This behavior fragment is generally the last behavior fragment in a test case.
[0068] In one embodiment, executing the different behavior fragments according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case includes:
[0069] Determine a test item with the smallest corresponding test item number in at least one different behavior segment in the target test case;
[0070] Execute different behavior fragments in the test entry in ascending order of corresponding test step numbers to obtain the current page, and mark different behavior fragments in the test entry as executed;
[0071] Execute the behavior fragment assertion to determine whether the current page is the expected page and return the judgment result;
[0072] Execute the fragment recovery corresponding to the different behavior fragment with the largest test step number in the test entry to restore to the intermediate page;
[0073] Determining whether there is a different behavior segment that is not marked as executed in at least one different behavior segment in the target test case;
[0074] If so, different behavior segments that are not marked as executed are executed in the order of the corresponding test item numbers from small to large and the test step numbers from small to large until all the behavior segments to be tested are marked as executed.
[0075] Each time a different behavior segment is executed, the different behavior segment is marked as executed, and whether there is a different behavior segment that has not been marked as executed is determined to determine whether all the behavior segments to be tested have been executed.
[0076] In one embodiment, executing the different behavior fragments according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case includes:
[0077] Determine the number of test item numbers corresponding to at least one different behavior fragment in the target test case;
[0078] If there are multiple test item numbers, different behavior fragments in each test item are executed in parallel;
[0079] The different behavior fragments in each test item are executed in ascending order according to the corresponding test step numbers.
[0080] In this embodiment, at least one different behavior fragment in the target test case is marked with a different test item number, and different behavior fragments in different test item numbers can be executed in parallel, which can be understood as executing different behavior fragments in test item 1, test item 2, and test item 3 at the same time. Among them, different behavior fragments with the same test item number are executed in the order of the corresponding test step number from small to large.
[0081] Furthermore, the execution process of different behavior fragments in a test entry includes: executing different behavior fragments in a test entry in ascending order of corresponding test step numbers to obtain the current page; executing behavior fragment assertions to determine whether the current page is the expected page and returning the judgment result.
[0082] S240: Obtain a second merged behavior segment according to the mark executed in the last step, and execute the second merged behavior segment to complete the automated test.
[0083] Among them, since the second merged behavior segment is marked as the last step to be executed in advance, the second merged behavior segment can be obtained according to the mark, and the second merged behavior segment is placed in the last step to be executed.
[0084] The second embodiment of the present invention provides an automated testing method, which embodies the automated testing process. The method can save testing time, improve testing efficiency, and save computer resources by executing the first merged behavior segment and the second merged behavior segment.
[0085] The embodiments of the present invention provide several specific implementation methods based on the technical solutions of the above embodiments.
[0086] As a specific implementation method, Figure 3 A flowchart of an automated testing method provided by a specific embodiment of the present invention is as follows: Figure 3 As shown, it includes testing whether the user login is displayed after clicking the favorite playlist on the playlist details page when XX music is not logged in, testing whether the user login is displayed after clicking the favorite playlist on the ranking details page when XX music is not logged in, and testing whether the user login is displayed after clicking the favorite playlist on the recommended playlist details page when XX music is not logged in.
[0087] Execute the first merged behavior fragment to obtain the middle page. The first merged behavior fragment includes three behavior fragments: initializing the co-pilot screen, entering XX music, and initializing XX music; execute different behavior fragments in test item 1. Test item 1 includes three different behavior fragments: clicking on the playlist, clicking on the playlist cover, and clicking on the favorite playlist. The three different behavior fragments are executed in ascending order according to the test step numbers corresponding to the three different behavior fragments; execute the behavior fragment assertion to determine whether the user login is displayed and return the judgment result; execute the behavior fragment recovery corresponding to clicking on the favorite playlist to restore the current page to the middle page; determine whether there are any unexecuted behavior fragments on the middle page; if so, execute the different behavior fragments in test item 2. Test item 2 includes four different behavior fragments: clicking on the ranking card, clicking on the ranking cover, clicking on the ranking list, and clicking on the favorite playlist. Execute in ascending order the test step numbers corresponding to the four different behavior fragments; execute the behavior fragment assertion to determine whether the user login is displayed and return the determination result; execute the behavior fragment recovery corresponding to clicking the favorite playlist to restore the current page to the middle page; determine whether there are any unexecuted behavior fragments on the middle page; if so, execute the different behavior fragments in test item 3, which includes two different behavior fragments, click the recommended playlist and click the favorite playlist; execute the two different behavior fragments in ascending order the test step numbers corresponding to the two different behavior fragments; execute the behavior fragment assertion to determine whether the user login is displayed and return the determination result; execute the behavior fragment recovery corresponding to clicking the favorite playlist to restore the current page to the middle page; determine whether there are any unexecuted behavior fragments on the middle page; if not, execute the second merged behavior fragment, which is to restore to the main page.
[0088] As a specific implementation method, Figure 4 A flowchart of an automated testing method provided by another specific embodiment of the present invention is as follows: Figure 4As shown, the first merged behavior fragment is executed to obtain the intermediate page. The first merged behavior fragment includes three behavior fragments: initializing the co-pilot screen, entering XX music, and initializing XX music; different behavior fragments in test items 1, 2, and 3 are executed in parallel, and different behavior fragments in test item 3 are executed. Test item 1 includes three different behavior fragments: clicking on the playlist, clicking on the playlist cover, and clicking on the favorite playlist. The three different behavior fragments are executed in ascending order according to the test step numbers corresponding to the three different behavior fragments; the behavior fragment assertion is executed to determine whether the user login is displayed and return the judgment result; the different behavior fragments in test item 2 are executed, and test item 2 includes clicking on the ranking list Card, click on the chart cover, click on the chart list and click on the favorite playlist. The four different behavior fragments are executed in ascending order according to the test step numbers corresponding to the four different behavior fragments; execute the behavior fragment assertion to determine whether the user login is displayed and return the judgment result; execute the different behavior fragments in test item 3, test item 3 includes two different behavior fragments, click on the recommended playlist and click on the favorite playlist; the two different behavior fragments are executed in ascending order according to the test step numbers corresponding to the two different behavior fragments; execute the behavior fragment assertion to determine whether the user login is displayed and return the judgment result; execute the second merged behavior fragment, and the second merged behavior fragment is to restore to the main page.
[0089] Embodiment 3
[0090] Figure 5 This is a schematic diagram of the structure of an automated testing device provided in Embodiment 3 of the present invention. The device can be applied to testing different functions of an application software, wherein the device can be implemented by software and / or hardware and is generally integrated on an electronic device.
[0091] like Figure 3 As shown, the device includes: an acquisition module 110 and a testing module 120 .
[0092] An acquisition module 110 is used to acquire a target test case, wherein the target test case includes at least two behavior fragments of test cases;
[0093] The testing module 120 is configured to execute the merged behavior segments and the behavior segments to be tested in the target test case, wherein the merged behavior segments include the behavior segments common to the at least two test cases.
[0094] In this embodiment, the device first obtains a target test case through an acquisition module 110, wherein the target test case includes behavioral fragments of at least two test cases; and then executes a merged behavioral fragment and a behavioral fragment to be tested in the target test case through a test module 120, wherein the merged behavioral fragment includes a common behavioral fragment in the at least two test cases.
[0095] This embodiment provides an automated testing device that can improve testing speed and save computer resources.
[0096] Further, the target test case includes: a first merged behavior fragment marked as the first step to be executed; a second merged behavior fragment marked as the last step to be executed; at least one different behavior fragment, the different behavior fragment includes a behavior fragment other than the first merged behavior fragment and the second merged behavior fragment in each test case, and the different behavior fragment is marked with a corresponding test item number and a corresponding test step number;
[0097] Different behavior fragments in a test case are marked with the same test item number, and different behavior fragments in a test item are marked with corresponding test step numbers.
[0098] Based on the above optimization, the behavior segment to be tested includes at least one different behavior segment in the target test case, and the test module 120 includes:
[0099] A first execution submodule, configured to obtain the first merged behavior segment according to the mark executed in the first step, and execute the first merged behavior segment to obtain an intermediate page;
[0100] A second execution submodule is used to execute the different behavior fragments on the intermediate page according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case;
[0101] The third execution submodule is used to obtain the second merged behavior fragment according to the mark of the last step execution, and execute the second merged behavior fragment to complete the automated test.
[0102] Further, the target test case also includes behavior fragment recovery and behavior fragment assertion, and the second execution submodule includes a first execution unit and a second execution unit;
[0103] The first execution unit is used to: determine the test entry with the smallest corresponding test entry number in at least one different behavior fragment in the target test case; execute the different behavior fragments in the test entry in the order of the corresponding test step numbers from small to large to obtain the current page, and mark the different behavior fragments in the test entry as executed; execute the behavior fragment assertion to determine whether the current page is the expected page and return the judgment result; execute the fragment recovery corresponding to the different behavior fragment with the largest test step number in the test entry to restore to the intermediate page; determine whether there is a different behavior fragment that is not marked as executed in at least one different behavior fragment in the target test case; if so, execute the different behavior fragments that are not marked as executed in the order of the corresponding test item numbers from small to large and the order of the test step numbers from small to large until all the behavior fragments to be tested are marked as executed.
[0104] The second execution unit is used to: determine the number of test item numbers corresponding to at least one different behavior fragment in the target test case; if the number of test item numbers is multiple, execute the different behavior fragments in each test item in parallel.
[0105] Based on the above optimization, the execution process of different behavior fragments in a test entry includes: executing different behavior fragments in a test entry in ascending order of the corresponding test step numbers to obtain the current page; executing the behavior fragment assertion to determine whether the current page is the expected page and returning the judgment result.
[0106] The above-mentioned automated testing device can execute the automated testing method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0107] Embodiment 4
[0108] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0109] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0110] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0111] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as an automated testing method.
[0112] In some embodiments, an automated testing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps in the automated testing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the automated testing method in any other appropriate manner (e.g., by means of firmware).
[0113] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0114] In some embodiments, the automated testing method may be implemented as a computer program, which is invisibly included in a computer program product, which implements the automated testing method of the present invention when executed by a processor, and the computer program product may be understood as a software product that implements its solution mainly through a computer program. The computer program for implementing the method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the computer program, when executed by the processor, implements the functions / operations specified in the flow chart and / or block diagram. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or entirely on a remote machine or server.
[0115] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0116] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0117] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0118] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0119] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0120] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An automated testing method, characterized in that: The method comprises: Obtain a target test case, wherein the target test case includes at least two behavior fragments of test cases; The merged behavior segment and the behavior segment to be tested in the target test case are executed, wherein the merged behavior segment includes the behavior segment common to the at least two test cases.
2. The method according to claim 1, characterized in that The target test case includes: a first merged behavior fragment marked as the first step to be executed; a second merged behavior fragment marked as the last step to be executed; and at least one different behavior fragment, wherein the different behavior fragment includes a behavior fragment other than the first merged behavior fragment and the second merged behavior fragment in each test case, and the different behavior fragment is marked with a corresponding test item number and a corresponding test step number; Different behavior fragments in a test case are marked with the same test item number, and different behavior fragments in a test item are marked with corresponding test step numbers.
3. The method according to claim 2, characterized in that The behavior segment to be tested includes at least one different behavior segment in the target test case. Accordingly, the step of executing the merged behavior segment in the target test case and the behavior segment to be tested includes: Obtaining the first merged behavior fragment according to the mark executed in the first step, and executing the first merged behavior fragment to obtain an intermediate page; On the intermediate page, executing the different behavior fragments according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case; The second merged behavior fragment is obtained according to the mark executed in the last step, and the second merged behavior fragment is executed to complete the automated test.
4. The method according to claim 1, characterized in that: The target test case further includes behavior fragment recovery and behavior fragment assertion, and executing the different behavior fragments according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case includes: Determine a test item with the smallest corresponding test item number in at least one different behavior segment in the target test case; Execute different behavior fragments in the test entry in ascending order of corresponding test step numbers to obtain the current page, and mark different behavior fragments in the test entry as executed; Execute the behavior fragment assertion to determine whether the current page is the expected page and return the judgment result; Execute the behavior segment recovery corresponding to the different behavior segments with the largest test step number in the test entry to recover to the intermediate page; Determining whether there is a different behavior segment that is not marked as executed in at least one different behavior segment in the target test case; If so, different behavior segments that are not marked as executed are executed in the order of the corresponding test item numbers from small to large and the test step numbers from small to large until all the behavior segments to be tested are marked as executed.
5. The method according to claim 3, characterized in that: The executing the different behavior fragments according to the test item number and the test step number corresponding to at least one different behavior fragment in the target test case includes: Determine the number of test item numbers corresponding to at least one different behavior fragment in the target test case; If there are multiple test item numbers, different behavior segments in each test item are executed in parallel.
6. The method according to claim 5, characterized in that The execution process of different behavior fragments in a test item includes: Execute different behavior fragments in a test item in ascending order according to the corresponding test step numbers to get the current page; Execute the behavior fragment assertion to determine whether the current page is the expected page and return the judgment result.
7. An automated testing device, characterized in that: The device comprises: An acquisition module, used for acquiring a target test case, wherein the target test case includes at least two behavior fragments of the test case; The test module is used to execute the merged behavior fragments and the behavior fragments to be tested in the target test case, wherein the merged behavior fragments include the behavior fragments common to the at least two test cases.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the automated testing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the automated testing method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the automated testing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Automatic testing method, automatic testing device and device with storage function
CN110502422A
Automatic testing method and device, electronic equipment and computer readable storage medium
CN116361157A
Cited By
Automatic testing method and device, computer equipment, storage medium and computer program product
CN121277839A