Software test data design method and device, electronic equipment and storage medium

By configuring call tags and dynamic data functions in UI automation testing, the readability and maintainability of test data are solved, dynamic replacement and categorized storage of test data are realized, testing time and operational difficulty are reduced, and testing efficiency is improved.

CN115454865BActive Publication Date: 2026-02-06CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211150162.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-21
Publication Date
2026-02-06
Estimated Expiration
2042-09-21

AI Technical Summary

Technical Problem

In UI automated testing, the low readability and maintainability of test data lead to high time costs and operational difficulties. Static data requires frequent modification and maintenance of test case data, while dynamic data is difficult to replace dynamically.

Method used

By configuring call tags in the test data, dynamic data is generated using dynamic data functions. Based on the attribute judgment results of the composition structure, the original data is dynamically replaced or retained, thereby realizing the classification, storage, splitting and maintenance of test data.

Benefits of technology

It reduces the time cost and operational difficulty of UI automation testing, and improves the compatibility and maintenance efficiency of test programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115454865B_ABST
    Figure CN115454865B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a software test data design method and device, electronic equipment and storage medium, and belong to the technical field of software testing. The method comprises: establishing a test file, inputting test data required to be set for a test case into the test file; configuring a calling label for specific test data; reading the test data required to be set for the test case to obtain a case object; performing attribute judgment on a component structure of the case object to obtain a judgment result; determining a processing result of the case object according to the judgment result and the calling label, and outputting the processing result. Embodiments of the present application can reduce maintenance test time, improve compatibility of a test program, and reduce operation difficulty of a tester by sequentially inputting, marking, reading, judging and processing integration of test data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software testing, and particularly relates to a software test data design method and device, an electronic device and a storage medium. BACKGROUND

[0002] At present, when a user interface is tested, common UI automatic testing needs to test and maintain multiple pages and components. Since the fields of test data required for maintaining each component are not fixed, the readability and maintainability of the test data are low, and a long time is required. In addition, for data that needs to be frequently maintained, using static data will cause frequent modification of test case data, and using dynamic data will make it difficult to realize dynamic replacement of data because the properties of each component are different.

[0003] Therefore, how to reduce the time cost and operation difficulty of UI automatic testing has become a technical problem to be solved. SUMMARY

[0004] The present application aims to provide a software test data design method and device, an electronic device and a storage medium, which aims to reduce the time cost and operation difficulty of UI automatic testing.

[0005] To achieve the above object, a first aspect of the embodiments of the present application provides a software test data design method, which comprises the following steps.

[0006] A test file is established, and test data required for setting a test case is input into the test file;

[0007] A calling tag is configured for specific test data;

[0008] Test data required for setting a test case is read to obtain a test case object;

[0009] Attribute judgment is performed on the component structure of the test case object to obtain a judgment result;

[0010] A processing result of the test case object is determined according to the judgment result and the calling tag, and the processing result is output.

[0011] In some embodiments, the step of establishing a test file and inputting test data required for setting a test case into the test file comprises the following steps.

[0012] The test data is classified to obtain a classification result;

[0013] The test data is separately stored in the test file according to the classification result;

[0014] allocating an index label to the test data; wherein the index label is used to represent the test data required for the test case to be set.

[0015] In some embodiments, the configuring the calling label for the specific test data comprises:

[0016] inserting the calling label into the test data or replacing the test data by the calling label according to the data type of the test data;

[0017] the calling label is associated with a function that can generate dynamic data.

[0018] In some embodiments, the attribute judging of the component structure of the test case object comprises:

[0019] identifying the attribute of the component structure; wherein the attribute of the component structure comprises an object, an object array and object data;

[0020] when the attribute of the component structure is object data, performing a first judging step;

[0021] when the attribute of the component structure is an object, performing a second judging step;

[0022] when the attribute of the component structure is an object array, performing a third judging step;

[0023] wherein the first judging step comprises:

[0024] judging whether the object data is allocated with the calling label;

[0025] if yes, the judging result is to replace the object data with dynamic data;

[0026] if no, the judging result is not to replace the object data with dynamic data;

[0027] wherein the second judging step comprises:

[0028] judging whether each object element of the object is allocated with the calling label;

[0029] if yes, the judging result is to replace the object element with dynamic data;

[0030] if no, the judging result is not to replace the object element with dynamic data;

[0031] wherein the third judging step comprises:

[0032] judging whether each array element of the object array is allocated with the calling label;

[0033] If yes, the judgment result is to replace the array element with dynamic data;

[0034] If no, the judgment result is not to replace the array element with dynamic data.

[0035] In some embodiments, the identifying the attribute of the constituent structure comprises:

[0036] inputting the constituent structure into a judgment function to judge the attribute of the constituent structure;

[0037] in a case where the attribute of the constituent structure is object data, inputting the constituent structure into a first processing function to perform the first judgment step;

[0038] in a case where the attribute of the constituent structure is an object, inputting the constituent structure into a second processing function to perform the second judgment step;

[0039] in a case where the attribute of the constituent structure is an object array, inputting the object array into a third processing function and the second processing function to perform the third judgment step; wherein the third processing function inputs the array element judged as an object into the second processing function.

[0040] In some embodiments, the identifying the attribute of the constituent structure comprises:

[0041] randomly inputting the constituent structure into a first processing function, a second processing function or a third processing function to judge the attribute of the constituent structure;

[0042] in a case where the attribute of the constituent structure is object data, inputting the constituent structure into a first processing function to perform the first judgment step;

[0043] in a case where the attribute of the constituent structure is an object, inputting the constituent structure into a second processing function to perform the second judgment step;

[0044] in a case where the attribute of the constituent structure is an object array, inputting the object array into a third processing function to perform the third judgment step.

[0045] In some embodiments, the determining the processing result of the use case object according to the judgment result and the call label and outputting the processing result comprises:

[0046] judging whether the judgment result is to replace the original constituent structure with dynamic data;

[0047] If yes, generating dynamic data according to the call label to replace the original constituent structure and outputting the replaced dynamic data;

[0048] If no, directly output the original composition structure;

[0049] The composition structure replaced by the dynamic data and the original composition structure are combined to obtain a new use case object, and the new use case object is output.

[0050] To achieve the above object, a second aspect of the embodiment of the application provides a software test data design device, which comprises:

[0051] An input module is configured to establish a test file and input test data required by a test case into the test file;

[0052] A label insertion module is configured to configure a calling label for specific test data;

[0053] A reading module is configured to read test data required by the test case to obtain a use case object;

[0054] A judgment module is configured to perform attribute judgment on a composition structure of the use case object to obtain a judgment result;

[0055] A processing module is configured to determine a processing result of the use case object according to the judgment result and the calling label and output the processing result.

[0056] To achieve the above object, a third aspect of the embodiment of the application provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the software test data design method in any one of claims 1 to 7 when executing the computer program.

[0057] To achieve the above object, a fourth aspect of the embodiment of the application provides a computer readable storage medium, which stores a computer program, and the computer program implements the software test data design method in any one of claims 1 to 7 when executed by a processor.

[0058] The software test data design method, device, electronic device and storage medium provided by the application separate test data and test programs before automatic testing, mark specific test data by setting a calling label, distinguish test data requiring specific processing from other test data, reduce the number of times of maintaining the test data requiring specific processing, reduce test time, perform data processing on the use case object after converting the test data into the use case object, determine the processing result of the use case object according to the type of the use case object and the calling label, split and classify each use case object in a complex project to be maintained and maintain each use case object respectively, improve the compatibility of the test program, and reduce the operation difficulty of testers. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 is a flow chart of a software test data design method provided by an embodiment of the present application;

[0060] Figure 2 is a flow chart of step S101 in Figure 1

[0061] Figure 3 is a flow chart of step S104 in Figure 1

[0062] Figure 4 is a flow chart of step S105 in Figure 1

[0063] Figure 5 is a structural schematic diagram of a software test data design device provided by an embodiment of the present application;

[0064] Figure 6 is a hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0065] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not intended to limit the present application.

[0066] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical order is shown in the flow chart, in some cases, the steps shown or described can be executed in a manner different from the module division in the device or the order in the flow chart. The terms "first", "second", etc. in the specification, claims and above-described drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.

[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0068] First, the terms involved in the present application are analyzed:

[0069] ​​​UI (user interface): user interface, refers to the overall design of the man-machine interaction, operation logic, interface aesthetics of software. User interface is the medium for interaction and information exchange between system and user, which realizes the conversion between internal form and human acceptable form. User interface is the software related to the interaction between user and hardware, the purpose is to make the user operate the hardware conveniently and efficiently to achieve two-way interaction, complete the work expected to be completed by hardware, user interface definition is wide, including human-computer interaction and graphical user interface, the field of information exchange between human and machine exists user interface.

[0070] Automation testing: automation testing refers to the automation of software testing. Software testing is to run the system or application under preset conditions, evaluate the running results, and the preconditions should include normal conditions and abnormal conditions. Automation testing is a process of converting human-driven testing behavior into machine execution. After designing test cases and passing the review, the test personnel executes the test according to the procedures described in the test cases, and compares the actual results with the expected results. The automation testing of UI (i.e. UI automation testing) is to simulate manual operation of user UI interface, to realize automatic operation and verification by code. Through the automation testing of web application or app application, the manual operation of web or app page is simulated.

[0071] Test case: refers to the description of the test task of a specific software product, which embodies the test scheme, method, technology and strategy. Its content includes test target, test environment, input data, test step, expected result, test script, etc., and finally forms a document. Simply speaking, test case is a set of test input, execution conditions and expected results prepared for a specific goal, which is used to verify whether it meets a specific software requirement. Test case mainly includes four contents: case title, precondition, test step and expected result. Case title mainly describes the test of a certain function; precondition refers to the condition that the case title needs to meet; test step mainly describes the operation steps of the case; expected result refers to the expected (development specification, requirement document, user requirement, etc.) requirement.

[0072] In the prior art, UI automation testing is used to test and maintain software, and at least the following problems will occur when processing test data:

[0073] (1) The software is configured with multiple pages, and each page can set multiple components. Since the fields of test data required for maintaining each component are not fixed, the readability and maintainability of test data are low, and a long time is required;

