CN109344058B - Automatic small program testing method - Google Patents

Automatic small program testing method Download PDF

Info

Publication number
CN109344058B
CN109344058B CN201811090663.1A CN201811090663A CN109344058B CN 109344058 B CN109344058 B CN 109344058B CN 201811090663 A CN201811090663 A CN 201811090663A CN 109344058 B CN109344058 B CN 109344058B
Authority
CN
China
Prior art keywords
mobile phone
elements
page
interface
applet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811090663.1A
Other languages
Chinese (zh)
Other versions
CN109344058A (en
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.)
Beijing Testin Information Technology Co Ltd
Original Assignee
Beijing Testin Information 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 Beijing Testin Information Technology Co Ltd filed Critical Beijing Testin Information Technology Co Ltd
Priority to CN201811090663.1A priority Critical patent/CN109344058B/en
Publication of CN109344058A publication Critical patent/CN109344058A/en
Application granted granted Critical
Publication of CN109344058B publication Critical patent/CN109344058B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an automatic test method for an applet, which comprises the steps of obtaining the current page elements of the applet through the communication between an engine in a mobile phone and the applet, and finally analyzing and filtering the non-current page elements to obtain the effective elements of the current interface. An instruction is sent to an engine in the mobile phone through the PC terminal, for example, if a certain element A on a mobile phone interface is required to be searched, the engine in the mobile phone can automatically search whether the current page contains the element A, and therefore automation of the small program test can be achieved. Because the elements to be searched can be sent to the mobile phone through the PC, any required interface elements can be searched, and the customization of the test can be realized.

Description

Automatic small program testing method
Technical Field
The application relates to the technical field of control over test tools and android mobile phone WeChat applets, in particular to an automatic applet test method.
Background
A WeChat applet, abbreviated as an applet, is an application which can be used without downloading and installation, and realizes the dream of 'being reachable by a touch' of the application, and a user can open the application by scanning or searching one time. Current small program testing can pass the Tencent TBS Studio tool, but the tool is closed and cannot be customized and automated. Therefore, a method for realizing the automatic test of the small programs is necessary.
Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide an automatic test method for a small program, which can realize automation and customization of small program test.
In order to achieve the purpose, the invention adopts the following technical scheme:
an automatic test method for applets comprises the following steps:
s1, stopping the mobile phone interface at the WeChat small program interface;
s2, the mobile phone engine scans UNIX Domain Socket to obtain a port for process communication with the wechat applet and obtain a plurality of port numbers of the wechat applet;
s3, the mobile phone engine requests the port numbers of all the WeChat applets through a Localsocket cross-process to obtain page details corresponding to the port numbers, including page states;
s4, acquiring all DOM contents of the page: the mobile phone engine requests a websocket address in the page details, and requests the websocket address to obtain all elements of the current page;
s5, filtering out hidden page elements with empty content, interface DOM unfocused state and interfaces which are not current WeChat applets by the mobile phone engine to obtain all elements of the current interface;
and S6, recording key elements of the current interface required when writing test logic, sending a key element searching instruction to the mobile phone engine through the PC end when performing automatic test, searching the key elements in all the elements of the current interface obtained in the step S5 by the mobile phone engine, wherein the current interface is an expected result if the key elements are found, and otherwise, directly reporting errors.
Further, in step S3, the page status includes width, height, display, position, websocket address, and description of the page.
Further, step S4 is specifically executed by js.
The invention has the beneficial technical effects that:
the method of the invention obtains the current page element of the applet through the communication between the engine in the mobile phone and the applet, and finally analyzes and filters the non-current page element, namely obtaining the effective element of the current interface. An instruction is sent to an engine in the mobile phone through the PC terminal, for example, if a certain element A on a mobile phone interface is required to be searched, the engine in the mobile phone can automatically search whether the current page contains the element A, and therefore automation of the small program test can be achieved. Because the elements to be searched can be sent to the mobile phone through the PC, any required interface elements can be searched, and the customization of the test can be realized.
The invention can automatically test the running effect of the small program on different mobile phone brands and mobile phone versions at the same time, greatly saves the labor cost and time and improves the testing efficiency.
Drawings
FIG. 1 is a schematic diagram of the method of the embodiment of the present invention.
Detailed Description
The present invention will be further described with reference to the accompanying drawings, and it should be noted that the following examples are provided to illustrate the detailed embodiments and specific operations based on the technical solutions of the present invention, but the scope of the present invention is not limited to the examples.
As shown in fig. 1, an automated test method for an applet includes the following steps:
s1, stopping the mobile phone interface at the WeChat small program interface;
s2, the mobile phone engine scans UNIX Domain Socket to obtain a port for process communication with the wechat applet and obtain a plurality of port numbers of the wechat applet;
and S3, the mobile phone engine requests the port numbers of all the wessocket programs through the Localsocket cross-process to obtain the page details corresponding to the port numbers, including page states (width, height, display, position, websocket address, description and the like).
S4, acquiring all DOM contents of the page: the mobile phone engine requests a websocket address in the page details, and requests the websocket address to obtain all elements of the current page. Specifically, through js execution, the executed result content is obtained, and the executed result content includes all elements of the page, such as an account number input text box, a password input text box, a login button and the like of a login interface.
S5, filtering out hidden page elements with empty content, interface DOM unfocused state and interfaces which are not current WeChat applets by the mobile phone engine to obtain all elements of the current interface;
and S6, recording key elements of the current interface required when writing test logic, sending a key element searching instruction to the mobile phone engine through the PC end when performing automatic test, searching the key elements in all the elements of the current interface obtained in the step S5 by the mobile phone engine, wherein the current interface is an expected result if the key elements are found, and otherwise, directly reporting errors.
Example 1
In this embodiment, the required automated test logic is:
1. recording key elements A of the login interface
2. Select input Account-record input Account textbox element B
3. Then enter password-record enter password textbox element C
4. Click login button-record login button element D
5. Interface successful in login-recording key element E of interface successful in login
Through the method flow of fig. 1, a main line flow in which 5 elements in the sequence of A, B, C, D, E are acquired as an automation test is obtained. This flow is the main logic to implement automated testing.
In the process of automatic testing, the steps of:
1. the element A is obtained first through the process of the figure 1, the obtaining is successful, the coordinate of the element A on the screen is calculated, and the operation of clicking and inputting an account number is carried out on the element A through an android uiautomator automatic testing framework.
2. The find B, C element is the same as step 1.
3. The search D is performed by clicking as in step 1.
4. The search E is the same as the step 1, only verification is carried out during execution, and if an E element exists, the whole automatic test flow is passed, and login is successful. If the failure occurs, the problem exists in the middle, and the failure information can be captured and reserved.
5. Therefore, the automatic test can be realized together with the recorded script file of the main logic test flow. Therefore, manual testing of multiple users and multiple devices can be avoided, and one script file is recorded by one person, so that automatic testing of multiple devices can be automatically executed by one person.
Various corresponding changes and modifications can be made by those skilled in the art based on the above technical solutions and concepts, and all such changes and modifications should be included in the protection scope of the present invention.

Claims (3)

1. An automatic test method for small programs is characterized by comprising the following steps:
s1, stopping the mobile phone interface at the WeChat small program interface;
s2, the mobile phone engine scans UNIX Domain Socket to obtain a port for process communication with the wechat applet and obtain a plurality of port numbers of the wechat applet;
s3, the mobile phone engine requests the port numbers of all the WeChat applets through a Localsocket cross-process to obtain page details corresponding to the port numbers, including page states;
s4, acquiring all DOM contents of the page: the mobile phone engine requests a websocket address in the page details, and requests the websocket address to obtain all elements of the current page;
s5, filtering out hidden page elements with empty content, interfaces with DOM unfocused state and interfaces which are not current WeChat small programs by the mobile phone engine to obtain all elements of the current interface;
and S6, recording key elements of the current interface required when writing test logic, sending a key element searching instruction to the mobile phone engine through the PC end when performing automatic test, searching the key elements in all the elements of the current interface obtained in the step S5 by the mobile phone engine, wherein the current interface is an expected result if the key elements are found, and otherwise, directly reporting errors.
2. The applet automatic test method according to claim 1, wherein in step S3, the page status includes page width, height, display, position, websocket address, description.
3. The automated applet testing method according to claim 1, characterised in that in step S4 step S4 is performed in particular by js.
CN201811090663.1A 2018-09-18 2018-09-18 Automatic small program testing method Active CN109344058B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811090663.1A CN109344058B (en) 2018-09-18 2018-09-18 Automatic small program testing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811090663.1A CN109344058B (en) 2018-09-18 2018-09-18 Automatic small program testing method

Publications (2)

Publication Number Publication Date
CN109344058A CN109344058A (en) 2019-02-15
CN109344058B true CN109344058B (en) 2021-06-15

Family

ID=65306071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811090663.1A Active CN109344058B (en) 2018-09-18 2018-09-18 Automatic small program testing method

Country Status (1)

Country Link
CN (1) CN109344058B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110750463B (en) * 2019-10-29 2023-06-23 百度在线网络技术(北京)有限公司 Method, device, system, equipment and medium for testing small program
CN110928791B (en) * 2019-11-27 2022-03-01 腾讯科技(深圳)有限公司 Program testing method, program testing device, computer equipment and storage medium
CN111881338A (en) * 2020-08-03 2020-11-03 深圳一块互动网络技术有限公司 Printed matter content retrieval method based on social software light application applet

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1394091A (en) * 2001-06-22 2003-01-29 摩托罗拉公司 Method and apparatus for transmitting data in communication system
CN102129405A (en) * 2010-01-13 2011-07-20 微软公司 Cross-browser interactivity testing
CN103927253A (en) * 2013-01-11 2014-07-16 阿里巴巴集团控股有限公司 Multiple browser compatibility testing method and system
CN104881358A (en) * 2015-05-28 2015-09-02 南京南瑞继保电气有限公司 Program simulation testing method and system
CN107728999A (en) * 2017-11-14 2018-02-23 苏州奇松软件有限公司 A kind of App, the method and system of small routine interface simulation
CN107729230A (en) * 2017-09-18 2018-02-23 郑州云海信息技术有限公司 A kind of WEB automatic test devices and method of testing based under control scheme

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8849972B2 (en) * 2008-11-25 2014-09-30 Polycom, Inc. Method and system for dispatching received sessions between a plurality of instances of an application using the same IP port
US9356955B2 (en) * 2014-03-15 2016-05-31 Kenneth F. Belva Methods for determining cross-site scripting and related vulnerabilities in applications
US11132287B2 (en) * 2016-05-18 2021-09-28 Dynatrace Llc Synthetic test recorder installed inline with a web portal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1394091A (en) * 2001-06-22 2003-01-29 摩托罗拉公司 Method and apparatus for transmitting data in communication system
CN102129405A (en) * 2010-01-13 2011-07-20 微软公司 Cross-browser interactivity testing
CN103927253A (en) * 2013-01-11 2014-07-16 阿里巴巴集团控股有限公司 Multiple browser compatibility testing method and system
CN104881358A (en) * 2015-05-28 2015-09-02 南京南瑞继保电气有限公司 Program simulation testing method and system
CN107729230A (en) * 2017-09-18 2018-02-23 郑州云海信息技术有限公司 A kind of WEB automatic test devices and method of testing based under control scheme
CN107728999A (en) * 2017-11-14 2018-02-23 苏州奇松软件有限公司 A kind of App, the method and system of small routine interface simulation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"移动端(微信等)使用 vConsole调试console";朱桂彪;《https://blog.csdn.net/m0_37036014/article/details/80113635》;20180427;第1-2页 *

Also Published As

Publication number Publication date
CN109344058A (en) 2019-02-15

Similar Documents

Publication Publication Date Title
CN109344058B (en) Automatic small program testing method
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
CN104598380A (en) Method and system for automatic testing based on control
CN106021102B (en) The generation method and device of automatic test file
CN103313289B (en) WAP system automation test macro and method
CN105302722B (en) CTS automatic testing method and device
CN108920146A (en) Page control assembly and visual Simulation operating system
CN110147327B (en) Multi-granularity-based web automatic test management method
CN106126424A (en) A kind of visual automated testing method of script, device and mobile terminal
CN104980552B (en) Realize the method and system of Android mobile terminal automatic test
CN105607799B (en) Data processing method and device
WO2021129335A1 (en) Operation monitoring method and apparatus, operation analysis method and apparatus
CN105204991A (en) Internet of things test method and device
CN105468674A (en) Window interception method and device and terminal equipment
CN110865851A (en) Automatic Android application data acquisition method and system
CN108023905B (en) Internet of things application system and method
CN107038117B (en) Web automatic testing method based on definition-reference between event processing functions
CN106294119B (en) Test scheduling system and method and terminal equipment
CN109032705B (en) Application program execution method and device, electronic equipment and readable storage medium
CN107832060B (en) Application program interface processing method and device
CN109669785A (en) Page sharing method, device, server and the storage medium of terminal applies
CN108418869B (en) Sharing and installing method, device, system and medium of application program
KR100930962B1 (en) Remote security testing device and method of RPC-based software
CN110737861A (en) webpage data processing method, device, equipment and storage medium
CN112416734A (en) Test method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant