CN116680200A - Automatic generation method, system and computer equipment for software test data - Google Patents

Automatic generation method, system and computer equipment for software test data Download PDF

Info

Publication number
CN116680200A
CN116680200A CN202310913538.0A CN202310913538A CN116680200A CN 116680200 A CN116680200 A CN 116680200A CN 202310913538 A CN202310913538 A CN 202310913538A CN 116680200 A CN116680200 A CN 116680200A
Authority
CN
China
Prior art keywords
test data
data
tester
test
generating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310913538.0A
Other languages
Chinese (zh)
Inventor
曹洋
郑振华
曹慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING VOCATIONAL COLLEGE OF LABOUR AND SOCIAL SECURITY
Original Assignee
BEIJING VOCATIONAL COLLEGE OF LABOUR AND SOCIAL SECURITY
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING VOCATIONAL COLLEGE OF LABOUR AND SOCIAL SECURITY filed Critical BEIJING VOCATIONAL COLLEGE OF LABOUR AND SOCIAL SECURITY
Priority to CN202310913538.0A priority Critical patent/CN116680200A/en
Publication of CN116680200A publication Critical patent/CN116680200A/en
Pending legal-status Critical Current

Links

Classifications

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

Landscapes

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

Abstract

The application discloses a software test data automatic generation method, a system and computer equipment. The method comprises the following steps: responding to the URL of a tested page input by a tester on a front-end user interface, and capturing an input control on the tested page as a generation source of a test data item; recording the operation of a tester on the tested page, and extracting an input data item from the operation as a target test data item; generating definitions of all target test data items in an XML file mode, and supporting a tester to manually modify the definitions of the target test data items; and storing the finally determined XML file, and analyzing the XML file to generate a test data file in a CSV format. The application can quickly and comprehensively help testers to generate test data applied to front-end automatic function test and improve agile test efficiency.

Description

