CN109710537B - Intelligent automatic testing method and system - Google Patents
Intelligent automatic testing method and system Download PDFInfo
- Publication number
- CN109710537B CN109710537B CN201910001191.6A CN201910001191A CN109710537B CN 109710537 B CN109710537 B CN 109710537B CN 201910001191 A CN201910001191 A CN 201910001191A CN 109710537 B CN109710537 B CN 109710537B
- Authority
- CN
- China
- Prior art keywords
- test
- interface
- environment
- control
- 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.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 204
- 238000000034 method Methods 0.000 claims abstract description 29
- 238000010998 test method Methods 0.000 claims abstract description 7
- 238000004140 cleaning Methods 0.000 claims description 38
- 230000002159 abnormal effect Effects 0.000 claims description 4
- 230000000977 initiatory effect Effects 0.000 claims 1
- 238000004806 packaging method and process Methods 0.000 description 4
- 238000012546 transfer Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Abstract
The invention provides an intelligent automatic test method and a system, wherein the method comprises the following steps: s1, generating an interface test calling template; s2, compiling an automatic test script according to the interface test calling template; s3, compiling unit module codes according to the automatic test script; and S4, starting an automatic test script, and testing the code of each unit module through an interface. The system comprises an interface test calling template generating unit, an automatic test script compiling unit, a unit module code compiling unit and a test unit.
Description
Technical Field
The invention belongs to the field of cloud computing development and testing, and particularly relates to an intelligent automatic testing method and system.
Background
DTO, a Data Transfer Object for short, is a Data Transfer Object, and is a software application system for transferring Data between design modes. Often the data transfer objective is for a data access object to retrieve data from a database. The difference between a data transfer object and a data interaction object or data access object is that the data has no action other than storing and retrieving.
In the information era, intelligent and mechanized application is more and more common, and the proportion of the automatic test in the software test is more and more increased as an important measurement index of the software test working quality, so that the automatic test work needs to be continuously improved and perfected, and the requirements of larger and larger software scale and higher quality requirement are met.
In the process of software development, unit testing and automatic testing are carried out synchronously, so that the quality of software is greatly improved, but because the correctness of an interface needs to be tested through a plurality of testing dimensions such as boundary values, equivalence, cause and effect and the like in the software testing, a plurality of repeated workloads are brought in the automatic compiling process.
Therefore, it is very necessary to provide an intelligent automatic testing method and system for the above mentioned drawbacks in the prior art.
Disclosure of Invention
The invention aims to provide an intelligent automatic test method and system aiming at the defects that the unit test and the automatic test are carried out synchronously, the correctness of a multi-test dimension test interface is required in the software test, and a lot of repeated work is caused in the automatic test, so as to solve the technical problems.
In order to achieve the purpose, the invention provides the following technical scheme:
an intelligent automatic test method comprises the following steps:
s1, generating an interface test calling template;
s2, compiling an automatic test script according to the interface test calling template;
s3, compiling unit module codes according to the automatic test script;
and S4, starting an automatic test script, and testing the code of each unit module through an interface. The unit test and the automatic test are carried out synchronously, the unit test uses a test driver to develop a TDD framework, unit module codes are compiled through an automatic test script, the correctness of a certain function of the unit module is concerned, and meanwhile, code verification is carried out after the unit module codes are finished.
Further, the step S1 specifically includes the following steps:
s11, classifying the controls;
and S12, generating an interface test calling template according to the interface method of each control type.
Further, in step S2, the interface test invocation template is adjusted according to the actual situation of each control type, and an automated test script is generated. The interface test calling templates are screened and sorted according to the actual condition of each control type to generate an automatic test script, so that repeated work is greatly reduced, the interface test templates only need to be written at different positions, and the test efficiency and the test quality are improved.
Further, the control types comprise a textbox type control, a numeric type control and a virtual machine type control;
in step S12, generating a corresponding interface method according to the attribute of the textbox type control; the attributes of the textbox type control comprise text special character limitation, text length limitation and text empty character limitation;
generating a corresponding interface method according to the digital class control attribute; the digital class control attribute comprises a boundary value test and a special value test;
generating a corresponding interface method according to the attributes of the virtual machine type control; the attributes of the virtual machine type control comprise starting up, shutting down and abnormal states. Each type of control is used as an interface, the testing methods are different, and a corresponding interface method is generated according to the characteristics of the corresponding control.
Further, in step S12, an interface test calling template is generated according to the interface method of each control type and the calling frequency of the control.
Further, in step S12, when the calling frequency of the control is greater than the set frequency threshold, performing DTO function packaging on the control, and configuring initial data for the control. For the control types with frequent calling, the object with initial data can be directly called during test calling, so that the operation of assigning an initial value is reduced, and the test efficiency is improved.
Further, step S1 is preceded by the following steps:
S1A, generating an environment initialization module;
S1B, generating an environment cleaning module;
in step S2, compiling an automatic test script according to the interface test calling template, the environment initialization module and the environment cleaning module;
the step S4 includes the following steps:
s41, starting an automatic test script;
s42, initializing a test environment by an environment initialization module;
s43, testing the code of each unit module through an interface;
and S44, cleaning the test environment by the environment cleaning module, and recovering the state of the test environment before testing. Initializing a test environment for packaging, and directly calling during automatic test to ensure that the environment basic configuration is completed when the test environment enters an automatic test script;
the environment cleaning is packaged, and when the automatic test is finished, the environment cleaning is directly called, so that the test environment is completely cleaned to the state before the test when the test environment exits the automatic test script; the test time is saved, and the test efficiency is improved.
The invention also provides the following technical scheme:
an intelligent automatic test system comprises
The interface test calling template generating unit is used for generating an interface test calling template;
the automatic test script compiling unit is used for compiling an automatic test script according to the interface test calling template;
the unit module code compiling unit is used for compiling the unit module codes according to the automatic test script;
and the test unit is used for starting the automatic test script and testing each unit module code through the interface.
Furthermore, the interface test calling template generating unit comprises a control classification subunit and an interface test calling template generating subunit;
the control classifying subunit is used for classifying the controls;
and the interface test calling template generating subunit is used for generating an interface test calling template according to the interface method of each control type.
Further, the system also comprises an environment initialization module generation unit and an environment cleaning module generation unit;
an environment initialization module generation unit for generating an environment initialization module;
the environment cleaning module generating unit is used for generating an environment cleaning module;
the automatic test script compiling unit compiles an automatic test script according to the interface test calling template, the environment initialization module and the environment cleaning module;
the test unit comprises a test promoter unit, an environment initialization subunit, a test subunit and an environment cleaning subunit;
the test starting subunit is used for starting the automatic test script;
the environment initialization subunit is used for initializing the test environment through the environment initialization module;
the test subunit is used for testing each unit module code through the interface;
and the environment cleaning subunit is used for cleaning the test environment through the environment cleaning module and recovering the state of the test environment before testing.
The invention has the beneficial effects that:
the invention greatly reduces the repetition when compiling the automatic test script by packaging and inheriting the universal interface method of the same type of interface, and effectively improves the test efficiency and the working quality.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Therefore, compared with the prior art, the invention has prominent substantive features and remarkable progress, and the beneficial effects of the implementation are also obvious.
Drawings
FIG. 1 is a first flowchart of a method of the present invention;
FIG. 2 is a flow chart of a method of the present invention;
FIG. 3 is a schematic diagram of the system of the present invention;
wherein, 1-interface test calls the template generating element; 1.1-control classification subunit; 1.2-interface test calling template generating subunit; 2-an automatic test script compiling unit; 3-unit module code compiling unit; 4-a test unit; 4.1-test promoter unit; 4.2-Environment initialization subunit; 4.3-test subunit; 4.4-environmental cleanup subunit; 5-an initialization module generation unit; 6-environment cleaning module generation unit.
The specific implementation mode is as follows:
in order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
Example 1:
as shown in fig. 1, the present invention provides an intelligent automatic testing method, which comprises the following steps:
s1, generating an interface test calling template;
s2, compiling an automatic test script according to the interface test calling template;
s3, compiling unit module codes according to the automatic test script;
and S4, starting an automatic test script, and testing the code of each unit module through an interface.
Example 2:
as shown in fig. 2, the present invention provides an intelligent automatic testing method, which comprises the following steps:
S1A, generating an environment initialization module;
S1B, generating an environment cleaning module;
s11, classifying the controls;
s12, generating an interface test calling template according to the interface method of each control type;
s2, compiling an automatic test script according to the interface test calling template, the environment initialization module and the environment cleaning module;
s3, compiling unit module codes according to the automatic test script;
s41, starting an automatic test script;
s42, initializing a test environment by an environment initialization module;
s43, testing the code of each unit module through an interface;
and S44, cleaning the test environment by the environment cleaning module, and recovering the state of the test environment before testing.
In the above embodiment 2, in step S2, the interface test invocation template is adjusted according to the actual situation of each control type, so as to generate an automated test script.
In the above embodiment 2, the control types include a textbox type control, a numeric type control, and a virtual machine type control;
in step S12, generating a corresponding interface method according to the attribute of the textbox type control; the attributes of the textbox type control comprise text special character limitation, text length limitation and text empty character limitation;
generating a corresponding interface method according to the digital class control attribute; the digital class control attribute comprises a boundary value test and a special value test;
generating a corresponding interface method according to the attributes of the virtual machine type control; the attributes of the virtual machine type control comprise starting up, shutting down and abnormal states.
In the foregoing embodiment 2, in step S12, an interface test invocation template is generated according to the interface method of each control type and the invocation frequency of the control;
and when the calling frequency of the control is greater than the set frequency threshold, carrying out DTO function packaging on the control, and configuring initial data for the control.
Example 3:
as shown in FIG. 3, the present invention provides an intelligent automated test system, comprising
An interface test call template generation unit 1 for generating an interface test call template; the interface test calling template generating unit 1 comprises a control classification subunit 1.1 and an interface test calling template generating subunit 1.2;
the control classifying subunit 1.1 is used for classifying the controls;
an interface test calling template generating subunit 1.2, configured to generate an interface test calling template according to the interface method of each control type;
the automatic test script compiling unit 2 is used for compiling an automatic test script according to the interface test calling template, the environment initialization module and the environment cleaning module;
the unit module code compiling unit 3 is used for compiling the unit module code according to the automatic test script;
the test unit 4 is used for starting an automatic test script and testing each unit module code through an interface; the test unit 4 comprises a test promoter unit 4.1, an environment initialization subunit 4.2, a test subunit 4.3 and an environment cleaning subunit 4.4;
the test promoter unit 4.1 is used for starting an automatic test script;
the environment initialization subunit 4.2 is used for initializing the test environment through the environment initialization module;
a test subunit 4.3 for testing each unit module code through the interface;
the environment cleaning subunit 4.4 is used for cleaning the test environment through the environment cleaning module and recovering the state of the test environment before testing;
an environment initialization module generation unit 5 for generating an environment initialization module;
and the environment cleaning module generating unit 6 is used for generating an environment cleaning module.
The embodiments of the present invention are illustrative rather than restrictive, and the above-mentioned embodiments are only provided to help understanding of the present invention, so that the present invention is not limited to the embodiments described in the detailed description, and other embodiments derived from the technical solutions of the present invention by those skilled in the art also belong to the protection scope of the present invention.
Claims (7)
1. An intelligent automatic test method is characterized by comprising the following steps:
s1, generating an interface test calling template; the method comprises the following specific steps:
s11, classifying the controls;
s12, generating an interface test calling template according to the interface method of each control type; the control types comprise a text box type control, a digital type control and a virtual machine type control;
in step S12, generating a corresponding interface method according to the attribute of the textbox type control; the attributes of the textbox type control comprise text special character limitation, text length limitation and text empty character limitation;
generating a corresponding interface method according to the digital class control attribute; the digital class control attribute comprises a boundary value test and a special value test;
generating a corresponding interface method according to the attributes of the virtual machine type control; the attributes of the virtual machine type control comprise starting up, shutting down and abnormal states;
s2, compiling an automatic test script according to the interface test calling template;
s3, compiling unit module codes according to the automatic test script;
and S4, starting an automatic test script, and testing the code of each unit module through an interface.
2. The intelligent automatic test method according to claim 1, wherein in step S2, the interface test calling template is adjusted according to the actual situation of each control type to generate an automatic test script.
3. The intelligent automatic test method according to claim 1, wherein in step S12, an interface test calling template is generated according to the interface method of each control type and the calling frequency of the control.
4. The intelligent automation test method of claim 3 wherein in step S12, when the calling frequency of the control is greater than the set frequency threshold, the DTO function package is performed on the control to configure initial data for the control.
5. The intelligent automated testing method of claim 1, wherein step S1 is preceded by the steps of:
S1A, generating an environment initialization module;
S1B, generating an environment cleaning module;
in step S2, compiling an automatic test script according to the interface test calling template, the environment initialization module and the environment cleaning module;
the step S4 includes the following steps:
s41, starting an automatic test script;
s42, initializing a test environment by an environment initialization module;
s43, testing the code of each unit module through an interface;
and S44, cleaning the test environment by the environment cleaning module, and recovering the state of the test environment before testing.
6. An intelligent automatic test system is characterized by comprising
The interface test calling template generating unit (1) is used for generating an interface test calling template; the interface test calling template generating unit (1) comprises a control classification subunit (1.1) and an interface test calling template generating subunit (1.2);
a control classification subunit (1.1) for classifying the controls;
an interface test calling template generating subunit (1.2) for generating an interface test calling template according to the interface method of each control type; the control types comprise a text box type control, a digital type control and a virtual machine type control;
generating a corresponding interface method according to the attribute of the textbox type control; the attributes of the textbox type control comprise text special character limitation, text length limitation and text empty character limitation;
generating a corresponding interface method according to the digital class control attribute; the digital class control attribute comprises a boundary value test and a special value test;
generating a corresponding interface method according to the attributes of the virtual machine type control; the attributes of the virtual machine type control comprise starting up, shutting down and abnormal states;
the automatic test script compiling unit (2) is used for compiling an automatic test script according to the interface test calling template;
the unit module code compiling unit (3) is used for compiling the unit module code according to the automatic test script;
and the test unit (4) is used for starting the automatic test script and testing each unit module code through the interface.
7. The intelligent automated testing system of claim 6, further comprising an environment initialization module generation unit (5) and an environment cleaning module generation unit (6);
an environment initialization module generation unit (5) for generating an environment initialization module;
an environment cleaning module generation unit (6) for generating an environment cleaning module;
the automatic test script compiling unit (2) compiles an automatic test script according to the interface test calling template, the environment initialization module and the environment cleaning module;
the test unit (4) comprises a test promoter unit (4.1), an environment initialization subunit (4.2), a test subunit (4.3) and an environment cleaning subunit (4.4);
a test promoter unit (4.1) for initiating an automated test script;
an environment initialization subunit (4.2) for initializing the test environment by the environment initialization module;
a test subunit (4.3) for testing each unit module code through the interface;
and the environment cleaning subunit (4.4) is used for cleaning the test environment through the environment cleaning module and recovering the state of the test environment before testing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910001191.6A CN109710537B (en) | 2019-01-02 | 2019-01-02 | Intelligent automatic testing method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910001191.6A CN109710537B (en) | 2019-01-02 | 2019-01-02 | Intelligent automatic testing method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109710537A CN109710537A (en) | 2019-05-03 |
CN109710537B true CN109710537B (en) | 2022-02-18 |
Family
ID=66259955
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910001191.6A Active CN109710537B (en) | 2019-01-02 | 2019-01-02 | Intelligent automatic testing method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109710537B (en) |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100487667C (en) * | 2005-12-14 | 2009-05-13 | 中兴通讯股份有限公司 | System and method for automatically testing software unit |
US9141518B2 (en) * | 2008-12-10 | 2015-09-22 | Microsoft Technology Licensing, Llc | GUI testing |
CN103902456B (en) * | 2014-04-09 | 2017-03-15 | 中国工商银行股份有限公司 | Test script processing meanss, system and method |
CN107291608B (en) * | 2016-03-31 | 2021-01-26 | 菜鸟智能物流控股有限公司 | Test script generation method, interface subscription/registration method and device |
CN107391379B (en) * | 2017-07-28 | 2021-01-01 | 武汉斗鱼网络科技有限公司 | Automatic interface testing method and device |
CN107402884A (en) * | 2017-07-31 | 2017-11-28 | 深圳乐信软件技术有限公司 | Generate the method and device of interface testing code |
-
2019
- 2019-01-02 CN CN201910001191.6A patent/CN109710537B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109710537A (en) | 2019-05-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101526919B (en) | Method for generating script files to test Web application software and device thereof | |
CN107368313B (en) | Code detection method, device and electronic equipment | |
CN101060372A (en) | A method and system for rapid creating the automation test script | |
CN111984235A (en) | Customizable front-end low-code development system and method | |
CN100362479C (en) | System and method for testing measured object based on automatic test script | |
CN106484613A (en) | A kind of interface automated test frame based on fitnese | |
CN107179982B (en) | Cross-process debugging method and device | |
CN106354629A (en) | Construction method of iOS system mobile application automatic test system based on multiple stages of servers | |
CN102902526A (en) | Automatic setting method for realizing BMC (Baseboard Management Controller) and IP (Internet Protocol) information through time delay | |
CN109710537B (en) | Intelligent automatic testing method and system | |
CN108614764B (en) | IMA application software fault injection method | |
CN117421217A (en) | Automatic software function test method, system, terminal and medium | |
CN111427582A (en) | Management method, device and equipment of RT L code and computer readable storage medium | |
CN112256569A (en) | Automatic testing method for simultaneous operation of multiple mobile phones based on apium + python | |
CN110334001A (en) | A kind of method and apparatus that batch automatically generates echo test | |
CN110096292B (en) | Method and system for refreshing BIOS firmware of server in self-adaptive manner | |
CN104899122A (en) | Mobile terminal testing system and method | |
CN104424096A (en) | Automatic testing system and method for Android platform based device | |
CN112241268A (en) | Keil engineering compiling method, system and equipment | |
CN112527631A (en) | bug positioning method, system, electronic equipment and storage medium | |
CN112069062A (en) | Method and device for editing and generating software test bug module | |
CN110674923A (en) | Rapid model verification method among multiple neural network frames | |
CN109857636A (en) | A kind of methods and applications positioning App homepage in Android client UI automation process | |
CN112527680B (en) | Project API level full-link automatic test method and system based on Fitnesse framework | |
CN111290938A (en) | Android semi-automatic testing method based on manual assistance |
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 |