CN117290236A - Software testing method, device, computer equipment and computer readable storage medium - Google Patents

Software testing method, device, computer equipment and computer readable storage medium Download PDF

Info

Publication number
CN117290236A
CN117290236A CN202311300647.1A CN202311300647A CN117290236A CN 117290236 A CN117290236 A CN 117290236A CN 202311300647 A CN202311300647 A CN 202311300647A CN 117290236 A CN117290236 A CN 117290236A
Authority
CN
China
Prior art keywords
test
execution
plan
target
execution step
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311300647.1A
Other languages
Chinese (zh)
Inventor
任俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202311300647.1A priority Critical patent/CN117290236A/en
Publication of CN117290236A publication Critical patent/CN117290236A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a software testing method, a software testing device, computer equipment and a computer readable storage medium. Comprising the following steps: acquiring at least two test cases; based on the test targets, combining all the test cases to obtain a test plan; generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan; carrying out data splitting on each execution case in the plan execution list according to the test steps to obtain each independent execution step; for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters; and performing software testing based on the execution sentences corresponding to the execution steps. By adopting the method, the automatic testing efficiency of the software can be effectively improved.

Description

Software testing method, device, computer equipment and computer readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a software testing method, a device, a computer device, and a computer readable storage medium.
Background
With the development of software testing technology, the software testing work under a specific scene is developed and completed by utilizing an automatic testing script, so that the efficiency of the software testing can be greatly improved in terms of replacing simple repeated manual testing.
In the traditional technology, according to specific software testing requirements, independent automatic testing codes are written by software testers, and the method has high requirements on program development skills of the software testers and high maintenance difficulty on later test cases, so that the software automatic testing efficiency is lower.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a software testing method, apparatus, computer device, and computer readable storage medium, which can effectively improve the software automation testing efficiency.
In a first aspect, the present application provides a software testing method, including:
acquiring at least two test cases;
based on the test targets, combining all the test cases to obtain a test plan;
Generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
carrying out data splitting on each execution case in the plan execution list according to the test steps to obtain each independent execution step;
for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and performing software testing based on the execution sentences corresponding to the execution steps.
In one embodiment, based on the test targets, each test case is combined to obtain a test plan, including:
determining a corresponding test function based on the test target;
determining corresponding test cases and corresponding combination sequences according to the test functions;
and combining the corresponding test cases according to the combination sequence to obtain a test plan.
In one embodiment, generating a corresponding plan execution list based on the test plan includes:
When the test plan is a single sub-plan, generating a corresponding plan execution list based on each test case and arrangement sequence in the single sub-plan;
when the test plan comprises a plurality of sub-plans, a corresponding plan execution list is generated based on a first arrangement sequence corresponding to the plurality of sub-plans, test cases corresponding to the plurality of sub-plans and a second arrangement sequence corresponding to each test case in each sub-plan.
In one embodiment, the data splitting is performed on each execution case in the planned execution list according to the test steps, so as to obtain each individual execution step, including:
determining a reference field corresponding to the test step in each execution case;
and carrying out data splitting on each execution case based on the reference field to obtain each split independent execution step, wherein the independent execution step is used for representing single test behaviors, and the execution case at least comprises one execution step.
In one embodiment, for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, and obtaining a matched target parameter from the execution step according to the target plug-in, generating an execution statement corresponding to the execution step based on the target parameter, including:
For each execution step, determining a corresponding initial execution statement according to a target plug-in corresponding to the target field;
and taking the matched target parameters in the execution step as the input parameters of the initial execution statement to obtain the execution statement corresponding to the execution step.
In one embodiment, the software test further includes: and when the corresponding target plug-in is not found according to the target field, terminating the current execution step, and starting the execution of the next execution step.
In one embodiment, the software test is performed based on the execution statement corresponding to each execution step, including:
acquiring a software test template corresponding to a test target, wherein the software test template is used for calling a code function library corresponding to the test target;
writing the execution sentences corresponding to the execution steps into the target positions of the software test templates, generating software test codes corresponding to the test targets, and running the software test codes to complete the software test to generate test reports.
In a second aspect, the present application further provides a software testing apparatus, including:
the acquisition module is used for acquiring at least two test cases, and each test case comprises at least one test step;
The configuration module is used for combining all the test cases based on the test targets to obtain a test plan, and the test plan at least comprises one test case; generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
the generation module is used for splitting data according to the test steps for each execution case in the plan execution list to obtain each independent execution step; for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and the test module is used for carrying out software test based on the execution statement corresponding to each execution step.
In a third aspect, the present application also provides a computer device comprising a memory storing a computer program and a processor implementing the following steps when the computer program is executed:
acquiring at least two test cases, wherein each test case comprises at least one test step;
Based on the test targets, combining all the test cases to obtain a test plan, wherein the test plan at least comprises one test case;
generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
carrying out data splitting on each execution case in the plan execution list according to the test steps to obtain each independent execution step;
for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and performing software testing based on the execution sentences corresponding to the execution steps.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring at least two test cases, wherein each test case comprises at least one test step;
based on the test targets, combining all the test cases to obtain a test plan, wherein the test plan at least comprises one test case;
Generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
carrying out data splitting on each execution case in the plan execution list according to the test steps to obtain each independent execution step;
for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and performing software testing based on the execution sentences corresponding to the execution steps.
According to the software testing method, the device, the computer equipment and the computer readable storage medium, the compiled test cases are directly obtained, the test plan is obtained by combining the test cases according to the test targets, the corresponding plan execution list is generated based on the test plan, so that the test sequence of each test node of the software test is determined, the data splitting is carried out on each execution case in the plan execution list according to the test steps, each individual execution step is obtained, the corresponding execution statement is generated according to the target field and the target parameter in each execution step, finally, the software test script corresponding to the test targets is generated and operated according to the generated execution statement corresponding to each execution step, the automatic test of the software is completed, and in the process of generating and executing the software test script, the generation of the automatic test script corresponding to the test targets can be rapidly and accurately realized only by providing the corresponding test cases and the test targets.
Drawings
FIG. 1 is a flow chart of a software testing method in one embodiment;
FIG. 2 is a flow diagram of generating a test plan in one embodiment;
FIG. 3 is a flow diagram of generating a planned execution list in one embodiment;
FIG. 4 is a flow diagram of data splitting for an execution case in one embodiment;
FIG. 5 is a flowchart of generating an execution statement corresponding to an execution step in one embodiment;
FIG. 6 is a flow diagram of generating software test code and completing a software test in one embodiment;
FIG. 7 is a schematic diagram of automated software testing in one embodiment;
FIG. 8 is a flow diagram of data splitting of a test plan in one embodiment;
FIG. 9 is a block diagram of a software testing device in one embodiment;
fig. 10 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a software testing method is provided, where the method is applied to a terminal to illustrate, it is understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
Step S102, at least two test cases are obtained.
Wherein each test case comprises at least one test step; the test case is the description of a specific software product for testing tasks, and the test scheme, method, technology and strategy are embodied; each test step comprises a corresponding test name, a test method and a corresponding parameter.
Step S104, based on the test targets, combining the test cases to obtain a test plan.
Wherein the test plan includes at least one test case; test objectives include test objects (e.g., for web pages, ERP (Enterprise Resource Planning, enterprise resource planning) systems, mailbox systems, etc.) and test interfaces (e.g., testing of various interface functions in a network, etc.) and test sequences.
Specifically, the computer equipment acquires a test target, determines a corresponding target test case from all the test cases according to a test interface corresponding to the test object in the test target, determines a ranking order corresponding to all the target test cases according to the test order, and combines all the target test cases according to the ranking order to obtain a corresponding test plan.
For example, when the test target is to perform a functional test on the search key of the search box of the a web page, the test target corresponds to the a web page, the test interfaces thereof are "click input box", "fill in search word", "click search box", and the test sequence thereof is: the computer equipment can determine test cases corresponding to the click input box, the fill-in search word and the click search box according to the test interface, and then the test cases are combined according to the test sequence to obtain a test plan corresponding to the function test of the search keys of the search box of the A webpage.
Step S106, based on the test plan, a corresponding plan execution list is generated.
The arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan.
Specifically, the computer device transmits the catalog address of the test plan determined in the above step to the executor, and then the executor reads and stores each test case in the test plan into the memory according to the arrangement sequence of the test plan in the catalog, and generates a corresponding plan execution list.
Step S108, carrying out data splitting on each execution case in the plan execution list according to the test steps to obtain each independent execution step.
Wherein, each execution case in the plan execution list corresponds to each test case in the test plan, and the arrangement sequence of each execution case corresponds to the arrangement sequence of each test case; each execution case at least comprises a testing step; the testing step is used for representing a testing behavior, for example, when the search box in the webpage is subjected to functional testing, and comprises at least three steps: selecting a search box, inputting search words in the search box, and clicking a search key.
Specifically, the computer device identifies the target division field of each execution case in the plan execution list, determines each identified target division field, and then divides the target division field as a division boundary to obtain each individual execution step.
For example, each execution case includes at least one data block, each data block is used for expressing a corresponding test behavior, each data block includes a corresponding name field, a test method field, a test parameter number segment, and the like, and the computer device may be configured according to a preset rule, for example: when the name field is used as the target division field and each execution case in the plan execution list is subjected to data division according to the test steps, the target division field (name field) can be used as a data division limit to carry out data division, so that the execution steps corresponding to each data block are obtained.
Step S110, for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters.
The target field of each execution step can be flexibly set by a technician, for example, the name field in each execution step can be used as a target field, etc.
Specifically, for each execution step, the computer device first identifies the target field in the execution step according to a preset rule, specifically, the computer device sequentially matches all the fields in the execution step with the preset field according to a preset sequence until the matching is successful, and uses the successfully matched field as the target field, thereby completing the identification of the target field in the execution step (for example, the preset field may be preset as "method", and each field "name", "method" and "url" in the execution step is sequentially matched with the preset field "method" until the target field "method" is determined); determining a corresponding target plug-in according to the identified category of the target field, then executing the target plug-in to call a corresponding functional statement, acquiring a matched target parameter from the executing step, taking the target parameter as an input parameter of the functional statement, and further generating a complete executing statement, namely, an executing statement corresponding to the executing step.
Step S112, performing software testing based on the execution sentences corresponding to the execution steps.
Specifically, the computer device generates execution sentences corresponding to each execution step according to the steps, combines the execution sentences based on each execution sentence, generates test codes corresponding to the test targets, and then runs the test codes to complete corresponding software test work.
In this embodiment, through directly obtaining the written test cases, combining the test cases according to the test targets to obtain a test plan, generating a corresponding plan execution list based on the test plan, thereby determining the test sequence of each test node of the software test, then splitting the data of each execution case in the plan execution list according to the test steps to obtain each individual execution step, generating a corresponding execution statement according to the target field and the target parameter in each execution step, and finally generating and running a software test script corresponding to the test targets according to the generated execution statement corresponding to each execution step to complete the automatic test of the software.
In one embodiment, as shown in fig. 2, based on the test objectives, each test case is combined to obtain a test plan, including:
step S202, based on the test targets, corresponding test functions are determined.
The test function includes a function test, a performance test, a security test, etc. performed on a target function of a certain software product (such as a web page, a mobile phone application, etc.).
Specifically, the computer device determines a corresponding software module to be tested according to the test target, and then determines a corresponding test function according to the software module.
Step S204, corresponding test cases and corresponding combination sequences are determined according to the test functions.
Each test case corresponds to one test function, and each test function may include a plurality of test steps, for example, a functional test on a certain software interface search box, including at least the following three test steps: clicking on a software search box, entering a search term, and clicking on a search button.
Specifically, the computer equipment reads a function test list pre-stored in the database according to the test function determined in the steps, and searches the corresponding test cases and the corresponding combination sequence in the function test list according to the test function.
Step S206, corresponding test cases are combined according to the combination sequence, and a test plan is obtained.
In this embodiment, first, based on a test target, a corresponding test function is determined, a corresponding test case and a corresponding combination sequence are determined according to the test function, and the corresponding test case is combined according to the combination sequence to obtain a test plan, so that the corresponding test plan can be automatically and rapidly generated in the whole process according to the test target, the test plan is not required to be manually configured, and the test plan generation efficiency is effectively improved.
In one embodiment, as shown in FIG. 3, generating a corresponding plan execution list based on the test plan includes:
in step S302, when the test plan is a single sub-plan, a corresponding plan execution list is generated based on each test case and the arrangement order in the single sub-plan.
Specifically, when the computer equipment judges that the test plan is a single sub-plan, each test case in the test plan is generated into a corresponding plan execution list according to the respective sequence, wherein the arrangement sequence of each execution case in the plan execution list is the same as the sequence of each test case in the test plan.
In step S304, when the test plan includes a plurality of sub-plans, a corresponding plan execution list is generated based on the first arrangement order corresponding to the plurality of sub-plans, the test cases corresponding to the plurality of sub-plans, and the second arrangement order corresponding to each test case in each sub-plan.
Specifically, the computer apparatus determines whether the test plan includes a plurality of sub-plans, and if the test plan includes a plurality of sub-plans, takes the arrangement order of the test plans in the catalog in which the test plan is located as a first arrangement order, takes the arrangement order of the test cases in each sub-plan as a second arrangement order, and finally generates a corresponding plan execution list according to the first arrangement order and the second arrangement order, for example, when a sub-plan a, a sub-plan B, and a sub-plan C exist in the test plan, and test cases (a 1, a2, a 3) corresponding to the sub-plan a, test cases (B1, B2) corresponding to the sub-plan B, and test cases (C1, C2, C3) corresponding to the sub-plan C are generated in the catalog, and when the arrangement order of the test cases (i.e., the first arrangement order) corresponding to the sub-plan A, B, C is { A, C, B }, the second arrangement order corresponding to the test cases is { a1, a2, a3}, { B2, B1} and { C3} and { C1, C2, C3} are generated according to the first arrangement order and { C1, C2, C3} and { C2, C3} are executed in the catalog.
In this embodiment, whether the test plan is a single test plan is determined, when the test plan is a single sub-plan, a corresponding plan execution list is generated based on each test case and arrangement sequence in the single sub-plan, and when the test plan includes a plurality of sub-plans, a corresponding plan execution list is generated based on a first arrangement sequence corresponding to the plurality of sub-plans, test cases corresponding to the plurality of sub-plans, and a second arrangement sequence corresponding to each test case in each sub-plan, so that the corresponding plan execution list can be adaptively generated according to the number of test plans, and software test efficiency is improved.
In one embodiment, as shown in fig. 4, the data splitting is performed on each execution case in the planned execution list according to the test steps, so as to obtain each individual execution step, which includes:
step S402, determining a reference field corresponding to the test step in each execution case.
The reference field may be a field of a type that is specified in advance by a technician as needed, such as a name field, a method field, and the like.
Step S404, data splitting is carried out on each execution case based on the reference field, and each split individual execution step is obtained.
The single execution step is used for representing single test behaviors, and the execution use case at least comprises one execution step.
Specifically, the computer device performs data splitting on the data blocks corresponding to each reference field in the execution case to obtain each individual execution step, optionally, the computer device may further determine a part of target reference fields from each reference field according to the matching condition, and then perform data splitting on each execution case according to the target reference fields to obtain each split individual execution step.
In this embodiment, by determining the reference field corresponding to the test step in each execution case, and splitting data of each execution case based on the reference field, each split individual execution step is obtained, so that each execution step in the execution case can be effectively, quickly and accurately split, the test behavior corresponding to each split execution step is clearer and clearer, and the efficiency and accuracy of the execution step generation are improved.
In one embodiment, as shown in fig. 5, for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, and obtaining a matched target parameter from the execution step according to the target plug-in, generating an execution statement corresponding to the execution step based on the target parameter, including:
Step S502, for each execution step, determining a corresponding initial execution statement according to the target plug-in corresponding to the target field.
Specifically, the computer device determines the corresponding type of the execution statement according to the field type corresponding to the target field in each execution step, generates the corresponding initial execution statement, for example, when the test plan is a functional test on the search box of the xx webpage and the target field of the execution step obtained after the data splitting is "open xx webpage", the computer device determines the corresponding initial execution statement as a program statement of the open webpage according to the target plug-in corresponding to the target field.
Step S504, taking the matched target parameters in the execution step as the input parameters of the initial execution statement to obtain the execution statement corresponding to the execution step.
Specifically, the target parameter matched in the execution step is used as an input parameter of the initial execution statement to obtain an execution statement corresponding to the execution step, for example, when the execution step is "open xx webpage", the computer device uses the target parameter (corresponding to the webpage link address) in the execution step as the input parameter of the initial execution statement determined in the above step, so as to obtain a complete execution statement corresponding to the execution step, and the complete execution statement can bear the function of triggering the opening xx webpage.
In this embodiment, for each execution step, a corresponding initial execution statement is determined according to a target plug-in corresponding to a target field, and a target parameter matched in the execution step is used as an input parameter of the initial execution statement to obtain an execution statement corresponding to the execution step, so that a computer device can automatically generate a complete execution statement according to the identification conditions of the target field and the target parameter of the execution step, thereby greatly improving the generation efficiency of a test code and further improving the software test efficiency.
In one embodiment, the software test further comprises: and when the corresponding target plug-in is not found according to the target field, terminating the current execution step, and starting the execution of the next execution step.
Specifically, when the computer equipment judges that the corresponding target plug-in is not found, the computer equipment indicates that the generation of the corresponding execution statement for the current execution step fails, the program needs to jump out of the current execution step and continue to process the next execution step, so that the problem that the software test efficiency is low due to the fact that the process stays in the current execution step is avoided.
In one embodiment, as shown in fig. 6, performing a software test based on an execution statement corresponding to each execution step includes:
Step S602, a software test template corresponding to the test target is obtained.
The software test template is used for calling a code function library corresponding to the test target, for example, the software test template can be a section of standardized execution code, and the software test code generated after the execution code and each execution statement are combined can independently run and bear independent software test work.
Step S604, writing the execution sentences corresponding to the execution steps into the target positions of the software test templates, generating software test codes corresponding to the test targets, and running the software test codes to complete the software test, so as to generate a test report.
In this embodiment, by acquiring a software test template corresponding to a test target, writing an execution statement corresponding to each execution step into a target position of the software test template, generating a software test code corresponding to the test target, and running the software test code to complete the software test, generating a test report, thereby providing running conditions for the normal execution statement corresponding to each execution step, automatically generating a final software test code, completing the software test, and generating a corresponding test report.
The application scenario also provides an application scenario, wherein the application scenario applies the software testing method, and the method is applied to the scenario of automatic software testing of the user interface. Specifically, the application of the software testing method in the application scene is as follows:
the user interface layer is an entry layer for users to use related software products, and the functions of the software products are provided for the users through the entry layer, so that the testing work is mostly concentrated on the functions and performances of the user interface layer, and the automatic testing of the user interface at the present stage mainly depends on the automatic programming and automatic testing codes of software testers, thereby realizing the automatic testing of the software, and having lower automatic testing efficiency.
According to the embodiment, firstly, test cases of different user interfaces are written, and then according to the type of the user interface to be tested and the function items to be tested, the test cases (Case 1, case2, case3 and the like) are combined to obtain corresponding test plans (Plan 1, plan2 and the like), as shown in fig. 7; each test case comprises at least one test step, and each test step comprises a step name corresponding to the step (for example, opening xx page or clicking xx button), a corresponding step method (for example, using xx language/technology to execute xx action) and an incoming parameter (for example, URL link of xx page, etc.) required by the step when executing.
And transmitting the address of the catalog where the test plan is located into an executor, reading and storing all test cases in each test plan into a memory by the executor, and generating a corresponding execution plan list, wherein each execution case in the plan execution list corresponds to the test cases contained in the test plan, and the arrangement sequence of each execution case is determined by the test plan and the arrangement sequence of the test cases contained in the test plan.
The executor traverses the execution plan list and executes all the execution cases in the list, specifically:
and the executor splits the data of all execution cases in each test plan according to the test steps to obtain individual execution steps.
For each execution step, the computer device first determines a target field and a target parameter in each execution step, where the target field is specified in advance by a technician according to the test requirement/target (for example, a name field or an execution method field in the execution step may be used as a target field). The computer equipment determines a corresponding target function plug-in according to the target field and the target parameter of each execution step, and then the corresponding function method is called by the target function plug-in to generate a corresponding execution statement, and the same is carried out, so that the execution statement corresponding to each execution step is obtained, and the process is shown in fig. 8, if the target function plug-in is not found. The task of generating the execution statement corresponding to the current execution step is terminated.
And fusing each corresponding execution statement with a corresponding software test template to generate a software test script corresponding to the test target, and running the software test script to complete software test to generate a test report.
In this embodiment, through directly obtaining the written test cases, combining the test cases according to the test targets to obtain a test plan, generating a corresponding plan execution list based on the test plan, thereby determining the test sequence of each test node of the software test, then splitting the data of each execution case in the plan execution list according to the test steps to obtain each individual execution step, generating a corresponding execution statement according to the target field and the target parameter in each execution step, and finally generating and running a software test script corresponding to the test targets according to the generated execution statement corresponding to each execution step to complete the automatic test of the software.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
In one embodiment, as shown in fig. 9, a software testing apparatus is provided, which may employ a software module or a hardware module, or a combination of both, as part of a computer device, and specifically includes: an acquisition module 902, a configuration module 904, a generation module 906, a test module 908, wherein:
An obtaining module 902, configured to obtain at least two test cases;
the configuration module 904 is configured to combine each test case based on the test target to obtain a test plan; generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
a generating module 906, configured to split data according to the test steps for each execution case in the plan execution list, so as to obtain each individual execution step; for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and the test module 908 is used for performing software test based on the execution statement corresponding to each execution step.
In one embodiment, the configuration module 904 is further configured to determine a corresponding test function based on the test objective; determining corresponding test cases and corresponding combination sequences according to the test functions; and combining the corresponding test cases according to the combination sequence to obtain a test plan.
In one embodiment, the configuration module 904 is further configured to generate, when the test plan is a single sub-plan, a corresponding plan execution list based on each test case and the arrangement order in the single sub-plan; when the test plan comprises a plurality of sub-plans, a corresponding plan execution list is generated based on a first arrangement sequence corresponding to the plurality of sub-plans, test cases corresponding to the plurality of sub-plans and a second arrangement sequence corresponding to each test case in each sub-plan.
In one embodiment, the generating module 906 is further configured to determine a reference field corresponding to the testing step in each execution case; and carrying out data splitting on each execution case based on the reference field to obtain each split independent execution step, wherein the independent execution step is used for representing single test behaviors, and the execution case at least comprises one execution step.
In one embodiment, the generating module 906 is further configured to determine, for each executing step, a corresponding initial execution statement according to a target plug-in corresponding to the target field; and taking the matched target parameters in the execution step as the input parameters of the initial execution statement to obtain the execution statement corresponding to the execution step.
In one embodiment, the generating module 906 is further configured to terminate the current executing step and initiate execution of the next executing step when no corresponding target plug-in is found according to the target field.
In one embodiment, the test module 908 is further configured to obtain a software test template corresponding to the test target, where the software test template is used to call a code function library corresponding to the test target; writing the execution sentences corresponding to the execution steps into the target positions of the software test templates, generating software test codes corresponding to the test targets, and running the software test codes to complete the software test to generate test reports.
According to the software testing device, the compiled test cases are directly obtained and combined according to the test targets to obtain the test plan, the corresponding plan execution list is generated based on the test plan, so that the test sequence of each test node of the software test is determined, each execution case in the plan execution list is subjected to data splitting according to the test steps to obtain each independent execution step, the corresponding execution statement is generated according to the target field and the target parameter in each execution step, finally, the software test script corresponding to the test targets is generated and operated according to the generated execution statement corresponding to each execution step, the automatic test of the software is completed, and in the process of generating and executing the software test script, the generation of the automatic test script corresponding to the test targets can be quickly and accurately realized only by providing the corresponding test cases and the test targets.
For specific limitations of the software testing device, reference may be made to the above limitations of the software testing method, and no further description is given here. The respective modules in the above-described software testing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 10. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a software testing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 10 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of software testing, the method comprising:
acquiring at least two test cases;
based on the test targets, combining all the test cases to obtain a test plan;
generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
Carrying out data splitting on each execution case in the plan execution list according to the test steps to obtain each independent execution step;
for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and performing software testing based on the execution sentences corresponding to the execution steps.
2. The method of claim 1, wherein combining the test cases based on the test objectives to obtain the test plan comprises:
determining a corresponding test function based on the test target;
determining corresponding test cases and corresponding combination sequences according to the test functions;
and combining the corresponding test cases according to the combination sequence to obtain the test plan.
3. The method of claim 1, wherein generating a corresponding plan execution list based on the test plan comprises:
when the test plan is a single sub-plan, generating a corresponding plan execution list based on each test case and arrangement sequence in the single sub-plan;
When the test plan comprises a plurality of sub-plans, a corresponding plan execution list is generated based on a first arrangement sequence corresponding to the plurality of sub-plans, test cases corresponding to the plurality of sub-plans and a second arrangement sequence corresponding to each test case in each sub-plan.
4. The method according to claim 1, wherein the step of splitting the data for each execution case in the planned execution list according to the test step to obtain each individual execution step includes:
determining a reference field corresponding to the test step in each execution case;
and carrying out data splitting on each execution case based on the reference field to obtain each split independent execution step, wherein the independent execution step is used for representing single test behaviors, and the execution case at least comprises one execution step.
5. The method according to claim 1, wherein for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, and obtaining a matched target parameter from the execution step according to the target plug-in, generating an execution statement corresponding to the execution step based on the target parameter, includes:
For each execution step, determining a corresponding initial execution statement according to a target plug-in corresponding to the target field;
and taking the matched target parameters in the execution step as the input parameters of the initial execution statement to obtain the execution statement corresponding to the execution step.
6. The method according to claim 1, wherein the method further comprises:
and when the corresponding target plug-in is not found according to the target field, terminating the current execution step, and starting the execution of the next execution step.
7. The method according to claim 1, wherein the performing the software test based on the execution statement corresponding to each execution step includes:
acquiring a software test template corresponding to the test target, wherein the software test template is used for calling a code function library corresponding to the test target;
writing the execution sentences corresponding to the execution steps into the target positions of the software test templates, generating software test codes corresponding to the test targets, and running the software test codes to complete software test and generate test reports.
8. A software testing apparatus, the apparatus comprising:
The acquisition module is used for acquiring at least two test cases;
the configuration module is used for combining all the test cases based on the test targets to obtain a test plan; generating a corresponding plan execution list based on the test plan; the arrangement sequence of each execution case in the plan execution list is determined by the arrangement sequence of each test case in the test plan;
the generation module is used for splitting data of each execution case in the plan execution list according to the test steps to obtain each independent execution step; for each execution step, determining a target field in the execution step, determining a corresponding target plug-in based on the target field, acquiring matched target parameters from the execution step according to the target plug-in, and generating an execution statement corresponding to the execution step based on the target parameters;
and the test module is used for carrying out software test based on the execution statement corresponding to each execution step.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202311300647.1A 2023-10-08 2023-10-08 Software testing method, device, computer equipment and computer readable storage medium Pending CN117290236A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311300647.1A CN117290236A (en) 2023-10-08 2023-10-08 Software testing method, device, computer equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311300647.1A CN117290236A (en) 2023-10-08 2023-10-08 Software testing method, device, computer equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN117290236A true CN117290236A (en) 2023-12-26

