CN112015638A - Automatic testing method and system - Google Patents

Automatic testing method and system Download PDF

Info

Publication number
CN112015638A
CN112015638A CN202010752356.6A CN202010752356A CN112015638A CN 112015638 A CN112015638 A CN 112015638A CN 202010752356 A CN202010752356 A CN 202010752356A CN 112015638 A CN112015638 A CN 112015638A
Authority
CN
China
Prior art keywords
test
execution
script
suite
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.)
Pending
Application number
CN202010752356.6A
Other languages
Chinese (zh)
Inventor
奚菲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Leifeng Electronic Technology Co ltd
Original Assignee
Xi'an Leifeng Electronic Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xi'an Leifeng Electronic Technology Co ltd filed Critical Xi'an Leifeng Electronic Technology Co ltd
Priority to CN202010752356.6A priority Critical patent/CN112015638A/en
Publication of CN112015638A publication Critical patent/CN112015638A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The invention belongs to the field of automatic testing, and discloses an automatic testing method and system. The system comprises a template test script library for providing a plurality of test scripts; the test suite loading module is used for loading a plurality of test cases obtained by the test script scheduling module into the test suite according to a second execution sequence to obtain a test suite to be tested; the test script scheduling module is used for acquiring a plurality of test cases, and each test case comprises a test script required to be executed, a test script execution parameter and a first execution sequence between the test scripts required to be executed; the test execution module is used for calling the test script library to obtain a test script combination required by each test case, executing each test case in the test suite to be tested obtained by the test suite loading module according to a second execution sequence, and returning prompt information of an execution result of each test case to the test case execution module; the test report generation module is used for obtaining the execution result of each test case.

Description

