CN112650669A - Automatic appium testing method based on block chain - Google Patents

Automatic appium testing method based on block chain Download PDF

Info

Publication number
CN112650669A
CN112650669A CN202011406643.8A CN202011406643A CN112650669A CN 112650669 A CN112650669 A CN 112650669A CN 202011406643 A CN202011406643 A CN 202011406643A CN 112650669 A CN112650669 A CN 112650669A
Authority
CN
China
Prior art keywords
test
block chain
apium
automatic
simulation operation
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
CN202011406643.8A
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.)
Suzhou Black Cloud Intelligent Technology Co ltd
Original Assignee
Suzhou Black Cloud Intelligent 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 Suzhou Black Cloud Intelligent Technology Co ltd filed Critical Suzhou Black Cloud Intelligent Technology Co ltd
Priority to CN202011406643.8A priority Critical patent/CN112650669A/en
Publication of CN112650669A publication Critical patent/CN112650669A/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/3684Test management for test design, e.g. generating new test cases
    • 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

Abstract

The invention discloses an apium automatic testing method based on a block chain, which comprises the steps of obtaining initial parameters of an application program to be executed, and starting and executing the application program under an apium framework; acquiring test task data uploaded by an automatic test task issuing node from a block chain, determining test environment data of an automatic test according to the test task data, and storing the test environment data into the block chain; determining a test script of the automatic test according to the test task data, uploading the test script to a block chain, and generating a simulation operation event according to the test script; and sequentially executing simulation operation events according to depth traversal under the appium framework, outputting traversal results, and completing automatic testing of the application program. According to the invention, the test task data is acquired and stored in the block chain, so that the process monitoring of the automatic test is realized, and the authenticity and the safety of the test data are improved; and the automatic trigger test is carried out by using depth traversal under the appium, so that the occupied memory is small.

Description

