Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The train control interlocking integrated software is integrated with the functions of a plurality of existing products, such as a train control center, a computer interlock, a ground electronic unit and the like. After the column control and interlocking integrated software is changed, the changed software needs to be tested to confirm whether a new error is led out by modifying the software system, namely, the regression test of the software. The traditional regression testing method for the train control interlocking integrated software is to determine test cases for all changed parts and test according to the test cases, so that under the condition of more changes, the test cases are more, and therefore, the testing workload is large and the efficiency is low. Therefore, the application provides a software regression testing method, which can reduce the testing amount and improve the testing efficiency. The specific implementation steps are shown in fig. 1, including:
101. a plurality of change modules in the specified software is obtained.
102. And determining a plurality of test cases corresponding to the plurality of change modules based on a preset corresponding table.
After the software is changed, a regression test is typically performed on the software to confirm whether a new error has been introduced, so that after the specified software is changed, a plurality of changed modules in the specified software may be obtained in step 101. The designated software can be column control and interlocking integrated software.
Specifically, the acquiring of the changed plurality of change modules in the specified software may be firstly acquiring the updated code of the specified software and the original code before updating, and then comparing the original code with the updated code to determine a plurality of change code modules of the specified software; meanwhile, the updated demand document and the original demand document of the appointed software can be obtained, and then the updated demand document and the original demand document are compared to determine a change demand module of the appointed software.
Furthermore, before regression testing is performed on the specified software, a test case corresponding to the changing portion needs to be established, in order to make the relationship between the changing portion and the corresponding test case clearer, a relationship correspondence table (i.e., a preset correspondence table) between the changing portion and the corresponding test case may be established in advance, and when the subsequent test is required, a plurality of test cases corresponding to a plurality of changing modules may be determined directly in the preset correspondence table.
Wherein, a plurality of change modules may correspond to the same test case.
103. And determining a plurality of target test cases from the plurality of test cases based on a preset calculation method.
104. And carrying out regression testing on the appointed software based on the multiple target test cases.
After determining the multiple test cases in step 102, since the resources required for the test are limited and the number of test cases is large, if all the execution may consume more resources and time, the multiple target test cases may be determined in step 103 from the multiple test cases based on the preset calculation method, and then the regression test is performed on the specified software according to the multiple target test cases in step 104. The regression testing may be performed by verifying the code or requirement of the altered portion based on the test case and then checking whether the result matches the expected result.
Specifically, when determining multiple target test cases in multiple test cases, a preset calculation method may be used to calculate the influence degree of each test case in the multiple test cases, which test case has the greatest influence on the designated software may be understood, then several test cases with larger influence are screened out, and several test cases with larger influence degree are determined as target test cases.
In addition, the change portion, specifically, which function corresponding to the change portion is most important to the designated software may be determined, so as to determine the priority, and thus, the test cases corresponding to the change portions with higher priorities may be determined as target test cases.
Based on the implementation manner of fig. 1, it can be seen that the software regression testing method provided by the application can obtain the changed part in the designated software, then determine a plurality of test cases corresponding to the changed part according to the preset corresponding table, and then screen out the target test cases from the plurality of test cases according to the preset calculation method, so that the designated software can be subjected to regression testing only according to the target test cases, and the regression testing is not required to be performed by using all the test cases corresponding to the changed part, so that the test quantity is small, the test efficiency can be improved, and the target test cases are screened out from the plurality of test cases, so that the test cases which are most effective for the regression testing can be improved, and the accuracy of the regression testing can be improved under the condition of small test quantity.
Further, as a refinement and extension to the embodiment shown in fig. 1, the embodiment of the present application further provides another software regression testing method, as shown in fig. 2, which specifically includes the following steps:
201. a plurality of change modules in the specified software is obtained.
The implementation of step 201 is the same as that of step 101, and the same technical effects can be achieved, so that the same technical problems are solved, and the description thereof will not be repeated here.
202. And determining a plurality of test cases corresponding to the plurality of change modules based on a preset corresponding table.
Wherein step 202 proposes a more preferred embodiment that differs from step 102.
In step 202, since the change module includes a change code module and a change demand module, the code has a corresponding call interface, so that the interface modules corresponding to the change code module may be searched, and the number of the interface modules may be one interface module corresponding to one change code module, or two interface modules corresponding to one change code module, which is not particularly limited.
After determining the changed code module and the interface module corresponding to the changed code module, the first association requirement influenced by the changed code module and the second association requirement influenced by the interface module corresponding to the changed code module can be determined according to the preset requirement code correspondence table.
In the application, the corresponding table of the requirements and the use cases is preset, so after the first association requirement and the second association requirement are determined, the use cases corresponding to the first association requirement and the second association requirement can be determined in the corresponding table of the preset requirement use cases, and in addition, the application also comprises a change requirement module, so the use cases corresponding to the change requirement module can be determined in the corresponding table of the preset requirement use cases. That is, the preset corresponding table includes a preset demand code corresponding table and a preset demand case corresponding table.
The application corresponding to the change demand module, the application corresponding to the first association demand, and the application corresponding to the second association demand may be the same.
203. Setting a first coefficient value corresponding to the first association requirement and the change requirement module and a second coefficient value corresponding to the second association requirement.
204. And determining a plurality of target test cases from the plurality of test cases based on the first coefficient value and the second coefficient value.
In this step, since the demand directly affected by the code change can be considered to be important, the demand can be defined as a direct demand, and the change demand module related to the change of the demand document can be defined as a direct demand. Since the interface does not directly affect the demand, the demand affected by the interface can be defined as an indirect demand.
After the direct demand and the indirect demand are defined, the coefficient values corresponding to the first association demand, the change demand module and the second association demand can be set according to the direct demand and the indirect demand. In setting the coefficient values, the importance of the direct demand and the indirect demand needs to be combined.
For example, since the requirement affected by the code change is a direct requirement, that is, the first associated requirement corresponding to the code change module is a direct requirement, the direct requirement may be more important to the software, and thus the coefficient value of the first associated requirement may be set to 2, and the coefficient value corresponding to the code change module may also be set to 2. The requirement influenced by the interface module is an indirect requirement, that is, the second associated requirement corresponding to the interface module is an indirect requirement, and the indirect requirement has a smaller influence on software, so that the coefficient value of the second associated requirement can be set to be 1.
After setting the coefficient value, a plurality of target test cases can be determined from the plurality of test cases according to the coefficient value. Specifically, since the multiple requirements may correspond to the same test case, that is, the same test case may correspond to the multiple requirements, the multiple requirements may include a first association requirement and a second association requirement, and the requirements corresponding to the change requirement module may also be included.
Therefore, the first association requirement number, the second association requirement number and the change requirement module number corresponding to each test case can be determined specifically according to the preset requirement and the case corresponding table. Illustratively, use case 1 may correspond to one first association requirement, two second association requirements; use case 2 corresponds to a first association requirement; use case 3 corresponds to a change requirement.
And then, calculating an influence value corresponding to each test case according to the first association requirement number, the second association requirement number, the change requirement module number and the coefficient values corresponding to the set first association requirement, the change requirement module and the second association requirement, which correspond to each test case, and determining a target test case in a plurality of test cases according to the influence values.
The algorithm for influencing the value of the degree is explained below by means of a specific example:
if the test case 1 corresponds to 1 first association requirement and 2 second association requirements, that is, the number of first association requirements and the number of second association requirements corresponding to the test case 1 are 1, the number of change requirements is 2, and 0, and because the set coefficient values of the first association requirements and the change requirements are 2 and the coefficient value of the second association requirements is 1, the influence value of the test case 1 can be: 1×2+2×1+0×2=4, that is, the influence value is calculated by multiplying the number of requirements corresponding to the use case by the coefficient value corresponding to the requirement, if the use case corresponds to a plurality of requirements, the products of the number of requirements and the coefficient value corresponding to the number of requirements may be added.
After the influence value of each test case is calculated, the plurality of test cases can be ordered according to the influence value of each test case, specifically, the order of the influence values from large to small can be adopted, then the test cases with smaller influence values in the order can be removed, and the remaining test cases are the target test cases. Specifically, to ensure accuracy of the regression test, the number of target test cases left can be defined. Therefore, the test cases with high influence degree are screened out as target test cases, so that the test precision can be ensured, the test quantity can be reduced, and the test efficiency is improved. In the application, the codes and the demands are integrated, namely, the test cases corresponding to the changed code modules and the test cases corresponding to the demands of the demand document change are integrated, so that the screened target test cases can make the test more comprehensive.
205. And carrying out regression testing on the appointed software based on the multiple target test cases.
The implementation of step 205 is the same as that of step 104, and the same technical effects can be achieved, so that the same technical problems are solved, and the detailed description is not repeated here.
Further, as an implementation of the method shown in fig. 1, the embodiment of the application further provides a software regression testing device, which is used for implementing the method shown in fig. 1. The embodiment of the device corresponds to the embodiment of the method, and for convenience of reading, details of the embodiment of the method are not repeated one by one, but it should be clear that the device in the embodiment can correspondingly realize all the details of the embodiment of the method. As shown in fig. 3, the apparatus includes:
an obtaining unit 301, configured to obtain a plurality of change modules in the specified software, where the change modules include a change code module and a change requirement module;
a first determining unit 302, configured to determine, based on a preset correspondence table, a plurality of test cases corresponding to the plurality of modification modules acquired by the acquiring unit;
a second determining unit 303, configured to determine a plurality of target test cases from the plurality of test cases determined by the first determining unit 302 based on a preset computing method;
and a test unit 304, configured to perform a regression test on the specified software based on the multiple target test cases determined by the second determination unit 303.
Further, as an implementation of the method shown in fig. 2, another software regression testing apparatus is further provided in the embodiment of the present application, which is used to implement the method shown in fig. 2. The embodiment of the device corresponds to the embodiment of the method, and for convenience of reading, details of the embodiment of the method are not repeated one by one, but it should be clear that the device in the embodiment can correspondingly realize all the details of the embodiment of the method. As shown in fig. 4, the apparatus includes:
an obtaining unit 301, configured to obtain a plurality of change modules in the specified software, where the change modules include a change code module and a change requirement module;
a first determining unit 302, configured to determine, based on a preset correspondence table, a plurality of test cases corresponding to the plurality of modification modules acquired by the acquiring unit;
a second determining unit 303, configured to determine a plurality of target test cases from the plurality of test cases determined by the first determining unit 302 based on a preset computing method;
and a test unit 304, configured to perform a regression test on the specified software based on the multiple target test cases determined by the second determination unit 303.
In an alternative embodiment, the acquiring unit 301 includes:
a first obtaining module 3011, configured to obtain a plurality of code changing modules of the specified software based on the history code and the update code of the specified software;
and a second obtaining module 3012, configured to obtain a change requirement module of the specified software based on the historical requirement document and the update requirement document of the specified software.
In an alternative embodiment, the first determining unit 302 includes:
an interface determining module 3021, configured to determine a plurality of interface modules corresponding to the plurality of change code modules;
a requirement determining module 3022, configured to determine, based on a preset requirement code correspondence table, first association requirements corresponding to the plurality of change code modules and second association requirements corresponding to the plurality of interface modules determined by the interface determining module 3021;
the first case determining module 3023 is configured to determine, based on a preset requirement case correspondence table, the first association requirement, the second association requirement and the plurality of test cases corresponding to the change requirement module, which are determined by the requirement determining module 3022.
In an alternative embodiment, the second determining unit 303 includes:
the coefficient value determining module 3031 is configured to set a first coefficient value corresponding to the first association requirement and the change requirement module, and a second coefficient value corresponding to the second association requirement;
the second case determining module 3032 is configured to determine a plurality of target test cases from the plurality of test cases based on the first coefficient value and the second coefficient value set by the coefficient value determining module 3031.
In an alternative embodiment, the second use case determining module 3032 includes:
the quantity determination submodule 30321 is configured to determine a first association requirement quantity, a second association requirement quantity and a change requirement module quantity corresponding to each test case respectively based on a preset requirement case correspondence table;
the second case determining submodule 30322 is configured to determine a plurality of target test cases from the plurality of test cases based on the first association requirement number, the second association requirement number, the change requirement module number, the first coefficient value and the second coefficient value, which are respectively corresponding to each test case and determined by the number determining submodule 30321.
In an alternative embodiment, the second use case determination submodule 30322 is specifically configured to:
determining an influence value corresponding to each test case based on the first association requirement number, the second association requirement number, the change requirement module number, the first coefficient value and the second coefficient value corresponding to each test case respectively;
and determining a plurality of target test cases from the plurality of test cases based on the influence value corresponding to each test case.
In an optional implementation manner, the second case determining submodule 30322 is specifically configured to, when determining, based on the influence value corresponding to each test case, a plurality of target test cases among the plurality of test cases:
sequencing the plurality of test cases according to the influence value corresponding to each test case to obtain a test case sequence;
and determining a plurality of target test cases from the plurality of test cases based on the test case sequence.
Further, an embodiment of the present application further provides a storage medium, where the storage medium is configured to store a computer program, where when the computer program runs, the computer program controls a device where the storage medium is located to execute the software regression testing method described in fig. 1-2.
Further, an embodiment of the present application further provides a processor, where the processor is configured to execute a program, where the program executes the software regression testing method described in fig. 1-2.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the methods and apparatus described above may be referenced to one another. In addition, the "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent the merits and merits of the embodiments.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, the present application is not directed to any particular programming language. It will be appreciated that the teachings of the present application described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present application.
Furthermore, the memory may include volatile memory, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), in a computer readable medium, the memory including at least one memory chip.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.