Automatic testing method and system
Technical Field
The invention belongs to the field of automatic testing, and particularly relates to an automatic testing method and system.
Background
The automated testing is developed for several generations, from the first generation recording the input and playing mode of the keyboard through hardware, to the second generation qtp recording the script of the project based on the C/S architecture, to the third generation, with the appearance of the B/S architecture, the Web UI automated testing based on the selenium webdriver framework is derived, although the WebUI automated testing is greatly improved compared with the script recording mode, the disadvantage is exposed when the WebUI automated testing is used in the project practice: aiming at test cases with different functions, a large amount of time and manpower are often consumed to develop a new test script, the test script is not reusable, the maintenance cost is high, the actual test efficiency is lower than expected, the automation degree of an automatic test program is greatly not facilitated, and the flexibility is poor.
Disclosure of Invention
The invention aims to provide an automatic testing method and system, which are used for solving the problems of long development time, high maintenance cost and poor reusability of a testing script in the prior art.
In order to realize the task, the invention adopts the following technical scheme:
an automated testing method, comprising the steps of:
step 1: obtaining a plurality of test cases and test case data files, wherein each test case comprises a plurality of test scripts required to be executed, a first execution sequence among the test scripts required to be executed and execution parameters of the test scripts, and the test case data files comprise prompt information of execution success of each test case;
step 2: establishing a test suite, and loading the obtained multiple test cases into the test suite according to a second execution sequence among the test cases to obtain the test suite to be tested;
and step 3: establishing a template test script library;
and 4, step 4: calling a test script in a template test script library to test the test suite to be tested obtained in the step 2, and obtaining a test report after the test is finished;
calling the test script in the template test script library to test the test suite to be tested obtained in the step 2 means that all test cases are sequentially tested according to a second execution sequence, wherein the test on the test cases in the current execution sequence comprises the following substeps:
step a: calling a template test script library according to the first execution sequence, testing the test cases of the current execution sequence, and obtaining prompt information of the execution result of the current test cases;
step b: comparing the prompt information of the execution result of the current test case with the prompt information of the successful execution of the test case recorded in the test case data file, if the prompt information is consistent and the execution times of the test cases in the current execution sequence are less than N, continuing to test the next test case in the test suite, wherein N is more than 1 and less than 4, and N is a positive integer;
if the test cases are inconsistent and the execution times of the test cases in the current execution sequence are less than N, the steps a to b are repeatedly executed to test the test cases in the current execution sequence again until the execution times are equal to N, and the test case in the next execution sequence in the test suite is continuously tested.
Further, the test report includes an execution result of each test case in the test suite to be tested and an execution result of the test suite, the execution result is execution success information or execution failure information, and the execution failure information further includes a failure reason and a failure screenshot.
Furthermore, the template test script library comprises test scripts which can be combined into each test case, and the test scripts comprise a text box input test script, a button click test script, a switch control test script, a search box search test script, a drop-down list selection test script, a check box check test script, a website login test script, a page element capture test script and an upload file test script.
An automatic test system comprises a template test script library, a test suite loading module, a test script scheduling module, a test execution module and a test report module;
the template test script library is used for providing a plurality of test scripts;
the test suite loading module is used for loading a plurality of test cases obtained by the test script scheduling module into the test suite according to a second execution sequence to obtain a test suite to be tested;
the test script scheduling module is used for acquiring a plurality of test cases, wherein each test case comprises a test script required to be executed, a test script execution parameter and a first execution sequence between the test scripts required to be executed;
the test execution module is used for calling the test script library to obtain a test script combination required by each test case, executing each test case in the test suite to be tested obtained by the test suite loading module according to the second execution sequence, and returning the prompt information of the execution result of each test case to the test case execution module, and the test of the test case in the current execution sequence comprises the following substeps:
step a: calling a template test script library according to the first execution sequence, testing the test cases of the current execution sequence, and obtaining prompt information of the execution result of the current test cases;
step b: comparing the prompt information of the execution result of the current test case with the prompt information of the successful execution of the test case recorded in the test case data file, if the prompt information is consistent and the execution times of the test cases in the current execution sequence are less than N, continuing to test the next test case in the test suite, wherein N is more than 1 and less than 4, and N is a positive integer;
if the test cases are inconsistent and the execution times of the test cases in the current execution sequence are less than N, the steps a to b are repeatedly executed to test the test cases in the current execution sequence again until the execution times are equal to N, and the test case in the next execution sequence in the test suite is continuously tested.
The test report generation module is used for obtaining the execution result of each test case.
Further, the test report includes an execution result of each test case in the test suite to be tested and an execution result of the test suite, the execution result is execution success information or execution failure information, and the execution failure information further includes a failure reason and a failure screenshot.
Furthermore, the template test script library comprises test scripts which can be combined into each test case, and the test scripts comprise a text box input test script, a button click test script, a switch control test script, a search box search test script, a drop-down list selection test script, a check box check test script, a website login test script, a page element capture test script and an upload file test script.
Compared with the prior art, the invention has the following technical characteristics:
(1) compared with the existing webUI automatic test method, the method greatly reduces the workload of automatic test script code development of testers, and the testers only need to supplement the test scripts with corresponding functions.
(2) For testers unfamiliar with codes, only corresponding test cases need to be added into a test suite when the system is used, and code writing work is not needed.
Drawings
FIG. 1 is a schematic diagram of an automated testing method;
the flow chart in the embodiment of fig. 2.
Detailed Description
The technical terms appearing in the present invention are explained first:
testing the script: script files written according to operations that need to be executed to test a certain use case, for example: the method comprises the following steps of inputting a test script by a text box, clicking the test script by a button, controlling the test script by a switch, searching the test script by a search box, selecting the test script by a drop-down list, selecting the test script by a selection box, logging in a website test script, capturing a page element test script, uploading a file test script and the like.
Test case: testing a set of operations that a certain functional point needs to perform. And according to the combination, performing sequential combination on the test script files.
Testing the kit: and combining the plurality of test cases according to the execution sequence.
The first execution order: when a test case is executed, the execution sequence of the required test scripts is usually the sequence of the named serial numbers of the test scripts.
The second execution order: when a test suite is executed, the execution sequence of the required test cases is usually the sequence of the named sequence numbers of the test cases.
And prompting information of an execution result: the prompt message is a pop-up window, and if the execution result is successful, the text box in the window displays the prompt message of successful execution, such as "successful execution! If the execution result fails, the text box in the window displays prompt information of failure, such as "failure of execution! ".
The embodiment discloses an automatic testing method, which comprises the following steps:
step 1: obtaining a plurality of test cases and test case data files, wherein each test case comprises a plurality of test scripts required to be executed, a first execution sequence among the test scripts required to be executed and execution parameters of the test scripts, and the test case data files comprise prompt information of execution success of each test case;
step 2: establishing a test suite, and loading the obtained multiple test cases into the test suite according to a second execution sequence among the test cases to obtain the test suite to be tested;
and step 3: establishing a template test script library;
and 4, step 4: calling a test script in a template test script library to test the test suite to be tested obtained in the step 2, and obtaining a test report after the test is finished;
calling the test script in the template test script library to test the test suite to be tested obtained in the step 2 means that all test cases are sequentially tested according to a second execution sequence, wherein the test on the test cases in the current execution sequence comprises the following substeps:
step a: calling a template test script library according to the first execution sequence, testing the test cases of the current execution sequence, and obtaining prompt information of the execution result of the current test cases;
step b: comparing the prompt information of the execution result of the current test case with the prompt information of the successful execution of the test case recorded in the test case data file, if the prompt information is consistent and the execution times of the test cases in the current execution sequence are less than N, continuing to test the next test case in the test suite, wherein N is more than 1 and less than 4, and N is a positive integer;
if the test cases are inconsistent and the execution times of the test cases in the current execution sequence are less than N, the steps a to b are repeatedly executed to test the test cases in the current execution sequence again until the execution times are equal to N, and the test case in the next execution sequence in the test suite is continuously tested.
Preferably, N is 3.
Specifically, the test report includes an execution result of each test case in the test suite to be tested and an execution result of the test suite, and if all test cases in the test condition pass the test, the test suite is executed successfully; if one test case in the test suite fails to be executed, the test suite is the execution failure, the execution result is execution success information or execution failure information, and the execution failure information further comprises failure reasons and failure screenshots.
Specifically, the test script library contains test scripts which can be combined into each test case, and the test scripts comprise a text box input test script, a button click test script, a switch control test script, a search box search test script, a drop-down list selection test script, a check box check test script, a login website test script, a capture page element test script and an upload file test script.
The test script library comprises a plurality of basic unit test scripts, the granularity can set the functions of a single test script according to requirements, and the smaller the granularity is, the more single the function of the test script is, and the higher the reusability, flexibility and combinability are. The structured test script effectively reduces the characteristics of high maintenance cost and poor reusability of the traditional single case test script. The modularized test script can cover more comprehensive functions only by adding test scripts with different functions and expanding a test script library.
Specifically, the test script execution parameter is a parameter that needs to be set when the test script recorded in the test case data file is executed, for example: for the text box to input the test script, the parameters required by the test script are the text contents required to be input.
The embodiment also discloses an automatic test system which comprises a template test script library, a test suite loading module, a test script scheduling module, a test execution module and a test report module;
the template test script library is used for providing a plurality of test scripts, each test script can be combined at will, the test work of one test case is realized through different combinations, and the test script library can be enriched continuously to support the execution of the test work of variable test cases;
the test suite loading module is used for loading a plurality of test cases obtained by the test script scheduling module into the test suite according to a second execution sequence to obtain a test suite to be tested;
the test script scheduling module is used for acquiring a plurality of test cases, wherein each test case comprises a test script required for execution, a test script execution parameter and a test script execution sequence;
the test execution module is used for calling the test script library to obtain a test script combination required by each test case, executing each test case in the test suite to be tested obtained by the test suite loading module, and returning prompt information of an execution result of each test case to the test case execution module;
the test report generation module is used for summarizing the execution result of each test case. The module presents the test results in a visual form. And finally, arranging the test reports into a test report with a unified structure, wherein the test report records the execution result of each case in detail, including the specific reason of the execution failure of the test case, the screenshot of the execution failure and the like.
Specifically, the file structure format of the test case data adopts a json/xml data format, and the test case data such as parameters required by test case execution, a test case execution sequence, a test script combination sequence required by each test case, an application return prompt for successful execution of each test case and the like are recorded.
Example 1
Fig. 2 shows an automated testing method disclosed in this embodiment, and the testing suite is used to implement a search for keywords in a search engine.
On the basis of the above embodiments, the present embodiment discloses the following technical features:
the test kit 1 comprises a test case 1 and a test case 2; the test case 1 is 'search automation test in hundred degrees' and the test case 2 'searches webdriver in hundred degrees';
the test case 1 comprises a test script 1 of inputting www.baidu.com in a browser address bar and a test script 2 of inputting an automated test in a Baidu search box, and the test case 2 comprises a test script 1 of inputting www.baidu.com in a browser address bar and a test script 2 of inputting webdriver in a Baidu search box;
the first execution sequence is the label sequence of the test script; the second execution sequence is the label sequence of the test case.