Automatic appium testing method based on block chain
Technical Field
The invention relates to the technical field of automatic testing of a block chain, in particular to an apium automatic testing method based on the block chain.
Background
The automatic test is a process of converting the test behavior driven by human into machine execution, so that the labor, time and hardware resources can be saved, and the test efficiency is improved. Testing is an indispensable ring in a perfect research and development system, tools in the field of automatic testing are endless, but due to the particularity of the front end of the system that the front end is biased towards a GUI (Graphical user interface, which refers to a computer operation user interface displayed in a Graphical manner), a few tools are available on the front end, and many tools are still mainly tested manually. Most of the existing automatic testing methods are purely used appium (an open source testing automation framework which can be used for testing native, mixed and mobile Web application programs), selenium (a tool for testing Web application programs) or a tool built in a company, and the occupied memory is high. Meanwhile, the automatic test usually needs to be completed by multiple parties, and as the number of the collaborators increases, in order to ensure the safety of the test, the collaborators do not share the specific completion condition of the test task, so that the authenticity and the validity of data in the test process cannot be ensured, the test data is inaccurate, and the safety of the automatic test is reduced.
Disclosure of Invention
The technical problem to be solved by the invention is to provide an apium automatic testing method based on a block chain, which improves the safety of automatic testing and reduces the memory occupation.
In order to solve the technical problem, the invention provides an apium automatic testing method based on a block chain, which comprises the following steps:
step 1: acquiring initial parameters of an application program to be executed, generating a starting parameter file, and starting and executing the application program under an appium framework;
step 2: acquiring test task data uploaded by an automatic test task issuing node from a block chain, wherein the test task data comprises environmental requirements, tool type selection and task allocation;
and step 3: determining test environment data of an automatic test according to the test task data, and storing the test environment data into a block chain; determining a test script of an automatic test according to the test task data, uploading the test script to a block chain, and generating a simulation operation event according to the test script;
and 4, step 4: and sequentially executing simulation operation events according to depth traversal under the appium framework, outputting traversal results, and completing automatic testing of the application program.
Further, the test task data in the step 2 is uploaded to the blockchain by an automatic test task issuing node on the blockchain in advance through an intelligent contract.
Further, the automatic test task issuing nodes on the block chain are uploaded to the block chain in advance through intelligent contracts, specifically, the intelligent contracts are installed in advance on the automatic test task issuing nodes, then test task data are uploaded to the block chain through the intelligent contracts, and the block chain synchronizes the nodes in a broadcast mode after the test task data are uploaded to the block chain.
Further, the determining the test environment data of the automated test in step 3 specifically includes:
firstly, a system and a system version are obtained according to test equipment, then a package name and a start name of a test application are obtained, and finally other parameters are added according to test requirements.
Further, the node of the test environment data of the automated test determined in step 3 is a user node or a plurality of user nodes.
Further, the trigger execution method for generating the simulation operation event according to the test script in step 3 includes: and generating a simulation operation event of the application to be executed and performing stack pressing storage.
Further, the generating of the simulation operation event of the application to be executed and the stack pressing storage includes: and generating a simulation operation event for the editing control, then generating a simulation operation event for the list control, and finally generating a simulation operation event for the rest controls except the editing control and the list control.
Further, in the step 4, the simulation operation events are sequentially executed according to depth traversal under the apium framework, and the simulation operation events include an automatic test on an Android client and an automatic test on an iOS client.
Further, the automatic testing process for the Android client side is as follows:
the Android client uses a webDriver test script, the apium establishes an interface at the server based on a webDriver protocol, and the apium server analyzes the request content and calls corresponding framework response operation;
the Android server side forwards the request content to the middleware, the middleware is installed on the Android client side monitoring interface and receives commands from the Android, and the Android client side calls the UiAutomator commands to conduct automatic testing and returns the execution results to the Android server.
Further, the automatic testing process for the iOS client is as follows:
the iOS client uses a webDriver test script, the apium establishes an interface at the server based on a webDriver protocol, and the apium server analyzes the request content and calls corresponding framework response operation;
and calling instrumentation.js by the appium server to start the socket server, simultaneously separating a subprocess to run instrumentation.app for automatic test, injecting bootstrap.js into equipment to interact with the outside, and returning an execution result to the appium server.
The invention has the beneficial effects that: according to the block chain-based apium automatic testing method, the testing task data is acquired and stored in the block chain, so that the process monitoring of the automatic testing is realized, and the authenticity and the safety of the testing data are improved; and the depth traversal is used for carrying out automatic trigger test under the apium, so that the beneficial effects of a full scheme and less memory are realized.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical solutions of the present invention more clearly understood and to implement them in accordance with the contents of the description, the following detailed description is given with reference to the preferred embodiments of the present invention and the accompanying drawings.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The present invention is further described below in conjunction with the following figures and specific examples so that those skilled in the art may better understand the present invention and practice it, but the examples are not intended to limit the present invention.
In the description of the present invention, it should be understood that the term "comprises/comprising" is intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to the listed steps or elements but may alternatively include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to the flowchart in fig. 1, an embodiment of an apium automated testing method based on a block chain according to the present invention includes the following steps:
step 1: acquiring initial parameters of an application program to be executed, generating a starting parameter file, and starting and executing the application program under an appium framework; the specific parameters include a system name (platformName), a system version (platformVersion), a device number (deviceName), a package name (pPackage), and a start name (appActivity).
Step 2: and acquiring test task data uploaded by an automatic test task issuing node from the block chain, wherein the test task data comprises environmental requirements, tool type selection and task allocation.
And step 3: and determining test environment data of the automatic test, namely Desired Capabilities (which is responsible for parameter setting when the server is started and is used for telling the server about the context of the test) according to the test task data. The test environment data is stored in the block chain, and the safety of the test data can be ensured by uploading the test script to the block chain in the embodiment; and determining a test script of the automatic test according to the test task data, uploading the test script to a block chain, and generating a simulation operation event according to the test script. The test script includes basic operations as shown in table 1.
Name of method Function of
driver.pressKeyCode Simulating key operation
driver.startActivity Opening a specified Activity for a specified application
TouchAction(driver).longPress().perform Simulating long press operation for control
webElement.click() Simulating click operation on control
webElement.sendKeys() Simulating input operations for controls
driver.swipe() Simulating sliding operation for control
driver.tap() Simulating click operation on control
findElement(By.name()) Locating controls using text attributes or content-desc attributes
findElement(By.id()) Positioning controls with resource-id properties
findElement(By.xpath()) Locating controls using xpath properties
TABLE 1 basic operations included in a test script
And 4, step 4: sequentially executing simulation operation events according to depth traversal under an appium frame, namely, automatically triggering and testing an application to be executed; and outputting a traversal result to finish the automatic test of the application program. Depth traversal searches a sub-tree first, then another, requiring relatively less memory than traditional traversal methods, and by using depth traversal all solutions can be found, the benefits of full solution, less memory can be achieved.
In this embodiment, the test task data in step 2 is uploaded to the block chain by the automatic test task issuing node on the block chain in advance through an intelligent contract, specifically, the intelligent contract is installed in advance on the automatic test task issuing node, then the test task data is uploaded to the block chain through the intelligent contract, the block chain synchronizes each node in a broadcast form after being uploaded to the block chain, and other nodes on the block chain can receive the test task data.
In this embodiment, the determining of the test environment data of the automated test in step 3 is specifically that a system and a system version are obtained according to the test equipment, then a package name and a start name of the test application are obtained through the adb shell and the dups activity | grow mfosusedactivity instruction, and finally other parameters are added according to the test requirements. The method comprises the steps that a node of the test environment data of the automatic test is determined to be one user node or a plurality of user nodes, and a specific automatic test execution node completes the automatic test task in a coordinated mode, so that after the corresponding automatic test execution node receives the test task, the test environment data of the automatic test are firstly established according to the test task data.
In this embodiment, the method for triggering and executing the simulation operation event generated according to the test script in step 3 includes: and generating a simulation operation event of the application to be executed and performing stack pressing storage. The specific process is as follows: generating a simulation operation Event for the edit control EditText, and performing stack-pushing storage, then generating a simulation operation Event for the list control ListView, and performing stack-pushing storage, and finally generating a simulation operation Event for the rest controls except the edit control and the list control, and performing stack-pushing storage.
In this embodiment, in step 4, the simulation operation events are sequentially executed according to depth traversal under the apium framework, and the internal process of apium test execution includes automatic tests on the Android client and the iOS client.
The automatic testing process of the Android client side comprises the following steps: the Android client uses a webDriver test script, the appium establishes an interface (4723 port) at the server based on a webDriver protocol, the interface provides a set of REST interfaces, the appium server receives a web driver client standard REST request, analyzes the request content and calls a corresponding frame response operation; the Android server forwards the request content to a middleware Bootstrap.jar, the middleware Bootstrap.jar is realized by java, the middleware Bootstrap.jar is installed on an Android client monitoring interface (4723 port) and receives a command from the apium, the Android client calls a UiAutomator command to perform automatic test and returns an execution result to the apium server, and the apium server returns the result to the apium client.
The automatic test process of the iOS client side comprises the following steps: the iOS client uses a webDriver test script, the appium establishes an interface (4723 port) at the server based on a webDriver protocol, the interface provides a set of REST interface, the appium server receives a web driver client standard REST request, and the appium server analyzes the request content and calls corresponding frame response operation; the method comprises the steps that an apple server side calls instruments.js to start a socket server, meanwhile, a subprocess is separated to run instruments.app to carry out automatic testing, bootstrap.js (an UIAutomation script, an automatic testing framework under ios) is injected into equipment to interact with the outside, the bootstrap.js returns an execution result to the apple server side, and the apple server side returns the result to an apple client side.
According to the block chain-based apium automatic testing method, the testing task data is acquired and stored in the block chain, so that the process monitoring of the automatic testing is realized, and the authenticity and the safety of the testing data are improved; and the depth traversal is used for carrying out automatic trigger test under the apium, so that the beneficial effects of a full scheme and less memory are realized. The block chain technology has the characteristics of irreversibility and impossibility of counterfeiting, so that the authenticity of data can be effectively ensured; the algorithm of the block chain realizes safety, consensus mechanism safety and system design safety, and the block chain with a specific protocol can realize anonymity in different degrees, so the characteristics of confidentiality and privacy protection can be used for protecting data. Therefore, the authenticity and the safety of the test data of the combined block chain and the appium are higher, and the execution process can be protected. Meanwhile, various consensus algorithm mechanisms appear in the current block chain technology, so that the safety problem can not occur even if multiple parties cooperate in the test process, the test result according to the test task data is more real and credible, and the safety of the automatic test is improved.
The above-mentioned embodiments are merely preferred embodiments for fully illustrating the present invention, and the scope of the present invention is not limited thereto. The equivalent substitution or change made by the technical personnel in the technical field on the basis of the invention is all within the protection scope of the invention. The protection scope of the invention is subject to the claims.

Claims (10)

1. An apium automatic testing method based on a block chain is characterized by comprising the following steps:
step 1: acquiring initial parameters of an application program to be executed, generating a starting parameter file, and starting and executing the application program under an appium framework;
step 2: acquiring test task data uploaded by an automatic test task issuing node from a block chain, wherein the test task data comprises environmental requirements, tool type selection and task allocation;
and step 3: determining test environment data of an automatic test according to the test task data, and storing the test environment data into a block chain; determining a test script of an automatic test according to the test task data, uploading the test script to a block chain, and generating a simulation operation event according to the test script;
and 4, step 4: and sequentially executing simulation operation events according to depth traversal under the appium framework, outputting traversal results, and completing automatic testing of the application program.
2. The block chain-based apium automated testing method of claim 1, characterized in that: and the test task data in the step 2 is uploaded to the block chain by an automatic test task issuing node on the block chain in advance through an intelligent contract.
3. The block chain-based apium automated testing method of claim 2, characterized in that: the automatic test task issuing nodes on the block chain are uploaded to the block chain in advance through intelligent contracts, specifically, the intelligent contracts are pre-installed on the automatic test task issuing nodes, then test task data are uploaded to the block chain through the intelligent contracts, and the block chain synchronizes the nodes in a broadcast mode after the test task data are uploaded to the block chain.
4. The block chain-based apium automated testing method of claim 1, characterized in that: the determining of the test environment data of the automated test in the step 3 specifically includes:
firstly, a system and a system version are obtained according to test equipment, then a package name and a start name of a test application are obtained, and finally other parameters are added according to test requirements.
5. The block chain-based apium automated testing method of claim 1, characterized in that: and determining that the node of the test environment data of the automatic test in the step 3 is one user node or a plurality of user nodes.
6. The block chain-based apium automated testing method of claim 1, characterized in that: the triggering execution method for generating the simulation operation event according to the test script in the step 3 comprises the following steps: and generating a simulation operation event of the application to be executed and performing stack pressing storage.
7. The block chain-based apium automated testing method of claim 6, characterized in that: the method comprises the following steps of generating a simulation operation event of an application to be executed and performing stack pressing storage, and comprises the following specific processes: and generating a simulation operation event for the editing control, then generating a simulation operation event for the list control, and finally generating a simulation operation event for the rest controls except the editing control and the list control.
8. The block chain-based apium automated testing method of claim 1, characterized in that: and in the step 4, simulation operation events are sequentially executed according to depth traversal under the apium frame, wherein the simulation operation events comprise automatic test on an Android client and automatic test on an iOS client.
9. The block chain-based apium automated testing method according to claim 8, characterized in that the automated testing process for the Android client is as follows:
the Android client uses a webDriver test script, the apium establishes an interface at the server based on a webDriver protocol, and the apium server analyzes the request content and calls corresponding framework response operation;
the Android server side forwards the request content to the middleware, the middleware is installed on the Android client side monitoring interface and receives commands from the Android, and the Android client side calls the UiAutomator commands to conduct automatic testing and returns the execution results to the Android server.
10. The block chain-based apium automated testing method of claim 8, wherein the automated testing process for the iOS client is:
the iOS client uses a webDriver test script, the apium establishes an interface at the server based on a webDriver protocol, and the apium server analyzes the request content and calls corresponding framework response operation;
and calling instrumentation.js by the appium server to start the socket server, simultaneously separating a subprocess to run instrumentation.app for automatic test, injecting bootstrap.js into equipment to interact with the outside, and returning an execution result to the appium server.
CN202011406643.8A 2020-12-04 2020-12-04 Automatic appium testing method based on block chain Pending CN112650669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011406643.8A CN112650669A (en) 2020-12-04 2020-12-04 Automatic appium testing method based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011406643.8A CN112650669A (en) 2020-12-04 2020-12-04 Automatic appium testing method based on block chain

Publications (1)

Publication Number Publication Date
CN112650669A true CN112650669A (en) 2021-04-13

Family

ID=75350294

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011406643.8A Pending CN112650669A (en) 2020-12-04 2020-12-04 Automatic appium testing method based on block chain

Country Status (1)

Country Link
CN (1) CN112650669A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829389A (en) * 2018-03-29 2018-11-16 中南大学 Android application automation triggering execution method based on Appium
CN108984375A (en) * 2018-05-31 2018-12-11 腾讯科技(深圳)有限公司 A kind of content grasping means, device, system and storage medium
CN109753433A (en) * 2018-12-26 2019-05-14 中链科技有限公司 Automated testing method, device and electronic equipment based on block chain
CN109753434A (en) * 2018-12-26 2019-05-14 中链科技有限公司 Performance test methods, device, electronic equipment and storage medium based on block chain
CN109783372A (en) * 2018-12-26 2019-05-21 中链科技有限公司 Method for testing software, device, electronic equipment and storage medium based on block chain
CN110928625A (en) * 2019-11-21 2020-03-27 腾讯科技(深圳)有限公司 Application program operation control method and device, electronic equipment and storage medium
US10671515B1 (en) * 2018-11-30 2020-06-02 Bank Of America Corporation Recording and playback of electronic event sequence in a distributed ledger system
US10716021B1 (en) * 2018-07-19 2020-07-14 Sprint Communications Company L.P. Minimization of drive test (MDT) data donor device selection

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829389A (en) * 2018-03-29 2018-11-16 中南大学 Android application automation triggering execution method based on Appium
CN108984375A (en) * 2018-05-31 2018-12-11 腾讯科技(深圳)有限公司 A kind of content grasping means, device, system and storage medium
US10716021B1 (en) * 2018-07-19 2020-07-14 Sprint Communications Company L.P. Minimization of drive test (MDT) data donor device selection
US10671515B1 (en) * 2018-11-30 2020-06-02 Bank Of America Corporation Recording and playback of electronic event sequence in a distributed ledger system
CN109753433A (en) * 2018-12-26 2019-05-14 中链科技有限公司 Automated testing method, device and electronic equipment based on block chain
CN109753434A (en) * 2018-12-26 2019-05-14 中链科技有限公司 Performance test methods, device, electronic equipment and storage medium based on block chain
CN109783372A (en) * 2018-12-26 2019-05-21 中链科技有限公司 Method for testing software, device, electronic equipment and storage medium based on block chain
CN110928625A (en) * 2019-11-21 2020-03-27 腾讯科技(深圳)有限公司 Application program operation control method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106095677B (en) The RESTful Webservice automatic interface testing methods realized based on Robot Framework
CN111159049B (en) Automatic interface testing method and system
CN105094783B (en) method and device for testing stability of android application
US20130179858A1 (en) Framework for automated testing of mobile apps
CN110209652A (en) Tables of data moving method, device, computer equipment and storage medium
CN106021099A (en) System and method for achieving UI automatic test of intelligent terminal
CN110362490B (en) Automatic testing method and system for integrating iOS and Android mobile applications
CN105786695A (en) Data test method and system
CN107302476A (en) A kind of automated testing method and system for testing asynchronous interactive system
CN110888818A (en) Test case configuration system and method, automatic test system and method
CN103631590A (en) Method for editing automated testing script
CN105204991A (en) Internet of things test method and device
CN111581067B (en) Data acquisition method and device
CN110297637A (en) The applicable resource file thermogravimetric of full platform client software carries tool and method of development
CN114238071A (en) DCS software automatic verification system and method based on digital simulation technology
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN114003451B (en) Interface testing method, device, system and medium
CN110750453A (en) HTML 5-based intelligent mobile terminal testing method, system, server and storage medium
CN102750143A (en) Digital signal processing (DSP) developing method based on matrix laboratory (MATLAB) component object model (COM) component calling
CN105760300A (en) Automatic STK/UTK service testing method and system
US20050203717A1 (en) Automated testing system, method and program product using testing map
CN112650669A (en) Automatic appium testing method based on block chain
CN107451435B (en) Management and control method, management and control machine and management and control system of hardware encryption machine
CN113934552A (en) Method and device for determining function code, storage medium and electronic device
CN113934619A (en) Sound source testing method, system and storage medium based on Robot Framework testing Framework

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