Automatic generation method, system and computer equipment for software test data
Technical Field
The application belongs to the technical field of automatic test and evaluation of computer software, and particularly relates to a method for automatically generating test data.
Background
Software testing and evaluation are important components of the software life cycle, and ensure the correctness and integrity of computer software. In the software testing process, the preparation of test data is an important ring, and the test data is quickly and comprehensively prepared, so that the test efficiency can be greatly improved, the test period is shortened, the omission of test cases can be avoided, and the coverage of the test is increased.
Agile test is a popular software test method in recent years, is a test practice following agile declaration, mainly emphasizes testing the system from the practical user perspective, focuses on continuously iterating the newly developed functions of the test, and continuously performing regression test to ensure the correctness of the previously tested functions. In agile testing, automated testing is particularly important, ensuring that the testing process can be rapidly and accurately performed.
The automatic test technology mainly comprises the aspects of automatically generating test data, automatically executing test processes and verification results, automatically deploying test environments and the like. In the aspect of automatically generating test data, the existing methods at present mainly comprise a random test data generation method, a path test data generation method and a test data generation method according to data specification. The random test data generation method (1) is to randomly select test data in the value range of input data, and is suitable for functional test, and the covered data is relatively comprehensive, but has the disadvantage of no emphasis and the generated data is too scattered. (2) The path test data generating method includes the first logic flow analysis of the tested source program, the subsequent execution of certain path and the deduction of the data value to be input based on some given rules, such as "certain specific coverage criterion is realized" or "certain path is executed". The generation process of the test data comprises four steps: and (3) establishing a control diagram of the program, selecting a program path according to the coverage standard, performing symbol calculation, and finally generating test data. Since the number of program paths is very large, the path length is often infinite, so that more or less manual intervention is required in selecting the path. (3) The test data method is generated according to the data specification, namely, the system provides a data specification language to help the user describe the input data, and then the system uses the description to generate the required input data. The disadvantage of this approach is that the specification language is more difficult to use and the test data generated is more difficult to use widely.
In the test data generation mode, the current popular mode is to directly read the database table structure, generate a test data file in CSV format through a stored process, or directly generate SQL inserted into the database. The method is more suitable for performance test, a large amount of data can be generated in batches, and the data are scattered, so that the real performance of the system can be tested. However, this approach has the disadvantage that the generated data cannot be applied to front-end automated functional testing, and thus cannot be applied to agile testing.
In summary, during the front-end automated functional testing process, test data is typically stored in text files, where the program automatically reads the data and performs the front-end automated testing. The above prior art fails to meet this need for generating front-end automated test data. Mainly because of the following two problems: one is that most of the current test tools generate data according to the database table structure, but not according to the front-end user interface, and the generated data cannot be used for front-end automation. Secondly, the data generated directly according to the database can only be correct data, otherwise, the data cannot be stored in the database, but for front-end testing, most of use cases are abnormal test data under the condition of abnormal testing, and the current tool has no function of generating the abnormal data.
Disclosure of Invention
Based on the above, the application provides an automatic generation method, an automatic generation system and computer equipment for software test data, which can help testers to generate test data applied to front-end automatic function test quickly and comprehensively and improve agile test efficiency.
In a first aspect, a method for automatically generating software test data includes:
responding to the URL of a tested page input by a tester on a front-end user interface, and capturing an input control on the tested page as a generation source of a test data item;
recording the operation of a tester on the tested page, and extracting an input data item from the operation as a target test data item;
generating definitions of all target test data items in an XML file mode, and supporting a tester to manually modify the definitions of the target test data items; the definition of the target test data item includes: the name, type, allowed range of values, data that must be included or only be included of the test data;
and storing the finally determined XML file, analyzing the XML file, and generating a test data file in a CSV format for front-end automatic function test.
Optionally, the input controls include text entry boxes, check boxes, radio buttons, drop down menus, and file upload controls. For example, if the tested page is a registration page, the captured input controls are a plurality of text input boxes including user names, passwords, mailboxes, contact phones, company addresses, and the like.
Optionally, the defining of the target test data item further includes: specifying the type of error data to be generated, specifying the amount of data to be generated, and the period of generation.
Optionally, the specifying the type of the error data to be generated includes: data type errors, data over length limit errors, data over traffic boundary range errors, and data miss errors.
Optionally, the tester manually modifies the definition of the target test data item, including setting the association relationship between data and calculating the relationship.
Optionally, the process of generating the test data file in the CSV format includes the following steps:
1) Generating data which must be contained or can only be contained and is specified by a tester;
2) Generating other specified data including Chinese, null strings and/or null;
3) Randomly generating data in the allowed value range, and meeting the association relation and calculation relation between the data set by the tester;
4) Generating data of a specified error type;
5) Calculating the weight of the value, and repeatedly generating data for the value of the insufficient weight until the requirement is met;
6) Checking the number of lines generated by the test data file, and if not enough, repeating the steps 1) to 5).
Further, when the tester needs to regress to test a certain functional point again in the agile test process, the system responds to the operation of the tester on the XML file stored before, and the test data file in the required CSV format is generated again.
In a second aspect, a software test data automation generation system includes the following program modules:
the control capturing module is used for responding to the URL of the tested page input by the tester at the front-end user interface, capturing the input control on the tested page and taking the input control as a generation source of the test data item;
the recording module records the operation of a tester on the tested page and extracts an input data item from the operation as a target test data item;
the test data definition module generates definitions of all target test data items in an XML file mode and supports a tester to manually modify the definitions of the target test data items; the definition of the target test data item includes: the name, type and allowed value range of the test data;
and the test data generation module is used for storing the finally determined XML file, analyzing the XML file and generating a test data file in a CSV format for front-end automatic function test.
In a third aspect, a computer device includes a memory and a processor, where the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for automatically generating software test data.
Compared with the prior automatic test data generation method which can not generate front-end automatic function test data and abnormal data, the method is difficult to be directly applied to the actual production test process, and has the following advantages:
1. the test data is generated according to the input of the user on the front-end page, so that the front-end function test requirement is met, the time for writing the front-end automatic test case code is saved, the test efficiency can be greatly improved, and the agile test is accelerated.
2. The application can generate not only correctness data, but also abnormal data, ensures the comprehensiveness of test data, avoids unilateralness when the test data is simply constructed by human brain, and can effectively cover all test ranges.
3. The logic relationship between the data is ensured while the test data is randomly generated, and the weight of the value can be defined, so that the data is more consistent with the real data.
4. The test data file is generated in CSV format, which can be conveniently analyzed by the automatic program for front-end automatic test.
Drawings
FIG. 1 is a flow chart of an automated software test data generation method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an operating principle of an automatic software test data generating system according to an embodiment of the present application;
FIG. 3 is an example of test data definition for a registration page in one embodiment of the application;
FIG. 4 is a flowchart illustrating a method for parsing an XML file to generate final CSV format test data according to an embodiment of the present application;
fig. 5 is a schematic diagram illustrating an internal structure of a computer device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
One application scenario of the application is: the tester performs necessary input operation on the terminal (front end interface), and then the terminal automatically operates to obtain test data for front end automatic function test.
In one embodiment, as shown in fig. 1, a method for automatically generating software test data includes the following steps:
s1: responding to the URL of a tested page input by a tester on a front-end user interface, and capturing an input control on the tested page as a generation source of a test data item;
s2: recording the operation of a tester on the tested page, and extracting an input data item from the operation as a target test data item;
s3: generating definitions of all target test data items in an XML file mode, and supporting a tester to manually modify the definitions of the target test data items; the definition of the target test data item includes: name, type, allowed range of values, etc. of the test data;
s4: and storing the finally determined XML file, analyzing the XML file, and generating a test data file in a CSV format for front-end automatic function test.
The test driving development is a core technology in agile development, and the basic idea of the test driving development is to write test codes before developing functional codes, and then write only the functional codes which enable the test to pass, so that the whole development process is driven to be carried out by the test. The application generates the test data according to the input of the user on the front-end page, thereby more meeting the front-end function test requirement, saving the time for writing the front-end automatic test case code, greatly improving the test efficiency and accelerating the agile test.
In step S3, the defining of the target test data item may further include: specifying the type of error data to be generated, specifying the amount of data to be generated, and the period of generation. The specifying the type of the error data to be generated may specifically include: data type errors, data over length limit errors, data over traffic boundary range errors, and data miss errors. And supporting the manual modification of the definition of the target test data item by the tester, wherein the manual modification comprises the setting of the association relation and the calculation relation between the data. Therefore, the application can also generate correct and abnormal data at the same time and can be conveniently applied to the actual test process.
The system of the application is adopted by testers to realize the automatic generation method of the test data, and the specific realization process is as follows:
1. when the system is used for the first time, a tester inputs the URL of a page to be tested in the system.
2. The system traverses the input controls on the front-end interface as test data items to be generated.
3. The system records the testing steps of the tester and extracts the test data items to be input.
4. The system generates definitions of all test data items in the form of XML files, including the name, type, allowed range of values, values that must be included or that can only be included for the test data. Within the allowable range, the data is randomly generated, and the weight of the value can be set. The tester can manually modify the data, such as setting the association relation between the data, calculating the relation, and the like, so that the system can generate more accurate test data.
5. The tester specifies the type of error data to be generated in the system, including data type errors, data exceeding length limit errors, data exceeding business boundary range errors, data missing errors, and the like.
6. The tester specifies the amount of data generated and the period of generation in the system to ensure that the data is different for each test.
7. The system stores the XML file and analyzes the XML file to generate a CSV format test data file, and the format file can be conveniently analyzed by an automatic program for front-end automatic function test.
8. When a tester needs to regress to test a certain functional point again in the agile test process, the XML file stored before is directly opened, and the system can generate the required test data again.
As shown in fig. 2, an embodiment of the present application provides an automated software test data generating system, including:
the control capturing module is used for capturing an input control on a tested page as a generation source of a test data item in response to the URL of the tested page input by a tester on a front-end user interface;
the recording module is used for recording the operation of a tester on the tested page and extracting an input data item from the operation as a target test data item;
the test data definition module is used for generating definitions of all target test data items in an XML file mode and supporting a tester to manually modify the definitions of the target test data items; the definition of the target test data item includes: the name, type and allowed value range of the test data;
and the test data generation module is used for storing the finally determined XML file, analyzing the XML file and generating a test data file in a CSV format for front-end automatic function test.
Specifically:
the control capturing module mainly captures Input controls (including text, checkbox, radiobutton, select, file and the like) on the page as test data items to be generated. For example, a tester may input the URL address of a registration page to the system to test the registration page. The system automatically traverses all text controls on the page, such as user name, password, mailbox, contact phone, company address, etc. In a later generated data definition module, the system generates test data for these captured data items.
The recording module is used for recording the operation of a tester on the tested front-end page and extracting the input data items from the operation. For example, the tester has a process of uploading the file, and the system can record the process and extract the path of uploading the file as the test data item to be generated.
The test data definition module refers to test data items to be generated, and defines the test data items in an XML file mode, wherein the test data items comprise names, types, allowed value ranges and the like of the test data. Table 1 below is an example of XML tags and attributes:
TABLE 1
A data definition in XML format may be generated for each front-end page. The tester can modify the XML file, supplementing some special conditions such as, for example, the weight of the generated data values, the association between the data, etc. For example, the user-registered test data may be defined as shown in fig. 3.
Meanwhile, the tester can also specify the type of error data to be generated in the system, wherein the type of error data comprises data type errors, data exceeding length limit errors, data exceeding service boundary range errors, data missing errors and the like. And specifies the amount of data generated and the period of generation to ensure that the data is different for each test.
The test data generating module is used for analyzing the XML file to generate the final test data in the CSV format, and the specific process is shown in fig. 4:
1) Data is generated that must be contained, or can only be contained, which is user-specified and must be satisfied first.
2) And generating Chinese or null strings or null and other specified data.
3) The data is randomly generated within the boundary, and attention is paid to the associated external data fields at this time, so that the logical relationship between the data is ensured.
4) Error type data is generated.
5) And calculating the weight of the value, and repeatedly generating data for the value of the insufficient weight until the requirement is met.
6) Checking the number of lines generated by the file, and repeating the steps if the number of lines is insufficient.
7) Finally, test data in CSV format is generated. Table 2 is an example of test data.
TABLE 2
User name Mailbox Sex (sex) Work unit
Zhang San [email protected] Man's body Beijing Vocational College of labor and social security
Li Si [email protected] Man's body Corporation
Wang Wu NULL Female NULL
The test program can be directly used by testers, and can be conveniently used as the input of the front-end automatic test program.
The embodiment can quickly and comprehensively help a tester to generate the test data applied to the front-end automatic function test, generates data based on the front-end interface input of a user, not only can generate correctness data, but also can generate abnormal type data, ensures the comprehensiveness of the test data, avoids the unilateralness when the test data is simply constructed by human brain, can effectively cover all test ranges, can be conveniently applied in the actual test process, saves test time and improves agile test efficiency. The logic relationship between the data is ensured while the test data is randomly generated, and the weight of the value can be defined, so that the data is more consistent with the real data. The test data file is generated in CSV format, which can be conveniently analyzed by the automatic program for front-end automatic test.
In one embodiment, a computer device is also provided, which may be a terminal, and the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal. The computer program, when executed by a processor, implements a method for automatically generating software test data as described above. Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a general hardware configuration supporting the inventive arrangements and is not limiting as to the computer device to which the inventive arrangements are applied, as a particular computer device may comprise more or less components than those shown, or may combine some components, or have a different arrangement of components.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.

