CN108446229A - A kind of automated testing method and device - Google Patents

A kind of automated testing method and device Download PDF

Info

Publication number
CN108446229A
CN108446229A CN201810214688.1A CN201810214688A CN108446229A CN 108446229 A CN108446229 A CN 108446229A CN 201810214688 A CN201810214688 A CN 201810214688A CN 108446229 A CN108446229 A CN 108446229A
Authority
CN
China
Prior art keywords
test
test case
user terminal
module
server
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
CN201810214688.1A
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201810214688.1A priority Critical patent/CN108446229A/en
Publication of CN108446229A publication Critical patent/CN108446229A/en
Pending legal-status Critical Current

Links

Classifications

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

Landscapes

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

Abstract

The present invention relates to a kind of automated testing method and device, which includes:The test method includes:It is needed and public business function common api, structure test case according to operation;Wherein, operational requirements include:Click, screen sliding, dragging, long-press and sectional drawing;The test operation request sent according to user terminal, obtains test operation and asks corresponding test case;Corresponding test case is asked according to test operation, the Front End to be measured in user terminal is tested.Test case is write by common api so that different user terminals can be tested using unified test frame, can effectively be reduced use-case and be write cost, meet Test Engineer in terms of automatic test the needs of.

Description

Automatic testing method and device
Technical Field
The invention relates to the technical field of testing, in particular to an automatic testing method and device.
Background
With the development of the internet and the popularization of mobile phone products, a variety of terminal types such as android, ios, wap, pc appear, and the automated test framework on these terminals is also a variety of types. The frames can meet the requirement of automatic testing of each end, but the current internet products generally support various end types, each end uses different testing frames, different apis need to be mastered, and the learning cost is high.
The conventional multi-terminal automated testing approach mainly uses different testing frameworks, and these frameworks only provide implementations of basic functions, such as clicking, sliding, and have no unified application programming interface (api) of a business scenario.
The problems existing in the prior art are that:
1. the related frames are more, and the multi-terminal automatic test can be realized only by mastering various frames;
2. currently existing frameworks generally provide basic operations without a unified api for the business scenario.
The test case transplanting cost is high, and because the iteration of the internet product is fast, the automatic test case needs to be frequently modified.
Disclosure of Invention
The present invention is directed to an automated testing method and apparatus for solving the above-mentioned problems of the prior art.
In order to achieve the above object, the technical solution of the present invention is an automated testing method, including: constructing a test case according to operation requirements and a common business function common api; wherein the operational requirements include: clicking, sliding a screen, dragging, long-pressing and screenshot; acquiring a test case corresponding to a test operation request according to the test operation request sent by a user terminal; and testing the front-end program to be tested in the user terminal according to the test case corresponding to the test operation request.
Optionally, the step of constructing the test case according to the operation requirement and the common business function common api specifically includes: acquiring operation requirements; packaging operation requirements; and constructing a test case according to the operation requirement of the package and common api.
Optionally, after the step of constructing the test case according to the operation requirement and the common business function common api, the method further includes: and storing the test case.
Optionally, after the test is completed, a test report is generated.
The embodiment of the invention provides an automatic testing device, which comprises: the system comprises a construction module, an acquisition module and a test module; the building module is used for building a test case according to operation needs and a common business function common api; wherein the operational requirements include: clicking, sliding a screen, dragging, long-pressing and screenshot; the acquisition module is used for acquiring a test case corresponding to the test operation request according to the test operation request sent by the user terminal; and the test module is used for testing the front-end program to be tested in the user terminal according to the test case corresponding to the test operation request.
Optionally, the building block is specifically configured to: acquiring operation requirements; packaging operation requirements; and constructing a test case according to the operation requirement of the package and common api.
Optionally, the testing apparatus further includes: a storage module; and the storage module is used for storing the test case.
Optionally, the testing apparatus further includes: a generation module; a generation module to: when the test is completed, a test report is generated.
The invention has the following advantages:
the invention integrates the previous different frames used by each operating system into a unified frame used by each operating system, thereby effectively reducing the cost of case compiling and meeting the requirements of test engineers in the aspect of automatic testing.
Drawings
Fig. 1 is a schematic structural diagram of a test frame according to an embodiment of the present invention.
Fig. 2 is a flowchart of an automated testing method according to an embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an automatic testing apparatus according to an embodiment of the present invention.
Fig. 4 is a comparison of the present invention with the prior art.
Detailed Description
The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Example 1
Fig. 1 is a schematic structural diagram of a test frame according to an embodiment of the present invention. As shown in fig. 1, the Totoro on the left side is the automatic testing framework of the present invention, and the agent, Server and various terminals are used in cooperation on the right side.
The automated test framework of the present invention comprises: a basic operation layer (basecommon), a business logic layer (common api), a test case layer, a custom JUnit module and a Utils module.
Wherein, basic operation layer (basecommon): the method comprises the implementation of basic operations of all terminals, such as clicking, screen sliding, screenshot, picture comparison and the like.
Business logic layer (common api): and abstracting the service logic of each product at each end, and using a unified common api. For example, the api corresponding to the click bar advertisement is clickAD, the characteristics of each end do not need to be considered when the automatic test case is written, and the api can be directly used when the click bar advertisement is involved.
In the prior art, an Android test case (testcase), an ios testcase, a PC testcase, and a WAPtestcase are written by api corresponding to an Android port, an ios port, a PC port, and a WAP port, respectively. In the embodiment of the invention, the Android test case (testcase), the ios testcase, the PC testcase and the WAP testcase are compiled by unified api (as shown in figure 4).
Test case layer: the automatic test case comprises android, ios, pc and wap, and is assembled through uniform api in a business logic layer.
Specifically, the automatic test cases of the Android terminal, the ios terminal, the PC terminal and the WAP terminal are also compiled by using the api in the service logic layer. For example, clicking on the hand hundred app, the automated test case is implemented as follows:
1)common.launchApp(“shoubai”);
2)common.enterFeed();
3)common.clickAD(7);
4)common.checkLPExist();
since internet products iterate very quickly, test cases that might run through yesterday fail to execute on today's version. The advantage of this design is that each end uses a unified api, and when the product style or function is upgraded, we only need to adapt the corresponding api in the service logic layer. For example, a new requirement is added to the product, the file of the clicked label when entering the Feed page is changed from the original 'recommendation' to the 'top line', and if the unified api is not used, the test cases at all ends need to be modified once. And we only need to modify common.
Self-defining a Junit module: and controlling the test sequence, such as downloading an installation package from jenkins, acting the mobile phone to an offline server, circularly executing test cases and the like before testing.
Utils module: the method comprises the functions of log capture, ios re-signature, configuration reading, case identification, test report generation and the like.
The right side in fig. 1 is an agent tool, a Server and various terminals which are used in a matched manner; webdriver is an open-source automatic test framework for PC test; the Apium Server is an open source automatic test framework for a mobile terminal, and an Apium server is a server terminal of the Appium and is used for receiving commands sent by an Appium client and sending the commands to a user terminal; PCBrowser, namely a PC end browser; mobile WEB, content accessed by browser on Mobile phone end; ServerStub: pile data of the server; mitmpproxy: the proxy service for opening the source is matched with the Serverstub to be used for returning data from the mock server; joint debugging environment (here subsequently changed to test environment): and the server-side environment is set up by a test engineer and used for testing.
In the embodiment of the invention, each end adopts a unified common api to compile the test case, and the method has the characteristics of cross-platform, cross-process, high transplanting efficiency and the like.
Example 2
Fig. 2 is a flowchart of an automated testing method according to an embodiment of the present invention. As shown in fig. 2, the test method may include the steps of:
step S201: the server constructs a test case according to operation needs and a common business function common api; the operation needs to comprise clicking, screen sliding, dragging, long pressing and screenshot;
specifically, the server obtains operation needs; and then, constructing a test case according to the operation requirement of the package and common api.
After the test case is constructed, the server stores the constructed test case; the test case stored in the server is used for detecting the application programs in the user terminal, for example, the application programs of the Android terminal and the ios terminal are checked, and the webpages of the pc terminal and the wap terminal are detected.
It should be noted that the test cases for testing the application programs on the Android terminal, the ios terminal, the PC terminal, and the WAP terminal are formed by common api splicing, that is, the application programs on various user terminals are tested by the test cases formed by common api splicing.
The server is provided with the automated testing framework shown in fig. 1, and before a test case is constructed, the server can initialize the automated testing framework, obtain starting parameters, environment variables, a starting framework process and the like.
Step S202: and the server acquires a test case corresponding to the test operation request according to the test operation request sent by the user terminal.
If the server needs to test a certain application program in the Android terminal, the server needs to include a user terminal IP address, a user terminal system version number, a package name of the application program, a main interface of the application program, and the like according to a test operation request.
Optionally, the connection between the user terminal and the server may be wired or wireless.
Supposing that the user terminal is wirelessly connected with the server, for example, the Android terminal is connected with the server through a USB data line, after the Android terminal is connected with the server, the server acquires information such as the model of the Android terminal and the IP address of the Android terminal, and then acquires a test case corresponding to the test request according to the test operation request to test the application program on the Android terminal; wherein, the test operation request may not include the user terminal IP address and the user terminal system version number.
However, in a plurality of user terminals (the same or different user terminals), the server is connected to the server, the server cannot obtain information such as user terminal IP addresses and user terminal system version numbers of the plurality of user terminals, the user terminal IP addresses and the user terminal system version numbers can be included in the test operation request, after the plurality of user terminals are respectively connected to the server, the test operation request is transmitted to the server, the server obtains test cases according to the test operation request, and then tests application programs on the corresponding user terminals according to the obtained test cases.
Step S203: and the server tests the front-end program to be tested in the user terminal according to the test case corresponding to the test operation request.
Specifically, when the server acquires the test case corresponding to the test operation request, the server executes the test case to complete testing of the front-end program to be tested in the user terminal.
Optionally, before step S203, the server starts a front-end program to be tested in the user terminal.
It can be understood that the front-end program to be tested may be installed in the user terminal in advance, and the server starts the corresponding front-end program to be tested after connecting with the user terminal. Certainly, the front-end program to be tested may not be installed in the user terminal in advance, and when the test is required, the server may enable the user terminal to install the front-end program to be tested.
And judging whether the test fails according to the test result. For example, when the output result of the test case is inconsistent with the expected result, the current test is determined to fail.
Optionally, if the test fails, the steps S202 to S203 may be executed for multiple times, and if the test still fails after the multiple execution of S202 to S203, the test is not performed again.
Optionally, the front-end program to be tested includes an application program or a Web page. The WAP or Mobile WEB page refers to a Web page opened by a browser on the Android and iOS ends in the invention.
Optionally, after the test is completed, a test report is generated. So that the testing personnel can optimize the front-end program to be tested according to the test report.
The embodiment of the invention provides an automatic test method, which enables different user terminals to use a uniform test framework to test by compiling test cases through common api, can effectively reduce the compilation cost of the cases, and meets the requirements of test engineers in the aspect of automatic test.
Example 3
Fig. 3 is a schematic structural diagram of an automatic testing apparatus according to an embodiment of the present invention. As shown in fig. 3, the test apparatus may include: a building module 301, an obtaining module 302 and a testing module 303. The testing device may be a server. Hereinafter, the description will be given taking the test apparatus as an example of the server.
A building block 301 for: constructing a test case according to operation requirements and a common business function common api; the operation needs to comprise clicking, screen sliding, dragging, long pressing and screenshot;
specifically, the operation needs are obtained first; and then, constructing a test case according to the operation requirement of the package and common api.
After the test case is constructed, the server stores the constructed test case; the test case is used for detecting the application programs in the user terminal, for example, the application programs of an Android end and an ios end are checked, and the webpages of a pc end and a wap end are detected.
It should be noted that the test cases for testing the application programs on the Android terminal, the ios terminal, the PC terminal, and the WAP terminal are formed by common api splicing, that is, the application programs on various user terminals are tested by the test cases formed by common api splicing.
The server is provided with the automated testing framework shown in fig. 1, and before a test case is constructed, the server can initialize the automated testing framework, obtain starting parameters, environment variables, a starting framework process and the like.
An obtaining module 302 configured to: and acquiring a test case corresponding to the test operation request according to the test operation request sent by the user terminal.
If the server needs to test a certain application program in the Android terminal, the server needs to include a user terminal IP address, a user terminal system version number, a packet name of the application program, a main interface of the application program, and the like according to a test operation request.
Optionally, the connection between the user terminal and the server may be wired or wireless.
Supposing that the user terminal is wirelessly connected with the server, for example, the Android terminal is connected with the server through a USB data line, after the Android terminal is connected with the server, the server acquires information such as the model of the Android terminal and the IP address of the Android terminal, and then acquires a test case corresponding to the test request according to the test operation request to test the application program on the Android terminal; wherein, the test operation request may not include the user terminal IP address and the user terminal system version number.
However, in a plurality of user terminals (the same or different user terminals), the server is connected to the server, the server cannot obtain information such as user terminal IP addresses and user terminal system version numbers of the plurality of user terminals, the user terminal IP addresses and the user terminal system version numbers can be included in the test operation request, after the plurality of user terminals are respectively connected to the server, the test operation request is transmitted to the server, the server obtains test cases according to the test operation request, and then tests application programs on the corresponding user terminals according to the obtained test cases.
A test module 303 for: and testing the front-end program to be tested in the user terminal according to the test case corresponding to the test operation request.
Specifically, when the server acquires the test case corresponding to the test operation request, the server executes the test case to complete testing of the front-end program to be tested in the user terminal.
Optionally, the testing apparatus further includes: starting the module; and the starting module is used for starting the front-end program to be tested in the user terminal.
It can be understood that the front-end program to be tested may be installed in the user terminal in advance, and the server starts the corresponding front-end program to be tested after connecting with the user terminal. Certainly, the front-end program to be tested may not be installed in the user terminal in advance, and when the test is required, the server may enable the user terminal to install the front-end program to be tested.
And judging whether the test fails according to the test result. For example, when the output result of the test case is inconsistent with the expected result, the current test is determined to fail.
Optionally, if the test fails, the test may be executed for multiple times, and if the test still fails after the multiple times of execution of the test, the test is not performed again.
Optionally, the front-end program to be tested includes an application program or a Web page. The WAP or Mobile WEB page refers to a Web page opened by a browser on the Android and iOS ends in the invention.
Optionally, the testing apparatus further includes: a generation module; and the generating module is used for generating a test report. So that the testing personnel can optimize the front-end program to be tested according to the test report.
The embodiment of the invention provides an automatic testing device, which enables different user terminals to use a uniform testing framework to test by compiling a testing case through common api, can effectively reduce the compiling cost of the case and meet the requirements of a testing engineer in the aspect of automatic testing.
The invention integrates the previous different frames used by each operating system into a unified frame used by each operating system, thereby effectively reducing the cost of case compiling and meeting the requirements of test engineers in the aspect of automatic testing.
Although the invention has been described in detail above with reference to a general description and specific examples, it will be apparent to one skilled in the art that modifications or improvements may be made thereto based on the invention. Accordingly, such modifications and improvements are intended to be within the scope of the invention as claimed.