[0074] (2) for the data that need to be maintained frequently (for example, the setting of time), using static data will cause frequent modification of the maintenance case data, reducing the test efficiency, using dynamic data can replace the data originally expressed by variables with dynamically generated new data, due to the complexity of the project to be maintained, using dynamic data will be difficult to achieve dynamic replacement of data because the properties of each component are different.

[0075] Therefore, an embodiment of the present application provides a software test data design method and device, an electronic device and a storage medium, which aims to reduce the time cost and operation difficulty in UI automation testing.

[0076] The software test data design method, device, electronic device and storage medium provided by the embodiments of the present application are specifically described by the following embodiments. First, the software test data design method in the embodiments of the present application is described.

[0077] The software test data design method provided by the embodiments of the present application relates to the technical field of software testing. The software test data design method provided by the embodiments of the present application can be applied to a terminal, can be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, etc. The server side can be configured as a stand-alone physical server, can be configured as a server cluster or a distributed system composed of multiple physical servers, can also be configured as a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and big data and artificial intelligence platforms, etc. The software can be an application that implements the software test data design method, etc., but is not limited to the above forms.

[0078] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, small computers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected by a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.

[0079] It should be noted that in various specific embodiments of the present application, when relevant processing needs to be performed on data related to the identity or characteristics of a user, such as user information, user behavior data, user history data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiments of the present application need to obtain sensitive personal information of a user, the user's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page, and after obtaining the user's separate permission or separate consent, the necessary user-related data for enabling the embodiments of the present application to function normally will be obtained.

[0080] Figure 1 is an optional flowchart of a software test data design method provided by the embodiments of the present application, Figure 1 The method in the above step S101-S105 can include but is not limited to the steps S101-S105.

[0081] Step S101, establishing a test file, inputting test data required to be set for a test case into the test file;

[0082] Step S102, configuring a call tag for specific test data;

[0083] Step S103, reading test data required to be set for the test case to obtain a case object;

[0084] Step S104, performing attribute judgment on the composition structure of the case object to obtain a judgment result;

[0085] Step S105, determining a processing result of the case object according to the judgment result and the call tag, and outputting the processing result.

[0086] The steps S101-S105 shown in the embodiments of the present application separate test data and test procedures before automatic testing, mark specific test data by setting a call tag, distinguish test data that needs specific processing from other test data, reduce the number of times of maintaining the test data that needs specific processing, reduce testing time, perform data processing on the case object after converting the test data into the case object, determine the processing result of the case object according to the type of the case object and the call tag, split and classify each case object in a complex project to be maintained and perform separate maintenance processing, improve the compatibility of the test procedure, and reduce the operation difficulty of testers.

[0087] In step S101 of some embodiments, the file format of the established test file can be CSV, XML, Excel or TXT, and the test data required by the test case is input into the test file according to the file format of the test file. When the automated test is executed, the test program reads the test data input into the test file, realizes the parameterized test program function, and supports the test data driven automated test.

[0088] For example, when the automated test is executed, the test data required by the test case can be written in Excel format for easy maintenance. In addition, the test or record method used when the automated test is executed can include a screenshot method, a data automatic comparison method, a date conversion method, a log writing method, etc.

[0089] In step S102 of some embodiments, a call tag is configured for specific test data. Specifically, when the test data is input, specific test data is selected according to a pre-set dynamic processing process, and a call tag is added to the test data as a call mark for the test data. When the automated test is executed, the test program reads the test data and reads the call tag at the same time, identifies the type of the call tag, and executes the pre-set dynamic processing process associated with the call tag, and then processes the test data according to the pre-set dynamic processing process.

[0090] It should be noted that the pre-set dynamic processing process can be executed by a related function pre-set in the test program, and the type of the call tag is different according to the pre-set dynamic processing process. When the test data is input, the corresponding call tag is configured according to the known dynamic processing process required for the specific test data, so as to adapt to the situation that the number of pages and components of the project to be maintained is large, resulting in a large number of test data to be maintained.

[0091] In some embodiments, the call tag is inserted into the test data or the test data is replaced by the call tag according to the data type of the test data. The call tag is associated with a function that can generate dynamic data.

[0092] Inserting the call tag in the test data is directly adding the call tag in the test data, and the data content of the original test data is not affected after adding the call tag. The call tag can be set at the head or tail of the test data. The call tag and the test data are distinguished by a separator. During automatic test execution, the test program distinguishes the call tag and the test data by recognizing the separator. The test program generates dynamic data in combination with the function associated with the call tag and the original test data, and replaces the original test data with the generated dynamic data. Replacing the test data with the call tag is directly using the call tag to replace the original test data. During automatic test execution, the test program directly recognizes the call tag. The test program replaces the original test data with the dynamic data generated according to the function associated with the call tag.

[0093] For example, the call tag used can be in the form of "__function name (parameter)" to represent the function associated with the generated dynamic data. More specifically, the test data related to time setting can use "__autoTime (today)" to represent the function associated with the generated dynamic time, which is used to fill the current time into the test file as test data, realizing dynamic replacement of time test data.

[0094] In step S103 of some embodiments, the test data required by the test case is read to obtain a test case object. Specifically, the test data required by the test case is read by a test program to obtain a plurality of test case objects. One test case object is used to implement one business process. The test case object describes the application-specific rules that specify the interaction between the user and the system.

[0095] It should be noted that the test case object encapsulates and implements the use case of the system, which specifies the input parameters, return types and processing rules for achieving the use case target. The test case object implements a business process and discloses the function of executing a single process. These rules are application-specific and only meaningful within the application scope. The test case object specifies operations above the domain "model", which encapsulates the so-called key business data and rules.

[0096] Taking the management background of the small program front-end page visually built based on a certain mall project as an example, a business personnel can freely arrange page controls to configure an activity page he wants and publish it. A test case object obtained by reading the test data required by the test case includes at least a test case name, an activity configuration and a page configuration. The activity configuration includes a plurality of configuration item parameters, and the page configuration includes a plurality of pages. Each page includes a page name and a plurality of page configuration item parameters. Each test case object includes different test case names, activity configurations and page configurations, which are used to implement different business processes.

[0097] In step S104 of some embodiments, attribute judgment is performed on the component structure of the use case object to obtain a judgment result. Specifically, each component structure of the use case object is read and identified, and attribute judgment is performed according to the content of the identified component structure.

[0098] For example, the attribute of the component structure of the use case object can be a use case name, an activity configuration, and a page configuration, which respectively contain different content information. When the automated test is executed, the test program performs attribute judgment based on the content information contained in the use case name, the activity configuration, and the page configuration, and the obtained judgment result shows that the component structure is the use case name, the activity configuration, or the page configuration.

[0099] In some embodiments, attribute judgment is performed on the component structure of the use case object to obtain a judgment result, which can also be determined by the location of the component structure in the test file. Specifically, when the test data is input, the test data of the same attribute is input into the same region according to the attribute of the test data, for example, the test data about the use case name is input into the same column of the Excel table. When the test data is read to obtain the use case object, the test program identifies that the column of the component structure of the current use case object is the column of the use case name, and determines that the attribute of the currently identified component structure is the use case name.

[0100] In step S105 of some embodiments, the processing result of the use case object is determined according to the judgment result and the call tag, and the processing result is output. Specifically, the attribute of the component structure of the use case object can be obtained through the judgment result, and whether the data constituting the component structure is configured with a call tag can be determined to determine whether the data of the component structure needs to be processed through the pre-set dynamic processing process. The processing process of each component structure of the use case object is determined by combining the judgment result and the call tag as two reference quantities. After the component structures of the use case object are processed according to the judgment result and the call tag, the processed component structures are used to reconstitute a new use case object, and the processing result is obtained and output.

[0101] Taking the time configuration item configured in the activity as an example, after the test program reads the test data to obtain the use case object, the attribute judgment is performed on the attributes of each component structure of the use case object. When it is determined through the attribute judgment that the current component structure is the activity configuration, the function or the subprogram used for processing the activity configuration is selected to process the activity configuration, and each data in the activity configuration is traversed. It is identified that the time configuration item in the activity configuration is configured with a call label, and the time configuration item is updated according to the call label. The other component structures of the use case object are processed in the above manner to obtain the processed component structures, and the new use case object is re-composed using the processed component structures to obtain the processing result and output the processing result.

[0102] Referring to Figure 2 In some embodiments, step S101 can include, but is not limited to, steps S201 to S203.

[0103] Step S201, classifying the test data to obtain a classification result;

[0104] Step S202, storing the test data separately in the test file according to the classification result;

[0105] Step S203, assigning an index label to the test data.

[0106] In step S201 of some embodiments, the test data is classified to obtain a classification result, which can be classified according to use cases, activity configurations, page configurations, and component configurations. The related test data of the use cases, the activity configurations, the page configurations, and the component configurations is further classified. For example, the related test data of the page configurations can be further classified as page names, page addresses, page title colors, and page background colors. The related test data of the component configurations can be further classified as component names, jump types, applets, jump addresses, button colors, button texts, button font sizes, and button font colors.

[0107] In step S202 of some embodiments, the test data is stored separately in the test file according to the classification result. Specifically, the test data is input to different location areas of the test file according to the classification result, so that the test data of the same category is gathered in the same location area. Taking the test file in the Excel format as an example, after the test data is classified as use cases, activity configurations, page configurations, and component configurations, the related test data of the use cases, the activity configurations, the page configurations, and the component configurations is maintained in different sheets. In the same sheet, the related test data of the use cases, the activity configurations, the page configurations, and the component configurations is further classified. The further classified test data is input to different columns in the sheet to reduce the difficulty of maintaining the test data.

[0108] In step S203 of some embodiments, the index label is used to represent the test data required by the test case, the test data is assigned an index label, and the index label is used to represent the test data required by the test case. Specifically, when inputting test data, several index labels are added to the test data as an index mark between the test data and other test data, indicating that the test data has a correlation with other test data. In a specific area of the test file, the index label corresponds to a series of test data, and the same configuration can be reused multiple times. For example, in an Excel format test file, the use case, activity configuration, page configuration, and component configuration are maintained in different sheet pages. In the use case sheet page, the index labels of the activity configuration, the index labels of the page configuration, and the index labels of the component configuration are set. In the corresponding sheet page, there is a row of test data corresponding to the index label, and the same configuration can be reused multiple times.