Claims (10)

1. An automated software test data generation method, comprising:
responding to the URL of a tested page input by a tester on a front-end user interface, and capturing an input control on the tested page as a generation source of a test data item;
recording the operation of a tester on the tested page, and extracting an input data item from the operation as a target test data item;
generating definitions of all target test data items in an XML file mode, and supporting a tester to manually modify the definitions of the target test data items; the definition of the target test data item includes: the name, type, allowed range of values, data that must be included or only be included of the test data;
and storing the finally determined XML file, analyzing the XML file, and generating a test data file in a CSV format for front-end automatic function test.
2. The automated software test data generation method of claim 1, wherein the input controls comprise text entry boxes, check boxes, radio buttons, drop down menus, and file upload controls.
3. The automated software testing data generating method of claim 2, wherein if the tested page is a registration page, the captured input controls are a plurality of text input boxes including a user name, a password, a mailbox, a contact phone, and a company address.
4. The automated software test data generation method of claim 1, wherein the defining of the target test data item further comprises: specifying the type of error data to be generated, specifying the amount of data to be generated, and the period of generation.
5. The automated software test data generation method of claim 4, wherein the specifying the type of error data to be generated comprises: data type errors, data over length limit errors, data over traffic boundary range errors, and data miss errors.
6. The automated software test data generation method of claim 5, wherein the manual modification of the definition of the target test data item by the tester includes setting an association relationship between data, calculating a relationship.
7. The automated software test data generating method of claim 6, wherein the process of generating the CSV formatted test data file comprises the steps of:
1) Generating data which must be contained or can only be contained and is specified by a tester;
2) Generating other specified data including Chinese, null strings and/or null;
3) Randomly generating data in the allowed value range, and meeting the association relation and calculation relation between the data set by the tester;
4) Generating data of a specified error type;
5) Calculating the weight of the value, and repeatedly generating data for the value of the insufficient weight until the requirement is met;
6) Checking the number of lines generated by the test data file, and if not enough, repeating the steps 1) to 5).
8. The automated software test data generating method according to claim 1, wherein when a tester needs to regress to test a functional point again in the agile test process, the system responds to the operation of the tester on the XML file stored previously to regenerate the test data file in the required CSV format.
9. An automated software test data generation system comprising program modules for:
the control capturing module is used for responding to the URL of the tested page input by the tester at the front-end user interface, capturing the input control on the tested page and taking the input control as a generation source of the test data item;
the recording module records the operation of a tester on the tested page and extracts an input data item from the operation as a target test data item;
the test data definition module generates definitions of all target test data items in an XML file mode and supports a tester to manually modify the definitions of the target test data items; the definition of the target test data item includes: the name, type and allowed value range of the test data;
and the test data generation module is used for storing the finally determined XML file, analyzing the XML file and generating a test data file in a CSV format for front-end automatic function test.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the software test data automated generation method of any one of claims 1 to 8.
CN202310913538.0A 2023-07-24 2023-07-24 Automatic generation method, system and computer equipment for software test data Pending CN116680200A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310913538.0A CN116680200A (en) 2023-07-24 2023-07-24 Automatic generation method, system and computer equipment for software test data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310913538.0A CN116680200A (en) 2023-07-24 2023-07-24 Automatic generation method, system and computer equipment for software test data

