Reusable software test case method, apparatus, device, and storage medium
By using preset flag coefficients to identify reusable test cases within test cases of the same technical field and testing level, and adding them to the reference library, the problem of cost waste and cycle extension caused by independent test case design is solved, thereby achieving reduced testing efficiency and cost, as well as standardization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2022-09-05
- Publication Date
- 2026-07-21
AI Technical Summary
In software testing, test case designs for different projects in the same domain are independent and highly different, leading to wasted human resources and extended testing cycles. Furthermore, the habits and experiences of different testers result in inconsistent design standards.
By acquiring test cases in the same technical field and testing level, calculating the total number and execution times, determining reusable test cases using preset flag coefficients and adding them to the reference library, optimizing and adjusting them before adding them to the reusable test case reference library, and periodically reviewing and removing unreusable test cases.
It improved software testing efficiency, shortened the testing cycle, reduced testing costs, and achieved standardization and unification of test cases, thereby improving software quality.
Smart Images

Figure CN115454842B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing technology, and in particular to a method, apparatus, device, and storage medium for reusable software test cases. Background Technology
[0002] With the rapid development of the software industry, software has become increasingly larger and more complex, leading to a higher probability of defects. Although auxiliary methods such as code review and formal verification exist, software testing remains the primary means of ensuring software quality, playing a crucial role throughout the software's lifecycle. Of course, many factors influence software testing results, such as the complexity of the software itself, the skill level of the developers, and the testing methods and techniques used.
[0003] In software testing, test cases are indispensable. They play a guiding role in the testing process, minimizing human error and ensuring stable software quality. Traditionally, the design, writing, execution, and management of test cases involve manually identifying test requirements, writing test cases based on those requirements, and then executing the software tests according to those test cases.
[0004] However, in typical software development projects, test case libraries are independent for different projects. Testers often need to design test cases based on the specific requirements of each project to create independent test case libraries for each project. However, for products developed by the same company or even different companies in the same field, there is often a sharing of functionalities between products. Therefore, test cases also have similarities. If different testers redesign test cases for similar functions of each product, it may lead to a waste of human resources and a prolonged project cycle. Furthermore, test case design is closely related to the personal habits and testing experience of testers; different testers will write different test cases, which can also lead to inconsistent test case design standards. Summary of the Invention
[0005] Based on this, this application provides a reusable software test case method, apparatus, device, and storage medium. By using reusable test cases for products with similar functions developed in the same field, the efficiency of software testing can be effectively improved, the software testing cycle can be shortened, and the software testing cost can be reduced.
[0006] Firstly, a reusable software test case method is provided, the method comprising:
[0007] Obtain test cases from the same technical field and the same testing level; wherein, the number of test cases is one or more;
[0008] Obtain the preset flag coefficients of reusable test cases, and calculate the total number of test cases and the total number of executions.
[0009] Based on the total number of test cases, the total number of executions, and the preset flag coefficients of reusable test cases, reusable test cases are identified and added to the reusable test case reference library.
[0010] According to one achievable method in an embodiment of this application, test cases of the same technical field and the same testing level are obtained, including:
[0011] Obtain field information on the technical field and test level in each test case;
[0012] The technical field and testing level of each test case are determined based on the field information.
[0013] According to one feasible method in the embodiments of this application, the total number of obtained test cases and the total number of executions are calculated, including:
[0014] The total number of test cases is obtained by summing the acquired test cases, and the number of times each test case is executed is obtained.
[0015] The total number of executions for multiple test cases is obtained based on the total number of test cases and the number of times each test case is executed.
[0016] According to one feasible method in an embodiment of this application, reusable test cases are determined and added to the reusable test case reference library based on the total number of test cases, the total number of executions, and a preset flag coefficient for reusable test cases, including:
[0017] Based on the total number of test cases, the total number of executions, and the preset flag coefficients of reusable test cases, the number of executions of reusable test cases is obtained.
[0018] The number of times each test case is executed is compared with the number of times the reusable test case is executed. Test cases with a number of executions greater than the number of times the flag is executed are identified as reusable test cases and added to the reusable test case reference library.
[0019] According to one achievable method in an embodiment of this application, the method further includes:
[0020] Optimize and adjust test cases that have been executed more times than the specified number of times to obtain optimized test cases.
[0021] Optimize test cases to identify reusable test cases and add them to the reusable test case reference library.
[0022] According to one achievable method in an embodiment of this application, the method further includes:
[0023] Review and verify the reusable test cases added to the reusable test case reference library;
[0024] Obtain the preset retrospective flag coefficients for reusable test cases and calculate the total number of reusable test cases;
[0025] Obtain the execution count of each reusable test case, and combine it with the total number of reusable test cases to get the total execution count of multiple reusable test cases;
[0026] Based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficients of reusable test cases, non-reusable test cases are identified and removed from the reusable test case reference library.
[0027] According to one feasible method in the embodiments of this application, based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficient of reusable test cases, non-reusable test cases are determined and removed from the reusable test case reference library, including:
[0028] Based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficients of reusable test cases, the minimum number of executions for reusable test cases is obtained;
[0029] The number of times each reusable test case is executed is compared with the minimum number of times a reusable test case is executed. Reusable test cases with fewer executions than the minimum number of executions are identified as non-reusable test cases and removed from the reusable test case reference library.
[0030] Secondly, a reusable software test case apparatus is provided, the apparatus comprising:
[0031] The acquisition module is used to acquire test cases in the same technical field and at the same testing level; wherein, the number of test cases is one or more.
[0032] The calculation module is used to obtain the preset flag coefficients of reusable test cases and calculate the total number of test cases and the total number of executions.
[0033] The determination module is used to determine reusable test cases and add them to the reusable test case reference library based on the total number of test cases, the total number of executions, and the preset flag coefficients of reusable test cases.
[0034] Thirdly, a computer device is provided, comprising:
[0035] At least one processor; and
[0036] A memory that is communicatively connected to at least one processor; wherein,
[0037] The memory stores computer instructions that can be executed by at least one processor to enable the at least one processor to perform the methods involved in the first aspect above.
[0038] Fourthly, a computer-readable storage medium is provided, having stored thereon computer instructions, characterized in that the computer instructions are used to cause a computer to perform the methods involved in the first aspect above.
[0039] According to the technical content provided in the embodiments of this application, test cases in the same technical field and at the same testing level are obtained; preset flag coefficients for reusable test cases are obtained, and the total number of obtained test cases and the total number of executions are calculated; based on the total number of test cases, the total number of executions, and the preset flag coefficients for reusable test cases, reusable test cases are determined and added to the reusable test case reference library. The above operations will place products with similar functions developed in the same field into the same reusable test case library using reusable test cases, so that testers can directly refer to and use them later, effectively improving the efficiency of software testing, shortening the software testing cycle, and reducing software testing costs. Attached Figure Description
[0040] Figure 1 This is an application environment diagram of a reusable software test case method in one embodiment;
[0041] Figure 2 This is a flowchart illustrating a reusable software test case method in one embodiment. Figure 1 ;
[0042] Figure 3 This is a flowchart illustrating a reusable software test case method in one embodiment. Figure 2 ;
[0043] Figure 4 This is a schematic diagram of a preferred process for a reusable software test case method in one embodiment;
[0044] Figure 5 This is a structural block diagram of a reusable software test case device in one embodiment;
[0045] Figure 6 This is a schematic structural diagram of a computer device in one embodiment. Detailed Implementation
[0046] The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the scope of the present application.
[0047] This application provides a reusable software test case method that can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. Server 104 obtains test cases of the same technical field and testing level from terminal 102; server 104 obtains preset flag coefficients for reusable test cases and calculates the total number of test cases and the total number of executions; based on the total number of test cases, the total number of executions, and the preset flag coefficients for reusable test cases, server 104 determines reusable test cases and adds them to the reusable test case reference library. Terminal 102 can be, but is not limited to, various personal computers, laptops, and tablets, and server 104 can be a standalone server or a server cluster consisting of multiple servers.
[0048] Figure 2 A flowchart illustrating a reusable software test case method provided in this application embodiment, the method can be performed by, for example... Figure 1 Server 104 in the system shown is executing. For example... Figure 2 As shown, the method may include the following steps:
[0049] Step 201: Obtain test cases in the same technical field and at the same testing level.
[0050] The number of test cases must be one or more. As is well known, the role of test cases in software testing is mainly reflected in: guiding test implementation, planning test data preparation, serving as a "design specification" for writing automated test scripts, providing metrics for evaluating test results, and defining standards for defect analysis. In other words, the control and guidance role of test cases in testing is equivalent to the guidance role of design documents in coding, highlighting their extreme importance. Furthermore, the core task of software testing is to generate and execute software test cases to verify software quality. Therefore, reusing test cases will greatly improve the efficiency of software testing.
[0051] Here, a key characteristic of reusable test cases lies in the fact that they are implemented within the same technical field; that is, the higher the degree of similarity in the technical fields, the greater the reusability. Therefore, it is necessary to obtain test cases within the same technical field.
[0052] Furthermore, since test cases are divided into different levels during the testing phase, test cases at the same testing level are required to achieve reusable functionality, even when the technical fields are the same.
[0053] Step 203: Obtain the preset flag coefficients of reusable test cases, and calculate the total number of test cases and the total number of executions.
[0054] Among them, the preset flag coefficient of reusable test cases is represented by k1, which is pre-set in the test system by the testers according to specific test requirements.
[0055] Based on the number of test cases obtained above, the total number of test cases is obtained by summing up all the test case counts, and the total number of executions of multiple test cases can be obtained based on the number of executions of each test case.
[0056] Step 205: Based on the total number of test cases, the total number of executions, and the preset flag coefficients of reusable test cases, determine the reusable test cases and add them to the reusable test case reference library.
[0057] The total number of test cases is represented by n; the total number of times the test cases are executed is represented by A.
[0058] Based on the analysis and calculation of n, k1, and A, reusable test cases can be identified and added to the reusable test case reference library. It should be noted that all reusable test cases in this reference library are based on the same technical field and the same testing level; different fields and different testing levels will have different reusable test case reference libraries.
[0059] As can be seen, the embodiments of this application obtain test cases from the same technical field and the same testing level; obtain preset flag coefficients for reusable test cases; and calculate the total number of test cases and the total number of executions. Based on the total number of test cases, the total number of executions, and the preset flag coefficients for reusable test cases, reusable test cases are determined and added to the reusable test case reference library. The above operations allow products with similar functions developed in the same technical field to be placed into the same reusable test case reference library using reusable test cases, so that testers can directly refer to and use them later, effectively improving the efficiency of software testing, shortening the software testing cycle, and reducing software testing costs.
[0060] The following is a detailed description of each step in the above method flow. First, step 201, namely "obtaining test cases of the same technical field and the same testing level", will be described in detail with reference to the embodiment.
[0061] Obtain the field information of the technical field and test level in each test case; determine the technical field and test level of each test case based on the field information.
[0062] Specifically, when testers begin writing test cases, they first categorize the different systems under test according to their technical fields, such as communication tools, antivirus software, and browsers, and record this information as field data in the test cases. Therefore, after obtaining the technical field information from each test case, the server can determine the technical field to which the test case applies. Similarly, the test level of a test case is categorized according to its technical field; testers also divide the different systems under test into test levels and record this information as field data in the test cases. Therefore, after obtaining the test level information from each test case, the server can determine the test level to which the test case applies.
[0063] Here, testing can typically be divided into three layers: the user layer, the application layer, and the functional layer. The user layer primarily focuses on testing the end-users of the product. It emphasizes testing the system's support for users, the standardization, user-friendliness, and operability of the user interface, as well as data security. This mainly includes user support testing, user interface testing, maintainability testing, and security testing. The application layer tests the product for engineering or industry applications. It focuses on testing the system's compatibility, reliability, and performance from the perspective of system application, simulating real-world application environments. This mainly includes system performance testing, system reliability and stability testing, system compatibility testing, system networking testing, and system installation and upgrade testing. The functional layer primarily tests the implementation of the product's specific functions. The functional layer encompasses the main business aspects of the software product, including its main functions and requirements.
[0064] The following describes in detail, with reference to an embodiment, step 203 above, "and calculate the total number of test cases and the total number of executions".
[0065] The total number of test cases is obtained by summing the acquired test cases, and the number of times each test case is executed is obtained. Based on the total number of test cases and the number of times each test case is executed, the total number of executions of multiple test cases is obtained.
[0066] Here, the total number of test cases, n, is obtained by summing the acquired test cases. Based on previous testing work, the execution count of each test case can be calculated using 'a'. i The number of times the first test case is executed is denoted by a1, the number of times the second test case is executed is denoted by a2, and so on, with the number of times the i-th test case is executed being denoted by a... i express.
[0067] The total number of test cases A is obtained by considering the total number of test cases and the number of times each test case is executed. The specific expression is as follows:
[0068]
[0069] The following describes in detail step 205, "determining reusable test cases and adding them to the reusable test case reference library based on the total number of test cases, the total number of executions, and the preset flag coefficient of reusable test cases," with reference to the embodiments.
[0070] Based on the total number of test cases, the total number of executions, and the preset flag coefficient of reusable test cases, the flag execution count of reusable test cases is obtained. The execution count of each test case is compared with the flag execution count of reusable test cases. Test cases with an execution count greater than the flag execution count are identified as reusable test cases and added to the reusable test case reference library.
[0071] Here, based on the total number of test cases n, the total number of executions A, and the preset flag coefficient k1 for reusable test cases, the number of executions of the reusable test cases is represented by m, and the specific expression is as follows:
[0072]
[0073] Among them, the reusable test case flag coefficient Since reusable test cases are pre-configured by testers, the specific value of k1 is not limited here. However, it should be noted that the larger the value of k1, the higher the requirement for the number of times the reusable test cases can be executed; conversely, the smaller the value of k1, the lower the requirement.
[0074] After obtaining the execution count of the reusable test cases, the execution count of each test case is compared with the execution count of the reusable test cases, i.e., m and a. i Compare the test cases; identify those that have been executed more times than the specified number of times as reusable test cases, i.e., those executed in step a. i When >m, then a can be i The corresponding test cases were identified as reusable test cases, and all a i Test cases larger than m are added to the reusable test case reference library for testers to refer to or use later.
[0075] In some embodiments, the method further includes: optimizing and adjusting test cases that have been executed more times than the number of times a flag has been executed to obtain optimized test cases; and identifying the optimized test cases as reusable test cases and adding them to a reusable test case reference library.
[0076] Here, test case design focuses more on the "testing philosophy" rather than specific operational steps to enable test case reuse. When designing reusable test cases, the test cases are not used to describe the specific implementation, but rather to describe the problem-solving approach. Therefore, after selecting test cases whose execution count exceeds a certain threshold, to reduce the correlation between the test cases and the specific application's tested module, and to ensure that the test cases fully cover the common requirements of the corresponding technical field and testing level, the selected test cases will undergo further fine-tuning, i.e., optimization, to obtain optimized test cases. These optimized test cases are then identified as reusable test cases and added to the reusable test case reference library to better suit reusability requirements.
[0077] By performing the above operations, frequently occurring test cases are compiled separately and added to a reusable test case reference library. Later, when encountering projects in the same technical field and at the same testing level, testers can compare these reusable test cases to find the closest match and make minor modifications. This not only saves time in the test case writing stage, shortening project timelines, but also allows for more comprehensive testing of the software under test by selecting the most detailed reusable test cases, improving software quality and ultimately achieving software quality goals.
[0078] In some embodiments, such as Figure 3 As shown, the method also includes the following steps:
[0079] Step 301: Review and verify the reusable test cases added to the reusable test case reference library.
[0080] Here, after adding reusable test cases to the reusable test case reference library, you can also periodically review and verify the execution status of the reusable test cases.
[0081] Step 303: Obtain the preset retrospective flag coefficients of reusable test cases and calculate the total number of reusable test cases.
[0082] Among them, the preset review flag coefficient of reusable test cases is represented by k2; the total number of reusable test cases is represented by q.
[0083] Here, all reusable test cases are summed to obtain the total number q of reusable test cases in the reusable test case reference library.
[0084] Step 305: Obtain the execution count of each reusable test case, and combine it with the total number of reusable test cases to obtain the total execution count of multiple reusable test cases.
[0085] Here, p is used to obtain the execution count of each reusable test case. jDenoted as; among which, the execution times of the first reusable test case are denoted as p1, the execution times of the second test case are denoted as p2, and so on. The execution times of the j-th test case are denoted as p j Denoted as. Combining the total number of reusable test cases, the total execution times of multiple reusable test cases are denoted as Q, and its specific expression is as follows:
[0086]
[0087] Step 307: Based on the total number of reusable test cases, the total execution times, and the preset review flag coefficient of the reusable test cases, obtain the minimum execution times of the reusable test cases.
[0088] Here, based on the total number of test cases q, the total execution times Q, and the preset flag coefficient k2 of the reusable test cases, the minimum execution times of the reusable test cases are denoted as u, and the specific expression is as follows:
[0089]
[0090] Among which, the preset flag coefficient of the reusable test cases Since the preset flag coefficient of the reusable test cases is also preset by the tester in advance, generally, k2 is set to be equal to k1. Of course, they can also be not equal, and the specific value of k2 is not limited here. However, it still needs to be noted that the larger the value of k2, the higher the requirement for the execution times of the reusable test cases; on the contrary, the lower the requirement.
[0091] Step 309: Compare the execution times of each reusable test case with the minimum execution times of the reusable test cases, and determine the reusable test cases with execution times less than the minimum execution times as non-reusable test cases and remove the non-reusable test cases from the reusable test case reference library.
[0092] Here, compare the execution times of each reusable test case with the minimum execution times of the reusable test cases, that is, compare p j and u, and determine the reusable test cases with execution times less than the minimum execution times as non-reusable test cases, that is, determine the reusable test cases with p j <u as non-reusable test cases, and remove the non-reusable test cases from the reusable test case reference library, indicating that they no longer meet the requirements of the reusable test cases.
[0093] The above operations, through the maintenance of the reusable test case library, not only require regularly adding reusable test cases to the reusable test case reference library, but also regularly deleting test cases that no longer meet the requirements for reusable test cases, thereby improving the reusable test case library.
[0094] Based on the implementation methods in the above embodiments, the following will be combined with... Figure 4 A preferred method flow provided in an embodiment of this application will be described by way of example. For instance... Figure 4 As shown, the method may include the following steps:
[0095] Step 401: Obtain the field information of the technical field and test level in each test case.
[0096] Step 402: Determine the technical field and testing level of each test case based on the field information.
[0097] Step 403: Obtain test cases in the same technical field and at the same testing level; wherein, the number of test cases is one or more.
[0098] Step 404: Obtain the preset flag coefficients for reusable test cases.
[0099] Step 405: Sum the obtained test cases to get the total number of test cases, and obtain the number of times each test case was executed.
[0100] Step 406: Based on the total number of test cases and the number of times each test case is executed, obtain the total number of executions of multiple test cases.
[0101] Step 407: Based on the total number of test cases, the total number of executions, and the preset flag coefficient of reusable test cases, obtain the flag execution count of reusable test cases.
[0102] Step 408: Compare the number of times each test case is executed with the number of times the flag of reusable test cases is executed.
[0103] Step 409: Optimize and adjust the test cases that have been executed more times than the flag execution count to obtain optimized test cases.
[0104] Step 410: Determine the optimized test cases as reusable test cases and add them to the reusable test case reference library.
[0105] It should be understood that, although Figures 2-4 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this application, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Furthermore, Figures 2-4At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0106] Figure 5 This is a schematic diagram of a reusable software test case device provided in an embodiment of this application. The device can be disposed in... Figure 1 Server 104 in the system shown executes, to perform, as follows Figures 2-4 The method flow is shown below. Figure 5 As shown, the device may include: an acquisition module 501, a calculation module 503, and a determination module 505. The main functions of each component module are as follows:
[0107] The acquisition module 501 is used to acquire test cases in the same technical field and at the same testing level; wherein the number of test cases is one or more.
[0108] The calculation module 503 is used to obtain the preset flag coefficients of reusable test cases and calculate the total number of test cases and the total number of executions.
[0109] The determination module 505 is used to determine reusable test cases and add them to the reusable test case reference library based on the total number of test cases, the total number of executions, and the preset flag coefficients of reusable test cases.
[0110] In some embodiments, the acquisition module 501 is further configured to:
[0111] Obtain field information on the technical field and test level in each test case;
[0112] The technical field and testing level of each test case are determined based on the field information.
[0113] In some embodiments, the computing module 503 is further configured to:
[0114] The total number of test cases is obtained by summing the acquired test cases, and the number of times each test case is executed is obtained.
[0115] The total number of executions for multiple test cases is obtained based on the total number of test cases and the number of times each test case is executed.
[0116] In some embodiments, the determining module 505 is further configured to:
[0117] Based on the total number of test cases, the total number of executions, and the preset flag coefficients of reusable test cases, the number of executions of reusable test cases is obtained.
[0118] The number of times each test case is executed is compared with the number of times the reusable test case is executed. Test cases with a number of executions greater than the number of times the flag is executed are identified as reusable test cases and added to the reusable test case reference library.
[0119] In some embodiments, the device is further used for:
[0120] Optimize and adjust test cases that have been executed more times than the specified number of times to obtain optimized test cases.
[0121] Optimize test cases to identify reusable test cases and add them to the reusable test case reference library.
[0122] In some embodiments, the device is further used for:
[0123] Review and verify the reusable test cases added to the reusable test case reference library;
[0124] Obtain the preset retrospective flag coefficients for reusable test cases and calculate the total number of reusable test cases;
[0125] Obtain the execution count of each reusable test case, and combine it with the total number of reusable test cases to get the total execution count of multiple reusable test cases;
[0126] Based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficients of reusable test cases, non-reusable test cases are identified and removed from the reusable test case reference library.
[0127] In some embodiments, the device is further used for:
[0128] Based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficients of reusable test cases, the minimum number of executions for reusable test cases is obtained;
[0129] The number of times each reusable test case is executed is compared with the minimum number of times a reusable test case is executed. Reusable test cases with fewer executions than the minimum number of executions are identified as non-reusable test cases and removed from the reusable test case reference library.
[0130] According to the specific embodiments provided in this application, the technical solution provided in this application can have the following advantages:
[0131] 1) For products developed by the same company or even different companies in the same field, and for products with similar functions, reusable test cases can effectively improve the efficiency of writing software test cases, shorten the software testing cycle, and reduce software testing costs.
[0132] 2) It can help testers understand the test points that the requirements need to cover and their corresponding entry / exit standards, so as to achieve the goal of unifying product quality standards. It has positive significance for reusable test cases and product standardization in the same field and at the same level within the same company and even the industry.
[0133] It is understood that implementing any method or product of this application does not necessarily require achieving all of the above advantages simultaneously.
[0134] The same or similar parts among the above embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.
[0135] It should be noted that the embodiments of this application may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country (e.g., explicit consent from the user, actual notification to the user, explicit authorization from the user, etc.).
[0136] According to embodiments of this application, this application also provides a computer device and a computer-readable storage medium.
[0137] like Figure 6 The diagram shown is a block diagram of a computer device according to an embodiment of this application. The term "computer device" is intended to represent various forms of digital computers or mobile devices. The digital computer may include a desktop computer, a portable computer, a workbench, a personal digital assistant, a server, a mainframe computer, and other suitable computers. The mobile device may include a tablet computer, a smartphone, a wearable device, etc.
[0138] like Figure 6 As shown, device 600 includes a computing unit 601, a ROM 602, a RAM 603, a bus 604, and an input / output (I / O) interface 605. The computing unit 601, ROM 602, and RAM 603 are interconnected via the bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0139] The computing unit 601 can execute various processes in the method embodiments of this application according to computer instructions stored in the read-only memory (ROM) 602 or computer instructions loaded from the storage unit 608 into the random access memory (RAM) Y03. The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. The computing unit 601 can include, but is not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. In some embodiments, the methods provided in the embodiments of this application can be implemented as computer software programs, which are tangibly contained in a computer-readable storage medium, such as the storage unit 608.
[0140] RAM 603 may also store various programs and data required for the operation of device 600. Part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609.
[0141] The input unit 606, output unit 607, storage unit 608, and communication unit 609 in device 600 can be connected to I / O interface 605. The input unit 606 can be, for example, a keyboard, mouse, touchscreen, or microphone; the output unit 607 can be, for example, a display, speaker, or indicator light. Device 600 can exchange information and data with other devices through the communication unit 609.
[0142] It should be noted that the device may also include other components necessary for normal operation. It may also include only the components necessary for implementing the solution of this application, without necessarily including all the components shown in the figures.
[0143] Various implementations of the systems and techniques described 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-a-chip (SOCs), payload programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof.
[0144] The computer instructions used to implement the methods of this application may be written in any combination of one or more programming languages. These computer instructions may be provided to the computing unit 601 such that when executed by the computing unit 601, such as a processor, the computer instructions cause the execution of the steps involved in the embodiments of the methods of this application.
[0145] The computer-readable storage medium provided in this application can be a tangible medium that can contain or store computer instructions for performing the steps involved in the method embodiments of this application. The computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, and other forms of storage media.
[0146] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A reusable software test case method, characterized in that, The method includes: Obtain the technical field and test level field information of the test cases, and determine the test cases with the same technical field and test level based on the field information; wherein, the number of the test cases is one or more. The total number of test cases is obtained by summing the acquired test cases, and the number of times each test case is executed is obtained. The total number of executions of multiple test cases is obtained based on the total number of test cases and the number of times each test case is executed; Obtain the preset flag coefficients for reusable test cases. Based on the total number of test cases, the total number of executions, and the preset flag coefficients, obtain the flag execution count for each reusable test case. The expression for the flag execution count is as follows: ; Where m represents the number of times the reusable test case flag is executed; k1 represents the reusable test case flag coefficient. A represents the total number of times the test cases were executed; n represents the total number of test cases; i represents the index of the number of test cases. Index indicating the number of times a test case has been executed; The number of times each test case is executed is compared with the number of times the flag of the reusable test case is executed. Test cases with a number of executions greater than the number of times the flag is executed are identified as reusable test cases and added to the reusable test case reference library.
2. The method according to claim 1, characterized in that, The method also includes: The test cases that have been executed more times than the specified number of times have been executed have been optimized and adjusted to obtain optimized test cases. The optimized test cases are identified as reusable test cases and added to the reusable test case reference library.
3. The method according to any one of claims 1-2, characterized in that, The method also includes: Perform a retrospective review and verification of the reusable test cases added to the reusable test case reference library; Obtain the preset retrospective flag coefficients for reusable test cases, and calculate the total number of reusable test cases; The execution count of each reusable test case is obtained, and the total execution count of multiple reusable test cases is obtained by combining the total number of reusable test cases. Based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficient of the reusable test cases, non-reusable test cases are determined and removed from the reusable test case reference library.
4. The method according to claim 3, characterized in that, The process of determining non-reusable test cases and removing them from the reusable test case reference library based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficient of the reusable test cases includes: Based on the total number of reusable test cases, the total number of executions, and the preset review flag coefficient of the reusable test cases, the minimum number of executions for the reusable test cases is obtained; The number of times each reusable test case is executed is compared with the minimum number of times each reusable test case is executed. Reusable test cases with fewer than the minimum number of times are identified as non-reusable test cases and removed from the reusable test case reference library.
5. A reusable software test case apparatus, characterized in that, The device includes: The acquisition module is used to acquire field information of the technical field and test level of the test cases, and to determine test cases of the same technical field and test level based on the field information; wherein, the number of test cases is one or more. The calculation module is used to sum the acquired test cases to obtain the total number of test cases and obtain the execution count of each test case; based on the total number of test cases and the execution count of each test case, the total execution count of multiple test cases is obtained. The determination module is used to obtain the preset flag coefficients of reusable test cases. Based on the total number of test cases, the total number of executions, and the preset flag coefficients, the number of flag executions for reusable test cases is obtained; wherein, the expression for the number of flag executions is as follows: ; Where m represents the number of times the reusable test case flag is executed; k1 represents the reusable test case flag coefficient. A represents the total number of times the test cases were executed; n represents the total number of test cases; i represents the index of the number of test cases. Index indicating the number of times a test case has been executed; The number of times each test case is executed is compared with the number of times the flag of the reusable test case is executed. Test cases with a number of executions greater than the number of times the flag is executed are identified as reusable test cases and added to the reusable test case reference library.
6. A computer device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores computer instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-4.
7. A computer-readable storage medium storing computer instructions thereon, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 4.