[0109] Please refer to Figure 3 In some embodiments, step S104 can include but is not limited to steps S301-S304.

[0110] Step S301, identifying the attribute of the component structure;

[0111] Step S302, when the attribute of the component structure is object data, performing a first judgment step;

[0112] Step S303, when the attribute of the component structure is an object, performing a second judgment step;

[0113] Step S304, when the attribute of the component structure is an object array, performing a third judgment step.

[0114] In step S301 of some embodiments, the attribute of the component structure is identified, specifically the constituent elements of the component structure. The attribute of the component structure includes objects, object arrays, and object data. An object is composed of several object elements, an array element is composed of several array elements, and the attributes of the object elements and the array elements are object data.

[0115] In step S302 of some embodiments, the first judgment step includes:

[0116] determining whether the object data is assigned the call label;

[0117] If yes, the judgment result is to replace the object data with dynamic data;

[0118] If no, the judgment result is not to replace the object data with dynamic data.

[0119] The object data is the most basic component structure in the use case object, and directly represents a parameter or a setting. The first judging step judges whether the object data is assigned with the calling label. All object data is traversed to identify the object data assigned with the calling label. For the object data assigned with the calling label, it is judged that the dynamic data needs to replace the object data, i.e. the related function is called to update the original object data. Otherwise, it is judged that the dynamic data does not need to replace the object data.

[0120] In step S303 of some embodiments, the second judging step includes:

[0121] judging whether each object element of the object is assigned with the calling label;

[0122] if yes, the judging result is that the dynamic data replaces the object element;

[0123] if no, the judging result is that the dynamic data does not replace the object element.

[0124] The object is composed of a plurality of object elements, and the attribute of the object element is object data, i.e. the object contains a plurality of parameters or a plurality of settings. The second judging step judges whether each object element of the object is assigned with the calling label. All object elements are traversed to identify the object element assigned with the calling label. For the object element assigned with the calling label, it is judged that the dynamic data needs to replace the object element, i.e. the related function is called to update the original object element. Otherwise, it is judged that the dynamic data does not need to replace the object element.

[0125] In step S304 of some embodiments, the third judging step includes:

[0126] judging whether each array element of the object array is assigned with the calling label;

[0127] if yes, the judging result is that the dynamic data replaces the array element;

[0128] if no, the judging result is that the dynamic data does not replace the array element.

[0129] The object array is composed of a plurality of array elements, and the attribute of the array element is object data, i.e. the object array also contains a plurality of parameters or a plurality of settings. The third judging step judges whether each array element of the object array is assigned with the calling label. All array elements are traversed to identify the array element assigned with the calling label. For the array element assigned with the calling label, it is judged that the dynamic data needs to replace the array element, i.e. the related function is called to update the original array element. Otherwise, it is judged that the dynamic data does not need to replace the array element.

[0130] In steps S301 to S304, the recursive idea is used to judge the individual component structures of the use case object, and all the object data, object elements and array elements assigned with the call tag are filtered out as the data that needs to be replaced by the dynamic data, while the object data, object elements and array elements without the call tag are the data that does not need to be replaced by the dynamic data.

[0131] In some embodiments, the identifying the attribute of the component structure comprises:

[0132] inputting the component structure into a judging function to judge the attribute of the component structure;

[0133] in the case that the attribute of the component structure is object data, inputting the component structure into a first processing function to execute the first judging step;

[0134] in the case that the attribute of the component structure is object, inputting the component structure into a second processing function to execute the second judging step;

[0135] in the case that the attribute of the component structure is object array, inputting the object array into a third processing function and the second processing function to execute the third judging step; wherein the third processing function inputs the array element judged as object into the second processing function.

[0136] The attribute of the component structure is identified, specifically, the first judging step is executed by the first processing function, the second judging step is executed by the second processing function, and the third judging step is executed by the third processing function and the second processing function together. First, all the component structures of the use case object are traversed by a judging function to judge the attribute of the component structure. The attribute of the component structure judged by the judging function includes object data, object and object array. When the attribute of the component structure is judged as object data, the component structure output by the judging function is input into the first processing function to execute the first judging step. When the attribute of the component structure is judged as object, the component structure output by the judging function is input into the second processing function to execute the second judging step. When the attribute of the component structure is judged as object array, the component structure output by the judging function is input into the third processing function and the second processing function in sequence. The third processing function inputs the component element judged as object into the second processing function, and the second processing function judges the component element judged as object in a manner similar to the second judging step to complete the third judging step.

[0137] In some embodiments, the function of the judging function can also be combined into the first processing function, the second processing function or the third processing function to reduce the number of functions used. Specifically, the function of the judging function can be combined into the second processing function, and the second processing function traverses all constituent structures of the use case object to judge the attributes of the constituent structures. When the attribute of the constituent structure is object data, the constituent structure output by the second processing function is input to the first processing function to perform the first judging step. When the attribute of the constituent structure is object, the second processing function performs the second judging step. When the attribute of the constituent structure is object array, the constituent structure output by the second processing function is input to the third processing function and the second processing function in sequence, and the third processing function and the second processing function jointly perform the third judging step.

[0138] For example, the first processing function, the second processing function and the third processing function are respectively dataPretreate function (data preprocessing function), objPretreate function (page preprocessing function) and arrPretreate function (array preprocessing function), and the actual operation process is as follows: a use case object is input into the objPretreate function, the use case object is traversed to obtain three attributes: use case name, activity configuration and page configuration, the objPretreate function is used to judge that the attribute of the use case name is object data, the attribute of the activity configuration is object, and the attribute of the page configuration is object array, the use case name is input into the dataPretreate function to judge whether the use case name is configured with a call tag corresponding to the use case name, for example, “__function name (parameter)”. If yes, it needs to be replaced by a dynamic parameter, and if not, it does not need to be replaced. The activity configuration is input into the objPretreate function, the object elements of the activity configuration are traversed and judged, and it is judged whether the object elements of the activity configuration are configured with a call tag corresponding to the use case name. If yes, it needs to be replaced by a dynamic parameter, and if not, it does not need to be replaced. The page configuration is input into the arrPretreate function, the array elements of the page configuration are traversed and judged, and it is judged that all the array elements of the page configuration are page objects (a type of object). The array elements are processed by the objPretreate function, and it is judged whether the array elements of the page configuration are configured with a call tag corresponding to the use case name. If yes, it needs to be replaced by a dynamic parameter, and if not, it does not need to be replaced.

[0139] In some embodiments, the attribute of the constituent structure is identified by:

[0140] The constituent structure is input into a judging function to judge the attribute of the constituent structure.

[0141] In the case that the attribute of the composition structure is object data, the composition structure is input to the first processing function to perform the first judging step;

[0142] In the case that the attribute of the composition structure is object, the composition structure is input to the second processing function to perform the second judging step;

[0143] In the case that the attribute of the composition structure is object array, the object array is input to the third processing function and the second processing function to perform the third judging step; wherein the third processing function inputs the array element judged as object to the second processing function.

[0144] The functions of the judging function are combined into the first processing function, the second processing function and the third processing function, the use case object is randomly input to the first processing function, the second processing function or the third processing function, the composition structure of the use case object is judged by the first processing function, the second processing function or the third processing function, and after the attribute of the composition structure of the use case object is determined, it is transmitted to the corresponding processing function for processing. Specifically, the first processing function, the second processing function and the third processing function randomly receive the composition structure of the use case object and perform attribute judgment, the attribute of the composition structure is object data, the composition structure is input to the first processing function to perform the first judging step, the attribute of the composition structure is object, the composition structure is input to the second processing function to perform the second judging step, and the attribute of the composition structure is object array, the object array is input to the third processing function to perform the third judging step.

[0145] Take the first processing function as the dataPretreate function (data preprocessing function), the second processing function as the objPretreate function (page preprocessing function), and the third processing function as the arrPretreate function (array preprocessing function) as an example. The dataPretreate function judges the attribute of the input component structure a1. If the component structure a1 is an object, the component structure a1 is input into the objPretreate function for processing. If the component structure a1 is an object array, the component structure a1 is input into the arrPretreate function for processing. If the component structure a1 is object data, the dataPretreate function judges whether the component structure a1 is configured with a call tag corresponding to a use case name. If yes, it is necessary to replace it with a dynamic parameter. If not, it is not necessary to replace it. The arrPretreate function judges the attribute of the input component structure a2. If the component structure a2 is an object, the component structure a2 is input into the objPretreate function for processing. If the component structure a2 is object data, the component structure a2 is input into the dataPretreate function for processing. If the component structure a2 is an object array, the arrPretreate function judges the attribute of each array element of the component structure a2. If the array element is an object, the array element is input into the objPretreate function for processing. If the array element is object data, the array element is input into the dataPretreate function for processing. The objPretreate function judges the attribute of the input component structure a3. If the component structure a3 is an object array, the component structure a3 is input into the arrPretreate function for processing. If the component structure a3 is object data, the component structure a3 is input into the dataPretreate function for processing. If the component structure a3 is an object, the objPretreate function judges the attribute of each object element of the component structure a3. If the object element is an object array, the array element is input into the arrPretreate function for processing. If the object element is object data, the object element is input into the dataPretreate function for processing.

[0146] Referring to Figure 4 In some embodiments, step S105 can include, but is not limited to, steps S401-S404.

[0147] In step S401, it is judged whether the judgment result is to replace the original component structure with dynamic data. If yes, step S402 is executed. If not, step S403 is executed.

[0148] Step S402, generating dynamic data according to the calling label to replace the original component structure, and outputting the replaced dynamic data.

[0149] Step S403, directly outputting the original component structure.

[0150] Step S404, combining the component structure replaced by the dynamic data and the original component structure to obtain a new use case object, and outputting the new use case object.

[0151] In step S401 of some embodiments, it is determined whether the judgment result is to replace the original component structure with dynamic data. Specifically, the judgment result obtained in step S104 is received, the judgment result of each component structure of the use case object is traversed, the component structure that needs to be replaced with dynamic data and the component structure that does not need to be replaced with dynamic data are determined, the component structure whose judgment result is to replace with dynamic data is transferred to step S402 for processing, and the component structure whose judgment result is not to replace with dynamic data is transferred to step S403 for processing.

[0152] In step S402 of some embodiments, the dynamic data is generated according to the calling label to replace the original component structure, and the replaced dynamic data is outputted. Specifically, a dynamic function is generated by calling a function associated with the calling label, the original test data is replaced by using the generated dynamic function, if the calling label is inserted in the test data, the original test data and the calling label are replaced by using the generated dynamic function, and if the calling label is used to represent the test data to be replaced, the calling label is replaced by using the generated dynamic function.

[0153] In step S403 of some embodiments, the original component structure is directly outputted. Specifically, the original component structure is retained, and it is determined that the component structure is static data and is not replaced.

[0154] In step S404 of some embodiments, the component structure replaced by the dynamic data and the original component structure are combined to obtain a new use case object, and the new use case object is output. Specifically, the object data with the call tag is replaced by the dynamic data according to the attribute of each component structure of the use case object, the object data without the call tag is retained, the array element with the call tag is replaced by the dynamic data according to the attribute of the object data of the array element of the object array, the array element without the call tag is retained, the array element replaced by the dynamic data and the original array element are combined to form a new object array, the object element with the call tag is replaced by the dynamic data according to the attribute of the object data of the object of the object, the object element without the call tag is retained, the object element replaced by the dynamic data and the original object element are combined to form a new object, and finally the processed object data, object array and object are combined to obtain a new use case object, and the new use case object is output.

[0155] Referring to Figure 5 The embodiment of the application further provides a software test data design device, which can implement the software test data design method.

[0156] The input module is configured to establish a test file and input test data required by the test case into the test file.

[0157] The label insertion module is configured to configure a call tag for the specific test data.

[0158] The reading module is configured to read the test data required by the test case to obtain a use case object.

[0159] The judging module is configured to perform attribute judgment on the component structure of the use case object to obtain a judgment result.

[0160] The processing module is configured to determine a processing result of the use case object according to the judgment result and the call tag, and output the processing result.

[0161] The specific implementation of the software test data design device is basically the same as the specific embodiment of the software test data design method, and will not be repeated here.

[0162] The embodiment of the application further provides an electronic device, which comprises a memory and a processor. The memory stores a computer program, and the processor implements the software test data design method when executing the computer program. The electronic device can be any intelligent terminal, such as a tablet computer or a vehicle-mounted computer.

[0163] Referring to Figure 6 ,Figure 6 The hardware structure of an electronic device is illustrated, and the electronic device includes:

[0164] The processor 601 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., and is configured to execute related programs to implement the technical solutions provided by the embodiments of the present application.

[0165] The memory 602 can be implemented by a ROM (ReadOnly Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), etc. The memory 602 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 602 and are called and executed by the processor 601 to implement the software test data design method of the embodiments of the present application.

[0166] The input / output interface 603 is configured to implement information input and output.

[0167] The communication interface 604 is configured to implement the communication interaction between the device and other devices. The communication can be implemented by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).

[0168] The bus 605 is configured to transmit information between the components (for example, the processor 601, the memory 602, the input / output interface 603, and the communication interface 604) of the device.

[0169] The processor 601, the memory 602, the input / output interface 603, and the communication interface 604 are connected to each other by the bus 605 to realize the communication connection between the components in the device.

[0170] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the software test data design method.

[0171] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory disposed remotely with respect to the processor, which can be connected to the processor through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0172] The software test data design method and device, electronic equipment and storage medium provided by the embodiments of the present application separate the test data and the test program before automatic testing, mark the specific test data by setting a call label, distinguish the test data required for specific processing from other test data, reduce the number of maintenance of the test data required for specific processing, reduce the test time, convert the test data into a use case object, process the use case object, determine the processing result of the use case object according to the type and the call label of the use case object, split and classify each use case object in a complex maintenance project, and maintain and process each use case object respectively, improve the compatibility of the test program, and reduce the operation difficulty of the tester.

[0173] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0174] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the figures shown, or combine certain steps, or different steps.

[0175] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separate, that is, can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0176] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.

[0177] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of this application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or chronological mundane operation, reverse order operation, based on circuitry availability, based on stated preference or the like, and that "default" or other orderings are thus permissible. Further, the terms "comprise", "comprising", "include", "including", and the like, are specifically intended to be open-ended. That is, references to individual steps and the like do not suhstantially exclude the presence of two or more of a recited step or its integral sub-steps or additional steps whether or not readily ascertainable from the description or the like. Further, the words "a" or "an", as used herein in the disclosure and elsewhere, are used indiscriminately and are to be interpreted in the same way, i.e. as meaning "one or more".

[0178] It should be understood that, in the application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the relationship between associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that there are only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0179] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the above units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed objects can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0180] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0181] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0182] When the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in part, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions used to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various other media that can store programs.

[0183] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not limited to the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.

Claims

1. A method of software test data design, characterized by, The method comprises the following steps: establishing a test file and inputting test data required by a test case into the test file; configuring a calling label for the test data; reading test data required by the test case to obtain a case object; judging the attribute of the composition structure of the case object to obtain a judgment result; determining the processing result of the case object according to the judgment result and the calling label, and outputting the processing result; wherein the judgment of the attribute of the composition structure of the case object to obtain a judgment result comprises: identifying the attribute of the composition structure; wherein the attribute of the composition structure comprises an object, an object array and object data; when the attribute of the composition structure is object data, performing a first judgment step; when the attribute of the composition structure is an object, performing a second judgment step; when the attribute of the composition structure is an object array, performing a third judgment step; wherein the first judgment step comprises: judging whether the object data is assigned with the calling label; if yes, the judgment result is to replace the object data with dynamic data; if no, the judgment result is not to replace the object data with dynamic data; wherein the second judgment step comprises: judging whether each object element of the object is assigned with the calling label; if yes, the judgment result is to replace the object element with dynamic data; if no, the judgment result is not to replace the object element with dynamic data; wherein the third judgment step comprises: judging whether each array element of the object array is assigned with the calling label; if yes, the judgment result is to replace the array element with dynamic data; if no, the judgment result is not to replace the array element with dynamic data; wherein the identification of the attribute of the composition structure comprises: inputting the composition structure into a judgment function to judge the attribute of the composition structure; in the case that the attribute of the composition structure is object data, inputting the composition structure into a first processing function to perform the first judgment step; in the case that the attribute of the composition structure is an object, inputting the composition structure into a second processing function to perform the second judgment step; in the case that the attribute of the composition structure is an object array, inputting the object array into a third processing function and a second processing function to perform the third judgment step; wherein the third processing function inputs the array element judged as an object into the second processing function, the first processing function is a data preprocessing function, the second processing function is a page preprocessing function, and the third processing function is an array preprocessing function.

2. The method of claim 1, wherein, The establishment of the test file and the inputting of test data required by the test case into the test file comprise: performing classification processing on the test data to obtain a classification result; performing separate storage of the test data in the test file according to the classification result; assigning an index label to the test data; wherein the index label is used to represent the test data required by the test case.

3. The method of claim 1, wherein, The configuration of the calling label for the test data comprises: inserting the call tag in the test data or replacing the test data by the call tag according to a data type of the test data; the call tag is associated with a function capable of generating dynamic data.

4. The method of claim 1, wherein, the processing result of the use case object is determined according to the judgment result and the call tag, and the processing result is outputted, including: judging whether the judgment result is to replace the original component structure with dynamic data; if yes, generating dynamic data according to the call tag to replace the original component structure, and outputting the dynamic data after the replacement; if no, directly outputting the original component structure; combining the component structure replaced with dynamic data and the original component structure to obtain a new use case object, and outputting the new use case object.

5. A method of software test data design, characterized by, including: establishing a test file, and inputting test data required for setting of a test case into the test file; configuring a call tag for the test data; reading the test data required for setting of the test case to obtain a use case object; performing attribute judgment on a component structure of the use case object to obtain a judgment result; determining a processing result of the use case object according to the judgment result and the call tag, and outputting the processing result; wherein the attribute judgment on the component structure of the use case object to obtain the judgment result includes: identifying an attribute of the component structure; wherein the attribute of the component structure includes an object, an object array and object data; when the attribute of the component structure is object data, performing a first judgment step; when the attribute of the component structure is an object, performing a second judgment step; when the attribute of the component structure is an object array, performing a third judgment step; wherein the first judgment step includes: judging whether the object data is assigned with the call tag; if yes, the judgment result is to replace the object data with dynamic data; if no, the judgment result is not to replace the object data with dynamic data; wherein the second judgment step includes: judging whether each object element of the object is assigned with the call tag; if yes, the judgment result is to replace the object element with dynamic data; if no, the judgment result is not to replace the object element with dynamic data; wherein the third judgment step includes: judging whether each array element of the object array is assigned with the call tag; if yes, the judgment result is to replace the array element with dynamic data; if no, the judgment result is not to replace the array element with dynamic data; wherein the identification of the attribute of the component structure includes: randomly inputting the component structure into a first processing function, a second processing function or a third processing function to perform attribute judgment on the component structure, wherein the first processing function is a data preprocessing function, the second processing function is a page preprocessing function, and the third processing function is an array preprocessing function; in a case where the attribute of the component structure is object data, inputting the component structure into the first processing function to perform the first judgment step; In the case that the attribute of the component structure is an object, the component structure is input to a second processing function to perform the second judging step; In the case that the attribute of the component structure is an object array, the object array is input to a third processing function to perform the third judging step.

6. A software test data design apparatus characterized by comprising: The device is used to implement the software testing data design method in any one of claims 1 to 5, and the device comprises: An input module is configured to establish a test file and input testing data required by a test case into the test file; A label insertion module is configured to configure a calling label for the testing data; A reading module is configured to read the testing data required by the test case to obtain a case object; A judging module is configured to perform attribute judgment on a component structure of the case object to obtain a judgment result; A processing module is configured to determine a processing result of the case object according to the judgment result and the calling label and output the processing result.

7. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the software testing data design method in any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising: The computer program is executed by the processor to implement the software testing data design method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Wireless data transmission equipment testing data mining system and method based on LabVIEW and Matlab hybrid programming

    CN104182596A

  • Distributed performance testing method and device and computer readable storage medium

    CN108038013A