Family

ID=89256926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311300647.1A Pending CN117290236A (en) 2023-10-08 2023-10-08 Software testing method, device, computer equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN117290236A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117555813A (en) * 2024-01-11 2024-02-13 天津异乡好居网络科技股份有限公司 Method, device, equipment and medium for determining common test case

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117555813A (en) * 2024-01-11 2024-02-13 天津异乡好居网络科技股份有限公司 Method, device, equipment and medium for determining common test case
CN117555813B (en) * 2024-01-11 2024-05-14 天津异乡好居网络科技股份有限公司 Method, device, equipment and medium for determining common test case

Similar Documents

Publication Publication Date Title
CN112286779B (en) Test task processing method and device, storage medium and computer equipment
CN107644286B (en) Workflow processing method and device
US20180239692A1 (en) Electronic technology resource evaluation system
EP2778929B1 (en) Test script generation system
CN106326120B (en) Regression testing method and device for application software and electronic equipment
CN104657274B (en) software interface test method and device
US10152405B2 (en) Application testing system and method
WO2019056720A1 (en) Automated test case management method and apparatus, device, and storage medium
CN112529100B (en) Training method and device for multi-classification model, electronic equipment and storage medium
CN103984626A (en) Method and device for generating test-case script
CN109614325B (en) Method and device for determining control attribute, electronic equipment and storage medium
CN117290236A (en) Software testing method, device, computer equipment and computer readable storage medium
CN109408372A (en) Common component test method, device, computer equipment and storage medium
CN115794641A (en) Method, device and equipment for making number based on business process and storage medium
CN108399125A (en) Automated testing method, device, computer equipment and storage medium
CN113505895B (en) Machine learning engine service system, model training method and configuration method
CN103049374A (en) Automatic testing method and device
CN112905451A (en) Automatic testing method and device for application program
CN109815127B (en) Automatic script conversion method and device, computer equipment and storage medium
CN109359042B (en) Automatic testing method based on path search algorithm
CN110177006B (en) Node testing method and device based on interface prediction model
KR101351079B1 (en) Method and system for providing service for controlling program linked to database
CN116302078B (en) Code file merging method and device, storage medium and computer equipment
CN110019034A (en) Formfile loading method and device
CN111259063B (en) Method and device for realizing data export in API mode

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination