Data management method and device for automated testing and computer program product
By establishing the mapping relationship between the variable name and the test data during the design of the test case, directly obtain and use the test data during the execution of the test case, solve the problem of low test efficiency in automated testing, and achieve more efficient test execution.
Patent Information
- Application Number
- CN202411486911.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-28
AI Technical Summary
The testing efficiency of automated tests in the prior art is mainly due to the need to extract variables of the test script during the execution of test cases, and the extraction failure is frequent.
During the design of the test case, determine the variable names used by logical input and logical output, and create a mapping relationship between variable names and test data. During the execution of the test case, directly obtain and use the corresponding test data according to the mapping relationship to avoid extracting the variables of the test script.
Through the direct acquisition and use of test data, the efficiency of automation testing is improved, and the problem of low test efficiency caused by extracting failure is avoided.
Smart Images

Figure CN119377114A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automated testing technology, and in particular to a data management method, device, computer-readable storage medium and computer program product for automated testing. Background Art
[0002] In the process of embedded software development and testing, in order to improve the efficiency and quality of software testing, it is necessary to design automated test cases. Among them, the visualization and data sharing of the test data management module play a key role in the quality of test case design and execution efficiency. Summary of the invention
[0003] The main purpose of the present application is to provide a data management method, device, computer-readable storage medium and computer program product for automated testing, so as to at least solve the problem of low test efficiency of automated testing in the prior art.
[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a data management method for automated testing is provided, comprising: in a test case design process, determining the variable names of the variables used for the logical input and logical output in the test case, and establishing a mapping relationship between each variable name and the test data, with one test data corresponding to one variable name; in a test case execution process, obtaining the variable names corresponding to the logical input and the logical output, and determining the test data corresponding to the variable names according to the mapping relationship, using the test data corresponding to the variable names as the value of the variable to execute the logical input, calculation process and the logical output, and completing the call of the test data in the test case execution process.
[0005] Optionally, a mapping relationship between each variable name and test data is established, including: establishing a corresponding test data entry according to each variable name, the test data entry is a test data, and the test data entry includes the variable name, data type, initial setting value, process update value and variable description identifier; all the test data entries are aggregated to obtain the mapping relationship, and the mapping relationship corresponds one-to-one with the test case.
[0006] Optionally, during the execution of the test case, the variable names corresponding to the logical input and the logical output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship, and the test data corresponding to the variable names are used as the values of the variables to execute the logical input, the calculation process and the logical output, so as to complete the call of the test data in the test case execution process, including: obtaining the first variable name corresponding to the logical input of the first test case; determining the test data corresponding to the first variable name according to the mapping relationship, and obtaining the process update value of the first variable name; using the process update value of the first variable name as the value of the logical input to perform the calculation process of the first test case, and obtaining the first target process update value; the process update value of the test data corresponding to the first variable name remains unchanged, and the process update value of the test data corresponding to the second variable name corresponding to the logical output of the first test case is updated to the first target process update value.
[0007] Optionally, during the execution of the test case, the variable names corresponding to the logical input and the logical output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship, and the test data corresponding to the variable names are used as the value of the variable to execute the logical input, the calculation process and the logical output, to complete the call of the test data in the test case execution process, and also includes: obtaining the second variable name corresponding to the logical input of the second test case; determining the test data corresponding to the second variable name according to the mapping relationship, and obtaining the process update value of the second variable name; performing the calculation process of the second test case with the process update value of the second variable name as the value of the logical input, and obtaining the second target process update value; updating the process update value of the test data corresponding to the second variable name corresponding to the logical output of the second test case to the second target process update value.
[0008] Optionally, during the execution of the test case, the variable names corresponding to the logical input and the logical output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship. The test data corresponding to the variable names are used as the values of the variables to execute the logical input, the calculation process and the logical output, and the call of the test data in the test case execution process is completed. It also includes: obtaining a third target process update value obtained by the calculation process of a third test case, and the third target process update value is obtained by adding two strings; updating the process update value of the test data corresponding to the third variable name corresponding to the logical output of the third test case execution to the third target process update value.
[0009] Optionally, obtaining the variable names corresponding to the logical input and the logical output includes: establishing a test case template, the test case template including multiple test case names, input variable names of the logical inputs of the test cases, logical expressions of the calculation processes of the test cases, and output variable names of the logical outputs of the test cases; in the test case template, obtaining the variable names corresponding to the logical inputs and the logical outputs of each of the test cases.
[0010] Optionally, during the execution of the test case, the method also includes: obtaining a target process update value obtained by the calculation process of the test case, and updating the process update of the variable name of the logical output of the test case in the mapping relationship according to the target process update value; recording a data description and a data call status in the test data corresponding to the variable name of the logical input of the test case, wherein the data description is a data processing method of the calculation process, and the data call status is a description of the purpose of the data.
[0011] According to another aspect of the present application, a data management device for automated testing is provided, comprising: an establishing unit, for determining, during a test case design process, the variable names of the variables used for the logical input and logical output in the test case, and establishing a mapping relationship between each of the variable names and the test data, with one test data corresponding to one variable name; a calling unit, for obtaining, during an execution of the test case, the variable names corresponding to the logical input and the logical output, and determining, based on the mapping relationship, the test data corresponding to the variable names, and using the test data corresponding to the variable names as the values of the variables to execute the logical input, the calculation process and the logical output, thereby completing the calling of the test data in the test case execution process.
[0012] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0013] According to another aspect of the present application, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, any one of the methods described above is implemented.
[0014] By applying the technical solution of the present application, in the data management method for the above-mentioned automated testing, during the test case design process, the variable names of the variables used for the logical input and logical output in the test case are determined, and a mapping relationship between each variable name and the test data is established. During the test case execution process, the variable names corresponding to the logical input and logical output can be directly obtained from the test case, so that the test data corresponding to the variable names is determined according to the mapping relationship to execute the logical input, calculation process and logical output. There is no need to extract the variables of the test script, which avoids low test efficiency due to extraction failure, thereby solving the problem of low test efficiency of automated testing in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A hardware structure block diagram of a mobile terminal for performing a data management method for automated testing provided in an embodiment of the present application is shown;
[0016] Figure 2 A schematic diagram of a process flow of a data management method for automated testing provided in an embodiment of the present application is shown;
[0017] Figure 3 A schematic diagram showing a table corresponding to a mapping relationship provided according to an embodiment of the present application;
[0018] Figure 4 A schematic diagram showing the relationship between a test data management module and a test case module provided according to an embodiment of the present application is shown;
[0019] Figure 5 A schematic diagram of a test case module visualization provided according to an embodiment of the present application is shown;
[0020] Figure 6 A structural block diagram of a data management device for automated testing provided according to an embodiment of the present application is shown.
[0021] The above drawings include the following reference numerals:
[0022] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0023] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0024] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0027] Test case: In (embedded) software development, a set of specific conditions or variables designed to verify the correctness, integrity and quality of a specific function. Test cases usually include several key parts such as test purpose, prerequisites, test data, execution steps, and result evaluation.
[0028] Test data: A set of data designed and prepared for testing purposes, used as input or output data, and involved in the test case design and execution process.
[0029] As introduced in the background technology, the test efficiency of automated testing in the prior art is low. To solve this technical problem, the embodiments of the present application provide a data management method, device, computer-readable storage medium and computer program product for automated testing.
[0030] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0031] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile terminal of a data management method for automated testing according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0032] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data management method for automated testing in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific examples of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0033] In this embodiment, a data management method for automated testing running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] Figure 2 1 is a flow chart of a data management method for automated testing according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0035] Step S201, in the test case design process, determine the variable names of the variables used in the logic input and logic output of the test case, and establish a mapping relationship between each of the variable names and the test data, where one piece of the test data corresponds to one variable name;
[0036] Step S202, during the execution of the above test case, obtain the above variable names corresponding to the above logic input and the above logic output, and determine the above test data corresponding to the above variable names according to the above mapping relationship, and use the above test data corresponding to the above variable names as the values of the above variables to execute the above logic input, calculation process and the above logic output, so as to complete the call of the above test data in the execution process of the above test case.
[0037] In the above-mentioned data management method for automated testing, during the test case design process, the variable names of the variables used for logical input and logical output in the test case are determined, and a mapping relationship between each variable name and the test data is established. During the test case execution process, the variable names corresponding to the logical input and logical output can be directly obtained from the test case, thereby determining the test data corresponding to the variable names according to the mapping relationship to execute the logical input, calculation process and logical output. There is no need to extract the variables of the test script, which avoids low test efficiency due to extraction failure, thereby solving the problem of low test efficiency of automated testing in the prior art.
[0038] To facilitate data calling, in an optional implementation, the above step S201 includes:
[0039] Step S2011, establishing corresponding test data entries according to the names of the above variables, wherein the above test data entry is one of the above test data, and the above test data entry includes the above variable name, data type, initial setting value, process update value and variable description identifier;
[0040] Step S2012, summarizing all the above test data entries to obtain the above mapping relationship, and the above mapping relationship corresponds to the above test cases one by one.
[0041] In the above implementation, in the test case design process, the variable name can be specified as the data source of the logic input, output and calculation process according to the test case logic design needs, and the variable name and the test data entry in the test data management module are associated and mapped to obtain a table corresponding to the mapping relationship, such as Figure 3As shown. The test data entry includes the variable name, data type, initial setting value, process update value and variable description identifier. The variable name is the unique identifier of the test data entry in the current test case library (non-repeatable). The same variable name can appear in one or more test case logic designs, and the unique test data entry in the current test case library can be called according to the variable name. The initial setting value can be set and adjusted by the user.
[0042] Specifically, Figure 4 As shown, during the test case design process, the variable name is specified as the data source for the logical input, output and calculation process, so that a table corresponding to the mapping relationship between the variable name and the test data entry is established in the test data management module, that is, data management is established. During the execution of the above test cases, the data object can be read and written through the variable name, that is, the test data entry in the test data management module corresponding to the variable name of the test case template is called.
[0043] In order to implement automated testing, in an optional implementation, the above step S202 includes:
[0044] Step S20201, obtaining a first variable name corresponding to the first test case executing the above logic input;
[0045] Step S20202, determining the test data corresponding to the first variable name according to the mapping relationship, and obtaining a process update value of the first variable name;
[0046] Step S20203, using the process update value of the first variable name as the value of the logic input to perform the calculation process of the first test case to obtain a first target process update value;
[0047] Step S20204, the process update value of the test data corresponding to the first variable name remains unchanged, and the process update value of the test data corresponding to the second variable name corresponding to the logic output of the first test case is updated to the first target process update value.
[0048] In the above implementation, if Figure 5 As shown, multiple test cases are sequentially formed into multiple test case entries, and the test case entries are executed sequentially, such as Figure 3 As shown, when the use case entry 1 is executed, that is, the first test case, the initial value of the variable 'a' is extracted as 1 (int type) according to the variable association relationship (variable name mapping), and according to the use case logic (the calculation result of a+1 is saved in the variable b), the process of updating the variable b is updated to 2 (float type, the set type of b), thereby realizing automated testing.
[0049] In order to implement automated testing, in an optional implementation, the above step S202 further includes:
[0050] Step S20205, obtaining the second variable name corresponding to the second test case executing the above logic input;
[0051] Step S20206, determining the test data corresponding to the second variable name according to the mapping relationship, and obtaining a process update value of the second variable name;
[0052] Step S20207, performing the calculation process of the second test case with the process update value of the second variable name as the value of the logic input, to obtain a second target process update value;
[0053] Step S20208, updating the process update value of the test data corresponding to the second variable name corresponding to the logic output of the second test case to the second target process update value.
[0054] In the above implementation mode, if Figure 3 As shown, when the use case item 2, i.e., the second test case, is executed in sequence, according to the use case logic (incrementing variable b by 2), the process of updating variable b is updated to 4 (float type), thus realizing automated testing.
[0055] In order to implement automated testing, in an optional implementation, the above step S202 further includes:
[0056] Step S20209, obtaining a third target process update value obtained by the above calculation process of the third test case, wherein the above third target process update value is obtained by adding two character strings;
[0057] Step S20210: Update the process update value of the test data corresponding to the third variable name corresponding to the logic output of the third test case to the third target process update value.
[0058] In the above implementation mode, if Figure 3 As shown, when the use case item x, that is, the third test case, is executed in sequence, according to the use case logic (the strings 'testStr A' and 'testStr B' are concatenated and saved in the variable c), the process of updating the variable c updates the value, thereby realizing the automated test.
[0059] In addition, if Figure 3 As shown, since data entry y is not involved in the use case design and execution process, the process update value of variable d is always the initial value and is described as 'No use case call yet' in the data call column. The data call situations include: as a calculation input variable, as a calculation output variable, as a calculation process variable, and no call yet.
[0060] In order to improve the test efficiency, in an optional implementation manner, the above step S202 further includes:
[0061] Step S20211, establishing a test case template, the test case template including multiple test case names, input variable names of the above-mentioned logical inputs of the above-mentioned test cases, logical expressions of the above-mentioned calculation processes of the above-mentioned test cases, and output variable names of the above-mentioned logical outputs of the above-mentioned test cases;
[0062] Step S20212: In the test case template, obtain the variable names corresponding to the logic input and the logic output of each test case.
[0063] In the above implementation, if Figure 5 As shown, a test case template is established to summarize multiple test cases for subsequent sequential execution. Each test case includes a test case name, such as test case entry 1 and test case entry 2, an input variable name of the above-mentioned logical input of the above-mentioned test case, for example, input variable name a, a logical expression of the above-mentioned calculation process of the above-mentioned test case, for example, a+1, and an output variable name of the above-mentioned logical output of the above-mentioned test case, for example, input variable name b. During the execution of the above-mentioned test case, the variable name can be obtained from the test case template without extracting the variable name from the test script, thereby ensuring the efficiency and success rate of obtaining the variable name and improving the test efficiency.
[0064] In order to realize data visualization of automated testing, in an optional implementation manner, during the execution of the above test case, the above method further includes:
[0065] Step S301, obtaining a target process update value obtained by the calculation process of the test case, and updating the process update of the variable name of the logic output of the test case in the mapping relationship according to the target process update value;
[0066] Step S302, recording data description and data calling status in the test data corresponding to the variable name of the logic input of the test case, wherein the data description is the data processing method of the calculation process, and the data calling status is the description of the purpose of the data.
[0067] In the above implementation, if Figure 3 As shown, during the execution of the above test case items, the process update value, data description and data call status are all recorded in the test data management module, realizing data visualization of automated testing so as to facilitate troubleshooting when problems occur in the test.
[0068] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0069] The present application embodiment also provides a data management device for automated testing. It should be noted that the data management device for automated testing of the present application embodiment can be used to execute the data management method for automated testing provided by the present application embodiment. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and those that have been described are not repeated here. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0070] The following is an introduction to the data management device for automated testing provided in an embodiment of the present application.
[0071] Figure 6 1 is a structural block diagram of a data management device for automated testing according to an embodiment of the present application. Figure 6 As shown, the device comprises:
[0072] The establishing unit 10 is used to determine the variable names of the variables used for the logic input and the logic output in the test case during the test case design process, and establish a mapping relationship between each of the variable names and the test data, where one piece of the test data corresponds to one of the variable names;
[0073] The calling unit 20 is used to obtain the variable names corresponding to the above-mentioned logical input and the above-mentioned logical output during the execution of the above-mentioned test case, and determine the above-mentioned test data corresponding to the above-mentioned variable names according to the above-mentioned mapping relationship, and use the above-mentioned test data corresponding to the above-mentioned variable names as the values of the above-mentioned variables to execute the above-mentioned logical input, calculation process and the above-mentioned logical output, so as to complete the calling of the above-mentioned test data in the above-mentioned test case execution process.
[0074] In the data management device for automated testing described above, during the test case design process, the variable names of the variables used for logical input and logical output in the test case are determined, and a mapping relationship between each variable name and the test data is established. During the test case execution process, the variable names corresponding to the logical input and logical output can be directly obtained from the test case, thereby determining the test data corresponding to the variable names according to the mapping relationship to execute the logical input, calculation process and logical output. There is no need to extract the variables of the test script, thus avoiding low test efficiency caused by extraction failure, and solving the problem of low test efficiency of automated testing in the prior art.
[0075] In order to facilitate data calling, in an optional implementation manner, the establishment unit includes:
[0076] A first establishing module is used to establish a corresponding test data entry according to each of the above variable names, wherein the above test data entry is one of the above test data, and the above test data entry includes the above variable name, data type, initial setting value, process update value and variable description identifier;
[0077] The second establishing module is used to aggregate all the above test data items to obtain the above mapping relationship, and the above mapping relationship corresponds to the above test cases one by one.
[0078] In the above implementation, in the test case design process, the variable name can be specified as the data source of the logic input, output and calculation process according to the test case logic design needs, and the variable name and the test data entry in the test data management module are associated and mapped to obtain a table corresponding to the mapping relationship, such as Figure 3 As shown. The test data entry includes the variable name, data type, initial setting value, process update value and variable description identifier. The variable name is the unique identifier of the test data entry in the current test case library (non-repeatable). The same variable name can appear in one or more test case logic designs, and the unique test data entry in the current test case library can be called according to the variable name. The initial setting value can be set and adjusted by the user.
[0079] Specifically, Figure 4 As shown, during the test case design process, the variable name is specified as the data source for the logical input, output and calculation process, so that a table corresponding to the mapping relationship between the variable name and the test data entry is established in the test data management module, that is, data management is established. During the execution of the above test cases, the data object can be read and written through the variable name, that is, the test data entry in the test data management module corresponding to the variable name is called.
[0080] In order to realize automated testing, in an optional implementation, the calling unit includes:
[0081] A first acquisition module is used to obtain a first variable name corresponding to the first test case executing the above logic input;
[0082] A first determining module, configured to determine the test data corresponding to the first variable name according to the mapping relationship, and obtain a process update value of the first variable name;
[0083] A first calculation module, used for performing the calculation process of the first test case by taking the process update value of the first variable name as the value of the logic input to obtain a first target process update value;
[0084] The first update module is used to keep the process update value of the above test data corresponding to the above first variable name unchanged, and update the process update value of the above test data corresponding to the second variable name corresponding to the above logic output executed by the above first test case to the above first target process update value.
[0085] In the above implementation mode, if Figure 5 As shown, multiple test cases are sequentially formed into multiple test case entries, and the test case entries are executed sequentially, such as Figure 3 As shown, when the use case entry 1 is executed, that is, the first test case, the initial value of the variable 'a' is extracted as 1 (int type) according to the variable association relationship (variable name mapping), and according to the use case logic (the calculation result of a+1 is saved in the variable b), the process of updating the variable b is updated to 2 (float type, the set type of b), thereby realizing automated testing.
[0086] In order to realize automated testing, in an optional implementation manner, the calling unit further includes:
[0087] A second acquisition module is used to obtain the second variable name corresponding to the second test case executing the above logic input;
[0088] A second determination module is used to determine the test data corresponding to the second variable name according to the mapping relationship, and obtain a process update value of the second variable name;
[0089] A second calculation module is used to perform the calculation process of the second test case on the process update value of the second variable name as the value of the logic input to obtain a second target process update value;
[0090] The second updating module is used to update the process update value of the test data corresponding to the second variable name corresponding to the logic output executed by the second test case to the second target process update value.
[0091] In the above implementation mode, if Figure 3 As shown, when the use case item 2, i.e., the second test case, is executed in sequence, according to the use case logic (incrementing variable b by 2), the process of updating variable b is updated to 4 (float type), thus realizing automated testing.
[0092] In order to realize automated testing, in an optional implementation manner, the calling unit further includes:
[0093] A third acquisition module is used to obtain a third target process update value obtained by the above calculation process of the third test case, where the above third target process update value is obtained by adding two character strings;
[0094] The third updating module is used to update the process update value of the above test data corresponding to the third variable name corresponding to the above logic output executed by the above third test case to the above third target process update value.
[0095] In the above implementation, if Figure 3 As shown, when the use case item x, that is, the third test case, is executed in sequence, according to the use case logic (the strings 'testStr A' and 'testStr B' are concatenated and saved in the variable c), the process of updating the variable c updates the value, thereby realizing the automated test.
[0096] In addition, if Figure 3 As shown, since data entry y is not involved in the use case design and execution process, the process update value of variable d is always the initial value and is described as 'No use case call yet' in the data call column. The data call situations include: as a calculation input variable, as a calculation output variable, as a calculation process variable, and no call yet.
[0097] In order to improve the test efficiency, in an optional implementation manner, the calling unit further includes:
[0098] A third establishment module is used to establish a test case template, wherein the test case template includes multiple test case names, input variable names of the above-mentioned logical inputs of the above-mentioned test cases, logical expressions of the above-mentioned calculation processes of the above-mentioned test cases, and output variable names of the above-mentioned logical outputs of the above-mentioned test cases;
[0099] The fourth acquisition module is used to obtain the variable names corresponding to the logic input and the logic output of each of the test cases in the test case template.
[0100] In the above implementation, if Figure 5 As shown, a test case template is established to summarize multiple test cases for subsequent sequential execution. Each test case includes a test case name, such as test case entry 1 and test case entry 2, an input variable name of the above-mentioned logical input of the above-mentioned test case, for example, input variable name a, a logical expression of the above-mentioned calculation process of the above-mentioned test case, for example, a+1, and an output variable name of the above-mentioned logical output of the above-mentioned test case, for example, input variable name b. During the execution of the above-mentioned test case, the variable name can be obtained from the test case template without extracting the variable name from the test script, thereby ensuring the efficiency and success rate of obtaining the variable name and improving the test efficiency.
[0101] In order to realize data visualization of automated testing, in an optional implementation manner, the above-mentioned device further includes:
[0102] An acquisition unit, used for acquiring a target process update value obtained by the calculation process of the test case during the execution of the test case, and updating the process update of the variable name of the logic output of the test case in the mapping relationship according to the target process update value;
[0103] The recording unit is used to record data description and data call status in the above test data corresponding to the variable name of the above logical input of the above test case, the above data description is the data processing method of the above calculation process, and the above data call status is the description of the use of the data.
[0104] In the above implementation mode, if Figure 3 As shown, during the execution of the above test case items, the process update value, data description and data call status are all recorded in the test data management module, realizing data visualization of automated testing so as to facilitate troubleshooting when problems occur in the test.
[0105] The data management device for automated testing includes a processor and a memory. The establishment unit and the calling unit are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.
[0106] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the problem of low test efficiency of automated testing in the prior art can be solved by adjusting kernel parameters.
[0107] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0108] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the data management method for automated testing.
[0109] Specifically, the data management method for automated testing includes:
[0110] Step S201, in the test case design process, determine the variable names of the variables used in the logic input and logic output of the test case, and establish a mapping relationship between each of the variable names and the test data, where one piece of the test data corresponds to one variable name;
[0111] Step S202, during the execution of the above test case, obtain the above variable names corresponding to the above logic input and the above logic output, and determine the above test data corresponding to the above variable names according to the above mapping relationship, and use the above test data corresponding to the above variable names as the values of the above variables to execute the above logic input, calculation process and the above logic output, so as to complete the call of the above test data in the execution process of the above test case.
[0112] An embodiment of the present invention provides a processor, and the processor is used to run a program, wherein the data management method for automated testing is executed when the program is running.
[0113] Specifically, the data management method for automated testing includes:
[0114] Step S201, in the test case design process, determine the variable names of the variables used in the logic input and logic output of the test case, and establish a mapping relationship between each of the variable names and the test data, where one piece of the test data corresponds to one variable name;
[0115] Step S202, during the execution of the above test case, obtain the above variable names corresponding to the above logic input and the above logic output, and determine the above test data corresponding to the above variable names according to the above mapping relationship, and use the above test data corresponding to the above variable names as the values of the above variables to execute the above logic input, calculation process and the above logic output, so as to complete the call of the above test data in the execution process of the above test case.
[0116] An embodiment of the present invention provides a device, the device including a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, at least the following steps are implemented:
[0117] Step S201, in the test case design process, determine the variable names of the variables used in the logic input and logic output of the test case, and establish a mapping relationship between each of the variable names and the test data, where one piece of the test data corresponds to one variable name;
[0118] Step S202, during the execution of the above test case, obtain the above variable names corresponding to the above logic input and the above logic output, and determine the above test data corresponding to the above variable names according to the above mapping relationship, and use the above test data corresponding to the above variable names as the values of the above variables to execute the above logic input, calculation process and the above logic output, so as to complete the call of the above test data in the execution process of the above test case.
[0119] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:
[0120] Step S201, in the test case design process, determine the variable names of the variables used in the logic input and logic output of the test case, and establish a mapping relationship between each of the variable names and the test data, where one piece of the test data corresponds to one variable name;
[0121] Step S202, during the execution of the above test case, obtain the above variable names corresponding to the above logic input and the above logic output, and determine the above test data corresponding to the above variable names according to the above mapping relationship, and use the above test data corresponding to the above variable names as the values of the above variables to execute the above logic input, calculation process and the above logic output, so as to complete the call of the above test data in the execution process of the above test case.
[0122] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0124] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0127] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0128] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0129] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0130] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0131] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0132] 1) In the data management method for automated testing of the present application, during the test case design process, the variable names of the variables used for logical input and logical output in the test case are determined, and a mapping relationship between each variable name and the test data is established. During the test case execution process, the variable names corresponding to the logical input and logical output can be directly obtained from the test case, thereby determining the test data corresponding to the variable names according to the mapping relationship to execute the logical input, calculation process and logical output. There is no need to extract the variables of the test script, thus avoiding low test efficiency due to extraction failure, and solving the problem of low test efficiency of automated testing in the prior art.
[0133] 2) In the data management device for automated testing of the present application, during the test case design process, the variable names of the variables used for the logical input and logical output in the test case are determined, and a mapping relationship between each variable name and the test data is established. During the test case execution process, the variable names corresponding to the logical input and logical output can be directly obtained from the test case, thereby determining the test data corresponding to the variable names according to the mapping relationship to execute the logical input, calculation process and logical output. There is no need to extract the variables of the test script, thus avoiding low test efficiency caused by extraction failure, and solving the problem of low test efficiency of automated testing in the prior art.
[0134] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data management method for automated testing, characterized in that: include: In the test case design process, the variable names of the variables used for the logical input and the logical output in the test case are determined, and a mapping relationship between each of the variable names and the test data is established, where one piece of the test data corresponds to one variable name; During the execution of the test case, the variable names corresponding to the logical input and the logical output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship. The test data corresponding to the variable names are used as the values of the variables to execute the logical input, calculation process and the logical output, thereby completing the call of the test data in the test case execution process.
2. The method according to claim 1, characterized in that Establishing a mapping relationship between each variable name and test data includes: Establishing a corresponding test data entry according to each variable name, wherein the test data entry is a piece of test data, and the test data entry includes the variable name, data type, initial setting value, process update value and variable description identifier; All the test data entries are aggregated to obtain the mapping relationship, and the mapping relationship corresponds to the test case one by one.
3. The method according to claim 1, characterized in that During the test case execution process, the variable names corresponding to the logic input and the logic output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship, and the logic input, calculation process and logic output are executed using the test data corresponding to the variable names as the values of the variables, so as to complete the calling of the test data in the test case execution process, including: Obtain a first variable name corresponding to the logic input executed by the first test case; Determine the test data corresponding to the first variable name according to the mapping relationship, and obtain a process update value of the first variable name; Using the process update value of the first variable name as the value of the logic input to perform the calculation process of the first test case, to obtain a first target process update value; The process update value of the test data corresponding to the first variable name remains unchanged, and the process update value of the test data corresponding to the second variable name corresponding to the logical output of the first test case is updated to the first target process update value.
4. The method according to claim 3, characterized in that In the test case execution process, the variable names corresponding to the logic input and the logic output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship, and the test data corresponding to the variable names are used as the values of the variables to execute the logic input, the calculation process and the logic output, and complete the call of the test data in the test case execution process, and further includes: Obtain the second variable name corresponding to the logic input executed by the second test case; Determine the test data corresponding to the second variable name according to the mapping relationship, and obtain a process update value of the second variable name; Perform the calculation process of the second test case on the process update value of the second variable name as the value of the logic input to obtain a second target process update value; The process update value of the test data corresponding to the second variable name corresponding to the logic output of the second test case execution is updated to the second target process update value.
5. The method according to claim 1, characterized in that In the test case execution process, the variable names corresponding to the logic input and the logic output are obtained, and the test data corresponding to the variable names are determined according to the mapping relationship, and the test data corresponding to the variable names are used as the values of the variables to execute the logic input, the calculation process and the logic output, and complete the call of the test data in the test case execution process, and further includes: Obtaining a third target process update value obtained by the calculation process of the third test case, wherein the third target process update value is obtained by adding two character strings; The process update value of the test data corresponding to the third variable name corresponding to the logic output of the third test case is updated to the third target process update value.
6. The method according to any one of claims 1 to 5, characterized in that Obtaining the variable names corresponding to the logic input and the logic output includes: Establishing a test case template, the test case template including a plurality of test case names, input variable names of the logic inputs of the test cases, logical expressions of the calculation processes of the test cases, and output variable names of the logic outputs of the test cases; In the test case template, obtain the variable name corresponding to the logic input and the logic output corresponding to each test case.
7. The method according to any one of claims 1 to 5, characterized in that During the test case execution process, the method further includes: Obtaining a target process update value obtained by the calculation process of the test case, and updating a process update of a variable name of the logic output of the test case in the mapping relationship according to the target process update value; The data description and data calling situation are recorded in the test data corresponding to the variable name of the logic input of the test case, wherein the data description is the data processing method of the calculation process, and the data calling situation is the description of the purpose of the data.
8. A data management device for automated testing, characterized in that: include: An establishing unit, used for determining the variable names of the variables used for the logical input and the logical output in the test case during the test case design process, and establishing a mapping relationship between each of the variable names and the test data, wherein one piece of the test data corresponds to one variable name; A calling unit is used to obtain the variable names corresponding to the logical input and the logical output during the execution of the test case, and determine the test data corresponding to the variable names according to the mapping relationship, and use the test data corresponding to the variable names as the values of the variables to execute the logical input, calculation process and the logical output, thereby completing the calling of the test data in the test case execution process.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.