Claims (6)

1. An automated testing method is characterized by comprising the following steps:
step 1: obtaining a plurality of test cases and test case data files, wherein each test case comprises a plurality of test scripts required to be executed, a first execution sequence among the test scripts required to be executed and execution parameters of the test scripts, and the test case data files comprise prompt information of execution success of each test case;
step 2: establishing a test suite, and loading the obtained multiple test cases into the test suite according to a second execution sequence among the test cases to obtain the test suite to be tested;
and step 3: establishing a template test script library;
and 4, step 4: calling a test script in a template test script library to test the test suite to be tested obtained in the step 2, and obtaining a test report after the test is finished;
calling the test script in the template test script library to test the test suite to be tested obtained in the step 2 means that all test cases are sequentially tested according to a second execution sequence, wherein the test on the test cases in the current execution sequence comprises the following substeps:
step a: calling a template test script library according to the first execution sequence, testing the test cases of the current execution sequence, and obtaining prompt information of the execution result of the current test cases;
step b: comparing the prompt information of the execution result of the current test case with the prompt information of the successful execution of the test case recorded in the test case data file, if the prompt information is consistent and the execution times of the test cases in the current execution sequence are less than N, continuing to test the next test case in the test suite, wherein N is more than 1 and less than 4, and N is a positive integer;
if the test cases are inconsistent and the execution times of the test cases in the current execution sequence are less than N, the steps a to b are repeatedly executed to test the test cases in the current execution sequence again until the execution times are equal to N, and the test case in the next execution sequence in the test suite is continuously tested.
2. The automated testing method of claim 1, wherein the test report includes an execution result of each test case in the test suite to be tested and an execution result of the test suite, the execution result is execution success information or execution failure information, and the execution failure information further includes a failure reason and a failure screenshot.
3. The automated testing method of claim 1, wherein the template test script library contains test scripts that can be combined into each test case, including a text box input test script, a button click test script, a switch control test script, a search box search test script, a drop down list selection test script, a check box check test script, a log in website test script, a capture page element test script, and an upload file test script.
4. An automatic test system is characterized by comprising a template test script library, a test suite loading module, a test script scheduling module, a test execution module and a test report module;
the template test script library is used for providing a plurality of test scripts;
the test suite loading module is used for loading a plurality of test cases obtained by the test script scheduling module into the test suite according to a second execution sequence to obtain a test suite to be tested;
the test script scheduling module is used for acquiring a plurality of test cases, wherein each test case comprises a test script required to be executed, a test script execution parameter and a first execution sequence between the test scripts required to be executed;
the test execution module is used for calling the test script library to obtain a test script combination required by each test case, executing each test case in the test suite to be tested obtained by the test suite loading module according to the second execution sequence, and returning the prompt information of the execution result of each test case to the test case execution module, and the test of the test case in the current execution sequence comprises the following substeps:
step a: calling a template test script library according to the first execution sequence, testing the test cases of the current execution sequence, and obtaining prompt information of the execution result of the current test cases;
step b: comparing the prompt information of the execution result of the current test case with the prompt information of the successful execution of the test case recorded in the test case data file, if the prompt information is consistent and the execution times of the test cases in the current execution sequence are less than N, continuing to test the next test case in the test suite, wherein N is more than 1 and less than 4, and N is a positive integer;
if the test cases are inconsistent and the execution times of the test cases in the current execution sequence are less than N, the steps a to b are repeatedly executed to test the test cases in the current execution sequence again until the execution times are equal to N, and the test case in the next execution sequence in the test suite is continuously tested.
The test report generation module is used for obtaining the execution result of each test case.
5. The automated testing system of claim 4, wherein the test report includes an execution result of each test case in the test suite to be tested and an execution result of the test suite, the execution result is execution success information or execution failure information, and the execution failure information further includes a failure reason and a failure screenshot.
6. The automated test system of claim 4, wherein the template test script library contains test scripts that can be combined into each test case, including a text box input test script, a button click test script, a switch control test script, a search box search test script, a drop down list selection test script, a check box check test script, a log in website test script, a capture page element test script, and an upload file test script.
CN202010752356.6A 2020-07-30 2020-07-30 Automatic testing method and system Pending CN112015638A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010752356.6A CN112015638A (en) 2020-07-30 2020-07-30 Automatic testing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010752356.6A CN112015638A (en) 2020-07-30 2020-07-30 Automatic testing method and system