Claims (8)

1. An automated testing method, the testing method comprising:
constructing a test case according to operation requirements and a common business function common api; wherein the operational requirements include: clicking, sliding a screen, dragging, long-pressing and screenshot;
according to a test operation request sent by a user terminal, obtaining a test case corresponding to the test operation request;
and testing the front-end program to be tested in the user terminal according to the test case corresponding to the test operation request.
2. The method according to claim 1, wherein the step of constructing the test case according to the operation requirement and the common business function common api specifically comprises:
acquiring the operation requirement;
packaging the operation requirement;
and constructing a test case according to the operation requirement of the package and the common api.
3. The method according to claim 1 or 2, wherein after the step of constructing the test case according to the operation requirement and the common business function common api, the method further comprises:
and storing the test case.
4. The method of claim 1, further comprising:
when the test is completed, a test report is generated.
5. An automated testing device (corresponding to the modification of claim 1), characterized in that it comprises: the system comprises a construction module, an acquisition module and a test module; wherein,
the building module is used for building a test case according to the operation requirement and a common business function common api; wherein the operational requirements include: clicking, sliding a screen, dragging, long-pressing and screenshot;
the obtaining module is used for obtaining a test case corresponding to the test operation request according to the test operation request sent by the user terminal;
and the test module is used for testing the front-end program to be tested in the user terminal according to the test case corresponding to the test operation request.
6. The apparatus according to claim 5, wherein the building block is specifically configured to:
acquiring the operation requirement; packaging the operation requirement; and constructing a test case according to the operation requirement of the package and the common api.
7. The apparatus of claim 5 or 6, further comprising: a storage module;
the storage module is used for storing the test case.
8. The apparatus of claim 5, further comprising: a generation module;
the generation module is configured to: when the test is completed, a test report is generated.
CN201810214688.1A 2018-03-15 2018-03-15 A kind of automated testing method and device Pending CN108446229A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810214688.1A CN108446229A (en) 2018-03-15 2018-03-15 A kind of automated testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810214688.1A CN108446229A (en) 2018-03-15 2018-03-15 A kind of automated testing method and device

Publications (1)

Publication Number Publication Date
CN108446229A true CN108446229A (en) 2018-08-24

Family

ID=63194498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810214688.1A Pending CN108446229A (en) 2018-03-15 2018-03-15 A kind of automated testing method and device

Country Status (1)

Country Link
CN (1) CN108446229A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287092A (en) * 2019-05-10 2019-09-27 广东电力交易中心有限责任公司 A kind of electricity transaction system and its automatic test approach based on graphical interfaces

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287092A (en) * 2019-05-10 2019-09-27 广东电力交易中心有限责任公司 A kind of electricity transaction system and its automatic test approach based on graphical interfaces

Similar Documents

Publication Publication Date Title
CN107704395B (en) Cloud platform automation test implementation method and system based on Openstack
US11151018B2 (en) Method and apparatus for testing a code file
CN108427646B (en) Android App automatic test framework construction method and device based on Apium
CN105511911B (en) The generation method and device of system firmware upgrade package
CN105159833A (en) Automatic testing device and method
CN110013672B (en) Method, device, apparatus and computer-readable storage medium for automated testing of machine-run games
CN104407980A (en) Mobile application automated testing device and method
CN110825619A (en) Automatic generation method and device of interface test case and storage medium
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN107526676B (en) Cross-system test method and device
CN104821954A (en) Cross-platform remote procedure call method
CN111176629A (en) Application development method and device
CN108111364B (en) Service system testing method and device
CN103399814A (en) Automated testing method and automated testing device
CN110955409A (en) Method and device for creating resources on cloud platform
Wang et al. Research on mobile application automation testing technology based on appium
CN109739704A (en) A kind of interface test method, server-side and computer readable storage medium
CN113419969B (en) Interface automatic formation power guarantee method based on browser plug-in
CN106557411B (en) Method and system for testing Hybrid application in Android system
CN108595656B (en) Data processing method and system
CN111258802A (en) Method for capturing application program crash information and related equipment
CN107918587B (en) Debugging method and system for application program
CN108446229A (en) A kind of automated testing method and device
CN111078529A (en) Client write-in module testing method and device and electronic equipment
CN103546342A (en) Terminal consistency testing method and API (application program interface) interface general adapter for terminal consistency testing method

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

Application publication date: 20180824

RJ01 Rejection of invention patent application after publication