Publications (1)

Publication Number Publication Date
CN116680200A true CN116680200A (en) 2023-09-01

Family

ID=87779473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310913538.0A Pending CN116680200A (en) 2023-07-24 2023-07-24 Automatic generation method, system and computer equipment for software test data

Country Status (1)

Country Link
CN (1) CN116680200A (en)

Similar Documents

Publication Publication Date Title
CN110427331B (en) Method for automatically generating performance test script based on interface test tool
US8386419B2 (en) Data extraction and testing method and system
WO2018120721A1 (en) Method and system for testing user interface, electronic device, and computer readable storage medium
CN111367976B (en) Method and device for exporting EXCEL file data based on JAVA reflection mechanism
CN110990274B (en) Data processing method, device and system for generating test cases
CN114880240B (en) Automatic test system and method for equipment of Internet of things, storage medium and equipment
CN113065300B (en) Method, system and device for backtracking simulation waveform in chip EDA simulation
CN112181854A (en) Method, device, equipment and storage medium for generating flow automation script
CN109408379A (en) One kind is based on promotion jmeter interface automatic test data matching method
CN115794641A (en) Method, device and equipment for making number based on business process and storage medium
CN111737148A (en) Automatic regression testing method and device, computer equipment and storage medium
CN109582286B (en) Freemarker technology-based data normalization verification method and device
CN112395182A (en) Automatic testing method, device, equipment and computer readable storage medium
CN114297961A (en) Chip test case processing method and related device
CN116860608A (en) Interface testing method and device, computing equipment and storage medium
CN116680200A (en) Automatic generation method, system and computer equipment for software test data
CN116155597A (en) Access request processing method and device and computer equipment
CN113791980B (en) Conversion analysis method, device and equipment for test cases and storage medium
CN115829925A (en) Appearance defect detection method and device, computer equipment and storage medium
CN110532186B (en) Method, device, electronic equipment and storage medium for testing by using verification code
CN114356454A (en) Account checking data processing method, account checking data processing device, account checking data storage medium and program product
CN113238940A (en) Interface test result comparison method, device, equipment and storage medium
CN113220594A (en) Automatic testing method, device, equipment and storage medium
CN111813665A (en) Big data platform interface data testing method and system based on python
CN112306774A (en) Method and system for predicting performance of storage device

Legal Events

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