Publications (1)

Publication Number Publication Date
CN112015638A true CN112015638A (en) 2020-12-01

Family

ID=73500152

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010752356.6A Pending CN112015638A (en) 2020-07-30 2020-07-30 Automatic testing method and system

Country Status (1)

Country Link
CN (1) CN112015638A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836042A (en) * 2021-11-18 2021-12-24 四川启睿克科技有限公司 Web automated testing framework system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536593A (en) * 2018-04-02 2018-09-14 泰华智慧产业集团股份有限公司 CS Framework Softwares automated testing method based on UI and system
US20190129833A1 (en) * 2017-10-27 2019-05-02 EMC IP Holding Company LLC Method, device and computer program product for executing test cases
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190129833A1 (en) * 2017-10-27 2019-05-02 EMC IP Holding Company LLC Method, device and computer program product for executing test cases
CN108536593A (en) * 2018-04-02 2018-09-14 泰华智慧产业集团股份有限公司 CS Framework Softwares automated testing method based on UI and system
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836042A (en) * 2021-11-18 2021-12-24 四川启睿克科技有限公司 Web automated testing framework system

Similar Documents

Publication Publication Date Title
CN110851356B (en) Selenium-based Web application automatic test framework and construction method and system thereof
CN101339534B (en) Software test apparatus and test method
US6061643A (en) Method for defining durable data for regression testing
US8881105B2 (en) Test case manager
US6301701B1 (en) Method for computer-assisted testing of software application components
Marchetto et al. A case study-based comparison of web testing techniques applied to AJAX web applications
CN101025686A (en) Automation test system and test script generating and operating method
CN110716870A (en) Automatic service testing method and device
CN108536593A (en) CS Framework Softwares automated testing method based on UI and system
CN112732579B (en) Automatic test method and system for WebUI
CN110908894B (en) Visual report tool automatic testing method and device based on vuex
US11615018B2 (en) Automation testing tool framework
Hanna et al. A review of scripting techniques used in automated software testing
CN115658529A (en) Automatic testing method for user page and related equipment
CN112015638A (en) Automatic testing method and system
CN107704389B (en) Page testing method and device
Liu et al. A maintainability spreadsheet-driven regression test automation framework
CN109144867B (en) Test method and test system
CN111966575A (en) Graphic automation test method for airborne display software
CN110543424B (en) Test method and device for electronic tax platform
CN112817863A (en) AI auxiliary automatic test method and system based on AI deep learning
CN112069062A (en) Method and device for editing and generating software test bug module
CN111078193A (en) Software development method and system for data analysis system
CN116185879B (en) Python-based intelligent cabin instrument automatic test method and system
Wu et al. Keyword-driven testing framework for android applications

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201201