CN111176973A - Test method, system, electronic device and computer readable medium - Google Patents
Test method, system, electronic device and computer readable medium Download PDFInfo
- Publication number
- CN111176973A CN111176973A CN201811351246.8A CN201811351246A CN111176973A CN 111176973 A CN111176973 A CN 111176973A CN 201811351246 A CN201811351246 A CN 201811351246A CN 111176973 A CN111176973 A CN 111176973A
- Authority
- CN
- China
- Prior art keywords
- test data
- parameter
- test
- module
- information
- 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.)
- Granted
Links
- 238000010998 test method Methods 0.000 title claims description 18
- 238000012360 testing method Methods 0.000 claims abstract description 310
- 238000000034 method Methods 0.000 claims description 63
- 238000013515 script Methods 0.000 claims description 52
- 238000012545 processing Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 16
- 238000004590 computer program Methods 0.000 description 11
- 230000015654 memory Effects 0.000 description 9
- 230000006870 function Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 101100517651 Caenorhabditis elegans num-1 gene Proteins 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000002347 injection Methods 0.000 description 2
- 239000007924 injection Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 239000000758 substrate Substances 0.000 description 2
- 108010001267 Protein Subunits Proteins 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
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)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The present disclosure provides a testing method including obtaining parameter information, the parameter information being used to describe characteristics of test data of at least one parameter, parsing the parameter information, the parameter information being used to obtain characteristics of the test data of the at least one parameter, determining the test data based on the characteristics of the test data of the at least one parameter, and testing a program to be tested based on the test data. Another aspect of the disclosure provides a test system, an electronic device, and a computer-readable medium.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and more particularly, to a test method, a test system, an electronic device, and a computer-readable medium.
Background
The data-driven test is to read test data from a data file (e.g., an excel file, a txt file, an xml file, or a database, etc.), and then transmit the test data into a test script written or recorded in advance. The test data and the test scripts of the data drive test are stored separately, so that the number of the test scripts which need to be written for realizing a plurality of test cases can be reduced, the establishing and maintaining cost of the test scripts is reduced, and the modification and maintenance of the test data are facilitated.
In the course of implementing the disclosed concept, the inventors found that there are at least the following problems in the prior art: no matter what kind of data file the test data is read from, the tester is required to write specific codes for reading the test data and using the test data, so that the test automation degree is low, and the time and energy of the tester are wasted.
Disclosure of Invention
In view of the above, the present disclosure provides a testing method, system, electronic device and computer readable medium.
One aspect of the present disclosure provides a testing method including obtaining parameter information, the parameter information being used to describe characteristics of test data of at least one parameter, parsing the parameter information, the parameter information being used to obtain characteristics of the test data of the at least one parameter, determining the test data based on the characteristics of the test data of the at least one parameter, and testing a program to be tested based on the test data.
According to an embodiment of the present disclosure, the characteristic of the test data includes at least one of a value range of the test data or a usage order of a plurality of test data of the same parameter; or the interrelationship of test data of different parameters.
According to an embodiment of the present disclosure, the characteristic of the test data includes a correlation of test data of different parameters, and the characteristic of the test data of the parameter information for describing at least one parameter includes that the parameter information is used for describing grouping information of the test data of a plurality of parameters, where the grouping information is used for determining a group to which the test data of a certain parameter belongs, and in a case of determining the group to which the test data belongs, determining a value range of at least one other parameter based on the grouping information.
According to the embodiment of the disclosure, testing a program to be tested based on the test data includes generating a bytecode of the test data, assigning the bytecode of the test data to a corresponding parameter in a test script, generating an assigned test case, and running the assigned test case to test the program to be tested.
According to the embodiment of the disclosure, the method further comprises a method for identifying the parameters contained in the test script so as to determine the method for writing the parameter information and the parameters in the method.
Another aspect of the present disclosure provides a testing system including an obtaining module configured to obtain parameter information, the parameter information describing characteristics of test data of at least one parameter, an analyzing module configured to analyze the parameter information to obtain characteristics of the test data of the at least one parameter, a determining module configured to determine the test data based on the characteristics of the test data of the at least one parameter, and a testing module configured to test a program to be tested based on the test data.
According to the embodiment of the disclosure, the characteristic of the test data includes at least one of a value range of the test data, or a use sequence of a plurality of test data of the same parameter, or a correlation of the test data of different parameters.
According to an embodiment of the present disclosure, the characteristic of the test data includes a correlation of test data of different parameters, and the characteristic of the test data of the parameter information for describing at least one parameter includes that the parameter information is used for describing grouping information of the test data of a plurality of parameters, where the grouping information is used for determining a group to which the test data of a certain parameter belongs, and in a case of determining the group to which the test data belongs, determining a value range of at least one other parameter based on the grouping information.
According to the embodiment of the disclosure, the test module comprises a generation submodule for generating the bytecode of the test data, an assignment submodule for assigning the bytecode of the test data to a corresponding parameter in the test script to generate an assigned test case, and a test submodule for running the assigned test case to test the program to be tested.
According to the embodiment of the disclosure, the system further comprises an identification module for identifying the method of the test script including the parameter, so as to determine the method of writing the parameter information and the parameter therein.
Another aspect of the disclosure provides an electronic device comprising one or more processors, a storage to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of the above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.
Another aspect of the disclosure provides a computer program comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, the problems that a tester needs to write codes for reading test data from a data file and transmits the test data into a test script, so that the test automation degree is low and the time and energy of the tester are wasted can be solved at least partially, and therefore the test script can automatically acquire the test data, the test automation degree is improved, and the time and energy of the tester are saved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an application scenario of a testing method according to an embodiment of the present disclosure;
FIG. 2 schematically shows a flow diagram of a testing method according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow chart for testing a program to be tested based on the test data according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow diagram of a testing method according to another embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart of a method of identifying a parameter contained in a test script according to an embodiment of the present disclosure;
FIG. 6 schematically shows a flow chart of a testing method according to an embodiment of the present disclosure;
FIG. 7 schematically shows a block diagram of a test system according to an embodiment of the present disclosure;
FIG. 8 schematically shows a block diagram of a test module according to an embodiment of the present disclosure;
FIG. 9 schematically illustrates a block diagram of a test system according to another embodiment of the present disclosure; and
FIG. 10 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). It will be further understood by those within the art that virtually any disjunctive word and/or phrase presenting two or more alternative terms, whether in the description, claims, or drawings, should be understood to contemplate the possibilities of including one of the terms, either of the terms, or both terms. For example, the phrase "a or B" should be understood to include the possibility of "a" or "B", or "a and B".
The embodiment of the disclosure provides a testing method, which includes obtaining parameter information, analyzing the parameter information, obtaining the characteristic of test data of at least one parameter, determining the test data based on the characteristic of the test data of the at least one parameter, and testing a program to be tested based on the test data.
Fig. 1 schematically shows an application scenario of a testing method according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of an application scenario to which the embodiment of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, but does not mean that the embodiment of the present disclosure may not be applied to other scenarios.
As shown in fig. 1, a program to be tested 100, a test script 110, and a file 120 are included in the application scenario. The test script 110 is used to test whether the function of the program to be tested 100 is implemented. However, the parameter values in the test script 110 are fixed, and the program under test 100 can be tested only once, and the accuracy of the test result cannot be guaranteed.
To ensure the accuracy of the test result, the test program 100 needs to be tested multiple times by using a large amount of test data. In the prior art, a tester needs to write a code for reading test data from an external file by a test script 110, which wastes time and energy of the tester.
The present disclosure provides a testing method in which the test script 110 can automatically obtain test data without requiring a tester to write a code for reading the test data in an external file. As shown in fig. 1, the file 120 includes information describing characteristics of the test data, and the test script 110 can obtain the file 120, analyze the information in the file 120, and generate the test data according to the analysis result, thereby facilitating the test data to test the program under test 100.
Fig. 2 schematically shows a flow diagram of a testing method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S210 to S240.
In operation S210, parameter information describing characteristics of test data of at least one parameter is acquired.
In operation S220, the parameter information is parsed for obtaining characteristics of the test data of the at least one parameter.
In operation S230, test data is determined based on a characteristic of the test data for the at least one parameter.
In operation S240, a program to be tested is tested based on the test data.
According to the method, the test data meeting the requirements are automatically generated by analyzing the parameter information, the test script can directly use the generated test data, and a tester does not need to additionally write codes for reading the test data, so that the time and the energy of the tester are saved.
According to an embodiment of the present disclosure, the parameter information may be, for example, code in a java file or code in an xml file in operation S210. The parameter, for example, may be a dynamic parameter in a test script, and the purpose of testing the program to be tested for many times is achieved by changing a parameter value of at least one parameter. For example, in the scenario shown in fig. 1, the parameters in the test script 110 include num and price, where the test data for num may be 1, 2, 3, 4, and 5, and the test data for price may be 2 and 0.5. According to an embodiment of the present disclosure, the characteristics of the test data include a value range of the test data, for example, num is 1, 2, 3, 4, and 5. According to the embodiment of the disclosure, the characteristic of the test data includes the usage sequence of a plurality of test data of the same parameter, for example, the characteristic of the parameter num includes that the test is performed by sequentially using 1, 2, 3, 4 and 5, or each test randomly takes a value from 1, 2, 3, 4 and 5. According to an embodiment of the present disclosure, the characteristics of the test data include interrelationships of the test data of different parameters. For example, if the parameter num is greater than 3, the value of the parameter price can only be between 0 and 1. The method can completely describe the test data of one parameter from the value range, the use sequence and the interrelation of the test data of different parameters, and overcomes the problem of difficulty in describing the test data.
According to an embodiment of the present disclosure, the characteristic of the test data includes a correlation of the test data of different parameters, and the characteristic of the test data of the parameter information for describing at least one parameter includes that the parameter information is used for describing grouping information of the test data of a plurality of parameters, wherein the grouping information is used for determining a group to which the test data of a certain parameter belongs, and in a case of determining the group to which the test data belongs, determining a value range of at least one other parameter based on the grouping information. For example, the characteristics of the test data include the correlation between the parameter num and the price, which are divided into two cases, namely valid and inva1id according to the relationship between the parameter num and the price, and corresponding groups are created, and when the parameter num hits a valid group, the value of the price group must be taken. The method realizes the description of the relevance of the test data by grouping the test data.
According to the embodiment of the disclosure, the parameter information may include java annotations, and describing characteristics of the test data by using the java annotations allows the parameter information to have conciseness and allows different testers to fully understand the parameter information. For example, the annotation @ Range is created to describe the Range of the parameter, the @ Pace is created to describe the way in which the parameter takes values, which may be, for example, random values, and the @ Group is created to Group the parameters.
According to an embodiment of the present disclosure, in operation S220, parameter information is parsed, for example, a callback interface provided by a test framework such as TestNG or junit is utilized, and a code for parsing the parameter information is inserted during the running of the test script. The code for parsing the parameter information may include, for example, invoking a parsing tool provided by java to parse the parameter information using the parsing tool. According to the embodiment of the disclosure, the code for analyzing the parameter information can be changed without a tester, and when the test script runs, the parameter information can be automatically acquired and analyzed. In the scenario described in operation S210, the characteristics of the test data of the parameter num and the price include a parameter value range and a value mode of the parameter num, a parameter value range and a value mode of the parameter price, and an association relationship between the parameter num and the parameter price.
According to an embodiment of the present disclosure, in operation S230, the determined test data may be, for example, num-1 and price-2, num-2 and price-2, num-3 and price-2, num-4 and price-0.5, num-5 and price-0.5, according to characteristics of the test data of the parameters num and price, for example.
According to an embodiment of the present disclosure, in operation S240, the value of the local parameter in the test script may be modified according to the test data, for example, to achieve the purpose of testing the program to be tested using the test data. For example, source code or bytecode that modifies parameters in the test script.
Fig. 3 schematically shows a flow chart for testing a program to be tested based on the test data according to an embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S241 to S243.
In operation S241, a bytecode of the test data is generated.
In operation S242, the bytecode of the test data is assigned to a corresponding parameter in the test script, and an assigned test case is generated.
In operation S243, the assigned test case is run for testing the program to be tested.
The method realizes the injection of the test data by modifying the byte codes of the parameters in the test script, so that the injection of the test data can be separated from a parameter interface provided by a TestNG/Junit framework.
According to an embodiment of the present disclosure, in operation S241, bytecodes of test data num ═ 1 and price ═ 2 are generated, for example, using a bytecode tool such as ASM.
According to an embodiment of the present disclosure, in operation S242, for example, before the test method in the test script is loaded, the bytecodes of the parameter values of the parameters num and price of the test method are updated to bytecodes of 1 and 2, respectively.
According to the embodiment of the present disclosure, in operation S243, the assigned test case is run to test the program to be tested. For example, the method is reloaded into a java virtual machine, and an assigned test case is generated.
FIG. 4 schematically shows a flow diagram of a testing method according to another embodiment of the present disclosure.
As shown in fig. 4, the method further includes operation S410 based on the foregoing embodiment.
In operation S410, methods including parameters in the test script are identified to determine the methods in which parameter information needs to be written and the parameters therein.
The method can automatically extract the dynamic parameters in the test script without manually extracting the dynamic parameters in the test script, thereby further saving the time and energy of testers.
According to an embodiment of the present disclosure, in operation S410, a method including a parameter in a test script may be identified by scanning the test script, for example, and detecting a specific identifier in the test script, where the specific identifier is used to mark the method including the parameter in the test script.
The testing method of the present disclosure is further described below with reference to fig. 5 and 6 in conjunction with specific embodiments.
FIG. 5 schematically illustrates a flow chart of a method of identifying a parameter contained in a test script according to an embodiment of the present disclosure.
As shown in fig. 5, the method includes operations S510 to S580.
In operation S510, a test script is scanned. For example, the test script may be a java file, and the test script may be scanned using an interface for scanning in JDK.
In operation S520, it is determined whether a specific identifier exists in the test script, where the specific identifier may be a mark of a test method for which a dynamic parameter exists when a tester writes the test script. The tester may, for example, create a java annotation @ dynamic params, which is added in front of the test method or test class where dynamic parameters exist. In operation S580, if there is no specific identifier, it indicates that there is no dynamic parameter in the test script, and no parameter needs to be extracted. If the specific identifier exists, operation S530 is performed.
In operation S530, it is determined whether a parameter file corresponding to the test script already exists. For example, the file name of the test script is TestClassName, and the file name of the definition parameter file is TestClassName _ Params, and whether a java file with the file name of TestClassName _ Params exists is searched. If the parameter file exists, operation S550 is performed.
If the parameter file does not exist, operation S540 is performed, and in operation S540, the parameter file is created.
In operation S550, a method with an @ Test annotation in the script is found. A Test method to be run is marked by using an @ Test annotation in a testNG or Junit framework.
In operation S560, it is determined that the @ Test method is parsed in the parameter file. If it has been parsed, operation S580 is performed to ignore the test method. If not, operation S570 is performed.
In operation S570, the @ Test method is parsed, and a parameter file of the method is generated in a parameter file. The method can be analyzed by using an interface of JDK for analyzing java files, and parameter files can be generated by using JCodeModel.
For example, a method testMethod in a test script is provided with a specific annotation @ dynamic params, and by analyzing the method testMethod, the method testMethod is obtained to include parameters num and price, and then a parameter method corresponding to the method testMethod is generated in a parameter file, and the parameter method includes parameters num and price.
FIG. 6 schematically shows a flow chart of a testing method according to an embodiment of the present disclosure.
As shown in fig. 6, the method includes operations S610 to S690.
In operation S610, an automated test framework, such as TestNG or Junit, is run.
In operation S620, a parameter file is loaded. The parameter file may be, for example, TestClassName params. Similar to performing operation S210 described above, parameter information is acquired, the parameter information being used to describe characteristics of test data of at least one parameter.
In operation S630, the loaded Test methods in the automated testing framework are traversed to find the method with the annotation @ Test.
In operation S640, it is determined whether the Test method with the annotation @ Test has a corresponding parameter method in the TestClassName _ params. If not, operation S690 is performed to ignore the test method. If so, operation S650 is performed.
In operation S650, the parameter information of the method in the parameter file is parsed, and test data is generated. Operations S220 and S230 described above are performed similarly.
In operation S660, a bytecode of the test data is generated. Similarly to the execution of the operation S241 described above, for example, bytecodes such as ASM are used to generate bytecodes of the test data num 1 and price 2.
In operation S670, the bytecode of the test method is modified, and the parameters are reassigned. Similar to the operation S242 described above, for example, before the method in the test script is loaded, the bytecodes of the parameter values of the parameters num and price of the method are updated to bytecodes of 1 and 2, respectively.
In operation S680, the modified test class is reloaded, and a test case is generated. Operation S243 described above is performed similarly. For example, in the scenario described in operation S670, a test case is generated in which the program under test is tested using the test data num ═ 1 and price ═ 2.
Fig. 7 schematically illustrates a block diagram of a test system 700 according to an embodiment of the present disclosure.
As shown in FIG. 7, the test system 700 includes an acquisition module 710, a parsing module 720, a determination module 730, and a test module 740.
The obtaining module 710, for example performing operation S210 described above with reference to fig. 2, is configured to obtain parameter information, which is used to describe characteristics of the test data of the at least one parameter.
The parsing module 720, for example, performs the operation S220 described above with reference to fig. 2, for parsing the parameter information to obtain the characteristics of the test data of the at least one parameter.
The determining module 730, for example performing operation S230 described above with reference to fig. 2, is configured to determine the test data based on the characteristic of the test data of the at least one parameter.
The testing module 740, for example, performs the operation S240 described above with reference to fig. 2, for testing the program to be tested based on the test data.
According to the embodiment of the disclosure, the characteristic of the test data includes at least one of a value range of the test data, or a use sequence of a plurality of test data of the same parameter, or a correlation of the test data of different parameters.
According to an embodiment of the present disclosure, the characteristic of the test data includes a correlation of test data of different parameters, and the characteristic of the test data of the parameter information for describing at least one parameter includes that the parameter information is used for describing grouping information of the test data of a plurality of parameters, where the grouping information is used for determining a group to which the test data of a certain parameter belongs, and in a case of determining the group to which the test data belongs, determining a value range of at least one other parameter based on the grouping information.
FIG. 8 schematically shows a block diagram of a test module 740 according to an embodiment of the disclosure.
As shown in fig. 8, the test module 740 includes a generation submodule 741, an assignment submodule 742, and a test submodule 743.
The generating submodule 741, for example, performs the operation S241 described above with reference to fig. 2, for generating the bytecode of the test data.
The assignment sub-module 742, for example, executes the operation S242 described above with reference to fig. 2, and is configured to assign the bytecode of the test data to a corresponding parameter in the test script, and generate an assigned test case.
The testing submodule 743, for example, executes the operation S243 described above with reference to fig. 2, for running the assigned test case to test the program to be tested.
FIG. 9 schematically illustrates a block diagram of a test system 900 according to another embodiment of the present disclosure.
As shown in fig. 9, the test system 900 further includes an identification module 910 based on the foregoing embodiments.
The identifying module 910, for example, performs operation S410 described above with reference to fig. 4, for identifying a method of the test script including the parameter, so as to determine a method of writing parameter information and the parameter therein.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any plurality of the obtaining module 710, the parsing module 720, the determining module 730, the testing module 740, the generating sub-module 741, the assigning sub-module 742, the testing sub-module 743, and the identifying module 910 may be combined and implemented in one module, or any one of the modules may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the obtaining module 710, the parsing module 720, the determining module 730, the testing module 740, the generating sub-module 741, the assigning sub-module 742, the testing sub-module 743, and the identifying module 910 may be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementation manners of software, hardware, and firmware, or an appropriate combination of any of them. Alternatively, at least one of the obtaining module 710, the parsing module 720, the determining module 730, the testing module 740, the generating sub-module 741, the assigning sub-module 742, the testing sub-module 743, and the identifying module 910 may be implemented at least in part as a computer program module that, when executed, may perform a corresponding function.
FIG. 10 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure. The electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 10, an electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. Processor 1001 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1001 may also include onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the present disclosure.
In the RAM1003, various programs and data necessary for the operation of the electronic apparatus 1000 are stored. The processor 1001, ROM 1002, and RAM1003 are connected to each other by a bus 1004. The processor 1001 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 1002 and/or the RAM 1003. Note that the programs may also be stored in one or more memories other than the ROM 1002 and the RAM 1003. The processor 1001 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from the network through the communication part 1009 and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the embodiment of the present disclosure when executed by the processor 1001. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 1002 and/or the RAM1003 described above and/or one or more memories other than the ROM 1002 and the RAM 1003.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.
Claims (12)
1. A method of testing, comprising:
acquiring parameter information, wherein the parameter information is used for describing the characteristics of test data of at least one parameter;
analyzing the parameter information to obtain the characteristics of the test data of the at least one parameter;
determining test data based on characteristics of the test data for the at least one parameter; and
and testing the program to be tested based on the test data.
2. The method of claim 1, wherein the characteristics of the test data include at least one of:
the value range of the test data; or
The use sequence of a plurality of test data of the same parameter; or
Correlation of test data for different parameters.
3. The method of claim 1, wherein:
the characteristics of the test data include interrelationships of the test data for different parameters,
the parameter information is used for describing the characteristics of the test data of at least one parameter, and comprises the following steps:
the parameter information is used for describing grouping information of test data of a plurality of parameters, wherein the grouping information is used for determining a group to which the test data of a certain parameter belongs, and under the condition that the group to which the test data belongs is determined, the value range of at least one other parameter is determined based on the grouping information.
4. The method of claim 1, wherein said testing a program under test based on said test data comprises:
generating a bytecode of the test data;
assigning the byte codes of the test data to corresponding parameters in the test script to generate an assigned test example; and
and running the assigned test example for testing the program to be tested.
5. The method of claim 1, further comprising:
and identifying the method of the parameter contained in the test script to determine the method of the parameter information required to be written and the parameter in the method.
6. A test system, comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring parameter information which is used for describing the characteristics of test data of at least one parameter;
the analysis module is used for analyzing the parameter information to obtain the characteristics of the test data of the at least one parameter;
a determination module for determining test data based on a characteristic of the test data for the at least one parameter; and
and the test module is used for testing the program to be tested based on the test data.
7. The system of claim 6, the characteristics of the test data comprising at least one of:
the value range of the test data; or
The use sequence of a plurality of test data of the same parameter; or
Correlation of test data for different parameters.
8. The system of claim 6, wherein:
the characteristics of the test data include interrelationships of the test data for different parameters,
the parameter information is used for describing the characteristics of the test data of at least one parameter, and comprises the following steps:
the parameter information is used for describing grouping information of test data of a plurality of parameters, wherein the grouping information is used for determining a group to which the test data of a certain parameter belongs, and under the condition that the group to which the test data belongs is determined, the value range of at least one other parameter is determined based on the grouping information.
9. The system of claim 6, wherein the testing module comprises:
the generating submodule is used for generating byte codes of the test data;
the assignment submodule is used for assigning the bytecode of the test data to a corresponding parameter in the test script and generating an assigned test example;
and the test submodule is used for operating the assigned test example so as to test the program to be tested.
10. The system of claim 6, further comprising:
and the identification module is used for identifying the method containing the parameter in the test script so as to determine the method needing to write the parameter information and the parameter in the method.
11. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-5.
12. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811351246.8A CN111176973B (en) | 2018-11-13 | 2018-11-13 | Test method, system, electronic device, and computer-readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811351246.8A CN111176973B (en) | 2018-11-13 | 2018-11-13 | Test method, system, electronic device, and computer-readable medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111176973A true CN111176973A (en) | 2020-05-19 |
CN111176973B CN111176973B (en) | 2024-02-02 |
Family
ID=70657341
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811351246.8A Active CN111176973B (en) | 2018-11-13 | 2018-11-13 | Test method, system, electronic device, and computer-readable medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111176973B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112506781A (en) * | 2020-12-10 | 2021-03-16 | 中国工商银行股份有限公司 | Test monitoring method, test monitoring device, electronic device, storage medium, and program product |
CN116028598A (en) * | 2023-03-30 | 2023-04-28 | 紫金诚征信有限公司 | File generation method and device based on ES and computer readable medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6708132B1 (en) * | 2000-06-02 | 2004-03-16 | Interscience, Inc. | Microsystems integrated testing and characterization system and method |
CN107908568A (en) * | 2017-11-29 | 2018-04-13 | 中标软件有限公司 | Operating system performance automated testing method and device |
CN108388507A (en) * | 2018-01-24 | 2018-08-10 | 深圳市买买提信息科技有限公司 | Batch script testing method and device |
CN108470004A (en) * | 2018-04-09 | 2018-08-31 | 平安普惠企业管理有限公司 | Test script generation method, test method, device, equipment and storage medium |
CN108536596A (en) * | 2018-04-09 | 2018-09-14 | 武汉斗鱼网络科技有限公司 | Automated testing method, readable medium based on object formation data and equipment |
CN108549605A (en) * | 2018-04-13 | 2018-09-18 | 郑州云海信息技术有限公司 | A kind of automated testing method |
-
2018
- 2018-11-13 CN CN201811351246.8A patent/CN111176973B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6708132B1 (en) * | 2000-06-02 | 2004-03-16 | Interscience, Inc. | Microsystems integrated testing and characterization system and method |
CN107908568A (en) * | 2017-11-29 | 2018-04-13 | 中标软件有限公司 | Operating system performance automated testing method and device |
CN108388507A (en) * | 2018-01-24 | 2018-08-10 | 深圳市买买提信息科技有限公司 | Batch script testing method and device |
CN108470004A (en) * | 2018-04-09 | 2018-08-31 | 平安普惠企业管理有限公司 | Test script generation method, test method, device, equipment and storage medium |
CN108536596A (en) * | 2018-04-09 | 2018-09-14 | 武汉斗鱼网络科技有限公司 | Automated testing method, readable medium based on object formation data and equipment |
CN108549605A (en) * | 2018-04-13 | 2018-09-18 | 郑州云海信息技术有限公司 | A kind of automated testing method |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112506781A (en) * | 2020-12-10 | 2021-03-16 | 中国工商银行股份有限公司 | Test monitoring method, test monitoring device, electronic device, storage medium, and program product |
CN112506781B (en) * | 2020-12-10 | 2023-11-03 | 中国工商银行股份有限公司 | Test monitoring method, device, electronic equipment, storage medium and program product |
CN116028598A (en) * | 2023-03-30 | 2023-04-28 | 紫金诚征信有限公司 | File generation method and device based on ES and computer readable medium |
CN116028598B (en) * | 2023-03-30 | 2023-05-30 | 紫金诚征信有限公司 | File generation method and device based on ES and computer readable medium |
Also Published As
Publication number | Publication date |
---|---|
CN111176973B (en) | 2024-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20170132119A1 (en) | Method and device for retrieving test case based on code coverage | |
US9158514B2 (en) | Method and apparatus for providing change-related information | |
US8954936B2 (en) | Enhancing functional tests coverage using traceability and static analysis | |
US9208451B2 (en) | Automatic identification of information useful for generation-based functional verification | |
WO2019029160A1 (en) | Application construction method and system, computer device, and storage medium | |
US20100199263A1 (en) | Test case pattern matching | |
US10289536B2 (en) | Distinguishing public and private code in testing environments | |
US7069474B2 (en) | System and method for assessing compatibility risk | |
CN110532185B (en) | Test method, test device, electronic equipment and computer readable storage medium | |
US20100042929A1 (en) | Verification of software applications | |
US11307975B2 (en) | Machine code analysis for identifying software defects | |
CN111176973B (en) | Test method, system, electronic device, and computer-readable medium | |
CN113609008A (en) | Test result analysis method and device and electronic equipment | |
CN114791885A (en) | Interface test method, device, equipment and medium | |
CN111597069A (en) | Program processing method, program processing apparatus, electronic device, and storage medium | |
KR20100124726A (en) | Building operating system images based on applications | |
Rocha et al. | Hunting Memory Bugs in C Programs with Map2Check: (Competition Contribution) | |
CN112579475A (en) | Code testing method, device, equipment and readable storage medium | |
CN111930629A (en) | Page testing method and device, electronic equipment and storage medium | |
US8661421B2 (en) | Methods and apparatuses for endian conversion | |
US10816600B1 (en) | Protocol analysis and visualization during simulation | |
CN108885574B (en) | System for monitoring and reporting performance and correctness issues at design, compilation, and runtime | |
CN113392024B (en) | Method, device, equipment and medium for testing storage process | |
CN115617410A (en) | Drive interface identification method, device, equipment and storage medium | |
CN115033489A (en) | Code resource detection method and device, electronic equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |