CN106874209B - Test script generation method and device - Google Patents
Test script generation method and device Download PDFInfo
- Publication number
- CN106874209B CN106874209B CN201710154209.7A CN201710154209A CN106874209B CN 106874209 B CN106874209 B CN 106874209B CN 201710154209 A CN201710154209 A CN 201710154209A CN 106874209 B CN106874209 B CN 106874209B
- Authority
- CN
- China
- Prior art keywords
- test
- area
- test case
- script
- case
- 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.)
- Active
Links
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)
- Debugging And Monitoring (AREA)
- Investigating Strength Of Materials By Application Of Mechanical Stress (AREA)
Abstract
The invention provides a method and a device for generating a test script, wherein the method comprises the following steps: loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable; and generating a test script by adopting a test script generation rule according to the test case and the variable library. The invention can automatically generate the test script according to the test and variable library for test, shortens the development period of the test script, and enables the automobile controller to be tested quickly, thereby being capable of being put into the market as soon as possible; and the structure and format of the generated test script are unified, so that the readability and reusability of the test script are enhanced.
Description
Technical Field
The invention relates to the field of vehicles, in particular to a test script generation method and device.
Background
In the prior art, the application of the automobile controller is more and more extensive, the design of the automobile controller is more and more complex, and under the intense competition of the market, the automobile controller is required to be rapidly developed and tested so as to be put into the market as soon as possible, so the current test of the automobile controller generally adopts automatic test.
The dSPACE product is one of products widely applied to a hardware-in-loop automatic test system of an automobile controller, and has the characteristics of high precision, high reliability, suitability for various complex working conditions and the like. The Automation Desk is a test script development environment of a hardware-in-loop automatic test system of an automobile controller built based on a dSPACE platform. Under the environment, a test script developer develops a test script according to a test case written by the tester.
Because the automobile controllers are more and more complex, and the corresponding test cases and test scenes are more and more, the development workload of the automatic test scripts is more and more, so that the development period is longer; and because the development habits of test script developers are different, the test scripts are greatly different, and the readability and the reusability of the test scripts are low. Therefore, there is a need to improve the above-mentioned drawbacks.
Disclosure of Invention
Based on the problems, the invention provides a method and a device for generating a test script, which solve the problems that in the prior art, a tester needs to participate in the process of generating the test script, the development period of the test script is prolonged, and the reusability of the test script is poor; and the structure and format of the generated test script are unified, so that the readability and reusability of the test script are enhanced.
In one aspect, the present invention provides a method for generating a test script, including:
loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable;
and generating a test script by adopting a test script generation rule according to the test case and the variable library.
In addition, the test case data at least comprises a test case serial number, a test case calibration value, a test case variable, a test step and/or a test expected result.
In addition, the test case variables at least comprise system initialization variables, message variables and/or subsystem variables.
In addition, before the loading the test cases and the variable libraries, the method further comprises: and displaying a generation interface of the test script, wherein the generation interface is used for loading the test case and the variable library.
Further, the test script generation rule includes at least: an engineering structure of the test script, a sequence structure of the test script and/or a test step of the test script.
In addition, the test case is generated from a test case template into which the test case data is input.
In another aspect, the present invention provides a device for generating a test script, including:
a loading module to: loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable;
a generation module to: and generating a test script by adopting a test script generation rule according to the test case and the variable library.
In addition, the test case data at least comprises a test case serial number, a test case calibration value, a test case variable, a test step and/or a test expected result.
In addition, the test case variables at least comprise system initialization variables, message variables and/or subsystem variables.
In addition, before the loading of the test cases and the variable library, the apparatus further includes a display module configured to: and displaying a generation interface of the test script, wherein the generation interface is used for loading the test case and the variable library.
Further, the test script generation rule includes at least: an engineering structure of the test script, a sequence structure of the test script and/or a test step of the test script.
In addition, the test case is generated from a test case template into which the test case data is input.
Through adopting above-mentioned technical scheme, have following beneficial effect:
the invention solves the problems that in the prior art, a tester needs to participate in the process of generating the test script, so that the development period of the test script is prolonged and the reusability of the test script is poor; and the structure and format of the generated test script are unified, so that the readability and reusability of the test script are enhanced.
Drawings
FIG. 1 is a flow diagram of a method of generating a test script according to one embodiment of the invention;
FIG. 2 is a flow diagram of a method of generating a test script according to another embodiment of the invention;
FIG. 3 is a schematic diagram of a generation interface in a generation method of a test script according to another embodiment of the present invention;
FIG. 4 is a diagram illustrating a test case template in a test script generation method according to another embodiment of the present invention;
FIG. 5 is a diagram illustrating a storage structure of a variable library in a test script generation method according to another embodiment of the present invention;
FIG. 6 is a diagram of an engineering structure of a test script in a test script generation method according to another embodiment of the present invention;
fig. 7 is a block diagram of a test script generation apparatus according to another embodiment of the present invention.
Detailed Description
The present invention is described in further detail below with reference to specific embodiments and the attached drawings. It is intended that the present invention not be limited to the particular embodiments disclosed, but that the present invention be limited only by the appended claims.
Example one
Referring to fig. 1, an embodiment of the present invention provides a method for generating a test script, including:
s001, loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable;
and step S002, generating a test script by adopting a test script generation rule according to the test case and the variable library.
In step S001, a test case and a variable library are loaded, where the test case may be a file, and the test case is loaded by loading the test case file, and variables required for generating the test script are stored in the variable library.
In step S002, after the test case and the variable library have been loaded, a program for generating a test script is executed, the program is written according to the test script generation rule, and after the program is executed, the test script is generated.
The embodiment of the invention solves the problems that in the prior art, a tester needs to participate in the process of generating the test script, so that the development period of the test script is prolonged and the reusability of the test script is poor; and the structure and format of the generated test script are unified, so that the readability and reusability of the test script are enhanced.
Example two
Referring to fig. 2, an embodiment of the present invention provides a method for generating a test script, including:
step S201, displaying a generating interface of the test script, wherein the generating interface is used for loading the test case and the variable library. Fig. 3 shows a generation interface, where entries "use case _ source file" for loading test cases, and entry "library _ source file" for loading variable libraries are provided, and optionally, a "generate script" button or a "test" button may also be provided. By providing a test script generation interface, a user can load a test case and a variable library more conveniently and generate a test script more conveniently.
Step S202, loading a test case and a variable library through a generation interface of the test script, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable.
The test case data at least comprises a test case serial number, a test case calibration value, a test case variable, a test step and/or a test expected result.
Alternatively, referring to fig. 4, the test case is generated from a test case template into which test case data is input.
Establishing a test case template, wherein the test case template can comprise the following five areas:
case sequence number area: and the serial number is used for filling the serial number of the test case and the serial number of the test step, and the serial number is unique.
A use case calibration area: for filling out test case calibration values related to the test cases.
Variable region: for filling out test case variables to be used in the test engineering, such as Python variables.
An action area: for filling out the actions in the testing step.
Expected result area: for filling out the expected results of the test in the testing step.
By inputting test case data in different areas, the input can be clearer and errors can be conveniently checked.
When filling in test case data in the test case template, the rules of the test case template need to be followed, such as: the test case serial number is unique, and the test case serial number cannot be influenced when a new step is inserted between two test steps. Such as: the calibration name in the calibration value of the test case is consistent with the software release calibration name, and a space cannot be reserved between the characters of the calibration value name and the software release calibration name, such as Ke _ PRZ _ Enable ═ True. The test case variables filled in the variables can be derived from the variable library. By formulating the specification of the test template for inputting the test case data, the consistency of the test template when generating the test case is enhanced.
And step S203, generating a test script by adopting a test script generation rule according to the test case and the variable library.
Fig. 5 shows a storage structure of the variable library. Optionally, the test case variables at least include a system initialization variable, a message variable, and/or a subsystem variable.
The naming rule of the system initialization variables is as follows: named as Sys _ XXXX.
The naming rule of the message variables is as follows: named in the form Rx _ CAN _ XXXX1_ XXXX 2.
The naming rule of the subsystem variables is: act _ XXXX1_ XXXX2 form name.
Different variable types are set in the variable library, so that the accuracy in automatic variable loading is improved.
Optionally, the test script generation rule at least includes: an engineering structure of the test script, a sequence structure of the test script and/or a test step of the test script.
The engineering structure of the test script may include:
project name area: project names (typically associated with test objects) can be customized.
Test platform area: and filling in the name of the test platform and the path of the test case file.
A calibration value area: and filling calibration variables in the release software.
Result variable region: and filling variables in the expected test result in the test case.
Loading a program area: and loading a test program.
Test sequence region: and filling in the serial number of the test case.
The sequence structure of the test script mainly comprises: a test step area and a print result area.
The test steps of the test script mainly comprise: the method comprises the steps of testing a time zone, reading a test result zone and comparing an actual test result with an expected test result zone.
FIG. 6 shows an engineering structure of a test script. By setting the test script generation rule, the test cases generate the test script according to the same rule, so that the consistency of the test script is enhanced.
According to the embodiment of the invention, the test case and the variable library are loaded through the generation interface of the test script, so that the loading process is more convenient; the test case is generated through the test case template, so that the consistency of the test case is ensured, and the readability and the reusability of the generated test script are enhanced.
EXAMPLE III
Referring to fig. 7, an embodiment of the present invention provides a device for generating a test script, including:
a loading module 701, configured to: loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable;
a generating module 702 configured to: and generating a test script by adopting a test script generation rule according to the test case and the variable library.
Optionally, the test case data at least includes a test case serial number, a test case calibration value, a test case variable, a test step, and/or a test expected result.
Optionally, the test case variables at least include a system initialization variable, a message variable, and/or a subsystem variable.
Optionally, before loading the test cases and the variable library, the apparatus further includes a display module, configured to: and displaying a generation interface of the test script, wherein the generation interface is used for loading the test case and the variable library.
Optionally, the test script generation rule at least includes: an engineering structure of the test script, a sequence structure of the test script and/or a test step of the test script.
Optionally, the test case is generated by a test case template into which test case data is input.
The foregoing is considered as illustrative only of the principles and preferred embodiments of the invention. It should be noted that, for those skilled in the art, several other modifications can be made on the basis of the principle of the present invention, and the protection scope of the present invention should be regarded.
Claims (8)
1. A method for generating a test script, comprising:
loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable;
generating a test script by adopting a test script generation rule according to the test case and the variable library;
the test script generation rule at least comprises: testing the engineering structure of the test script, the sequence structure of the test script and/or the test script;
the engineering structure of the test script comprises: the system comprises an engineering name area, a test platform area, a calibration value area, a result variable area, a loading program area and a test sequence area; the sequence structure of the test script comprises: a test step area and a print result area; the testing step of the test script comprises the following steps: testing the time zone, reading the test result zone and comparing the actual test result with the expected test result zone;
the test case is generated by a test case template into which the test case data is input, and the test case template comprises a case sequence number area, a case calibration area, a variable area, an action area and an expected result area.
2. The method for generating a test script according to claim 1,
the test case data at least comprises a test case serial number, a test case calibration value, a test case variable, a test step and/or a test expected result.
3. The method for generating a test script according to claim 1,
the test case variables at least comprise system initialization variables, message variables and/or subsystem variables.
4. The method for generating a test script according to claim 1,
before the loading the test cases and the variable libraries, the method further comprises: and displaying a generation interface of the test script, wherein the generation interface is used for loading the test case and the variable library.
5. An apparatus for generating a test script, comprising:
a loading module to: loading a test case and a variable library, wherein the test case comprises at least one test case data, and the variable library comprises at least one test case variable;
a generation module to: generating a test script by adopting a test script generation rule according to the test case and the variable library;
the test script generation rule at least comprises: testing the engineering structure of the test script, the sequence structure of the test script and/or the test script;
the engineering structure of the test script comprises: the system comprises an engineering name area, a test platform area, a calibration value area, a result variable area, a loading program area and a test sequence area; the sequence structure of the test script comprises: a test step area and a print result area; the testing step of the test script comprises the following steps: testing the time zone, reading the test result zone and comparing the actual test result with the expected test result zone;
the test case is generated by a test case template into which the test case data is input, and the test case template comprises a case sequence number area, a case calibration area, a variable area, an action area and an expected result area.
6. The apparatus for generating a test script according to claim 5,
the test case data at least comprises a test case serial number, a test case calibration value, a test case variable, a test step and/or a test expected result.
7. The apparatus for generating a test script according to claim 5,
the test case variables at least comprise system initialization variables, message variables and/or subsystem variables.
8. The apparatus for generating a test script according to claim 5,
before the test case and the variable library are loaded, the apparatus further includes a display module, configured to: and displaying a generation interface of the test script, wherein the generation interface is used for loading the test case and the variable library.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710154209.7A CN106874209B (en) | 2017-03-15 | 2017-03-15 | Test script generation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710154209.7A CN106874209B (en) | 2017-03-15 | 2017-03-15 | Test script generation method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106874209A CN106874209A (en) | 2017-06-20 |
CN106874209B true CN106874209B (en) | 2021-03-09 |
Family
ID=59171283
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710154209.7A Active CN106874209B (en) | 2017-03-15 | 2017-03-15 | Test script generation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106874209B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111045417B (en) * | 2019-12-24 | 2023-05-12 | 一汽解放汽车有限公司 | Dynamic scheduling control method for offline detection tasks of various new energy vehicles |
CN113077735B (en) * | 2020-01-06 | 2023-11-17 | 广州汽车集团股份有限公司 | Test method, device and system of vehicle-mounted display equipment |
CN114003512B (en) * | 2021-12-30 | 2022-05-13 | 卡斯柯信号(北京)有限公司 | Method and device for generating script based on train automatic control integrated verification platform |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102446090A (en) * | 2010-10-09 | 2012-05-09 | 金蝶软件(中国)有限公司 | Method and device for automatically generating test script |
CN103186460A (en) * | 2011-12-30 | 2013-07-03 | 金蝶软件(中国)有限公司 | Method, device and system for generating script of test case |
CN103365661A (en) * | 2013-07-11 | 2013-10-23 | 盛科网络(苏州)有限公司 | Development method and system for automatic testing scripts |
US9047414B1 (en) * | 2011-03-15 | 2015-06-02 | Symantec Corporation | Method and apparatus for generating automated test case scripts from natural language test cases |
-
2017
- 2017-03-15 CN CN201710154209.7A patent/CN106874209B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102446090A (en) * | 2010-10-09 | 2012-05-09 | 金蝶软件(中国)有限公司 | Method and device for automatically generating test script |
US9047414B1 (en) * | 2011-03-15 | 2015-06-02 | Symantec Corporation | Method and apparatus for generating automated test case scripts from natural language test cases |
CN103186460A (en) * | 2011-12-30 | 2013-07-03 | 金蝶软件(中国)有限公司 | Method, device and system for generating script of test case |
CN103365661A (en) * | 2013-07-11 | 2013-10-23 | 盛科网络(苏州)有限公司 | Development method and system for automatic testing scripts |
Also Published As
Publication number | Publication date |
---|---|
CN106874209A (en) | 2017-06-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112270149B (en) | Verification platform automatic integration method and system, electronic equipment and storage medium | |
CN106874209B (en) | Test script generation method and device | |
US20170132345A1 (en) | Dynamically Loaded System-Level Simulation | |
CN103180834B (en) | Automatic operation system test frame | |
US20080276225A1 (en) | Testing Executable Logic | |
CN110007921B (en) | Code publishing method and device | |
JP2003330748A (en) | Method and apparatus for generating electronic test program and data structure | |
US9058427B2 (en) | Iterative generation of symbolic test drivers for object-oriented languages | |
CN112631618A (en) | Application program packaging method, application program testing method, terminal and storage medium | |
CN107797805B (en) | Code packaging method and device and computer readable storage medium | |
CN109634648B (en) | Method and device for rapidly switching SDK network interface environment | |
CN113094252B (en) | Test case generation method and device, computer equipment and storage medium | |
CN113157508A (en) | Test method, system, device, equipment and storage medium of embedded system | |
CN117330935A (en) | Integrated circuit testing method, device and medium | |
CN112748905B (en) | Method and device for initializing and calling basic library, electronic equipment and storage medium | |
CN117270864A (en) | Code compiling method, device, equipment and storage medium | |
CN111240678A (en) | Setting method and device of pop-up window, electronic equipment and storage medium | |
US20130061206A1 (en) | Automatically generating executable code for a test sequence | |
US20220413815A1 (en) | Reload ordering for executable code modules | |
CN114546823B (en) | Method for reproducing debug scenario of logic system design and related equipment | |
CN115168232A (en) | Testing method and device based on AUTOSAR platform, electronic equipment and storage medium | |
CN106682249B (en) | Model-independent universal publish/subscribe interface test system and method | |
CN111444618B (en) | Simulation method and device based on variable dictionary | |
CN104809061A (en) | Regression testing method and device | |
CN112306844B (en) | Interface test method, device and equipment of software development system 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 |