CN113326193A - Applet testing method and device - Google Patents

Applet testing method and device Download PDF

Info

Publication number
CN113326193A
CN113326193A CN202110619251.8A CN202110619251A CN113326193A CN 113326193 A CN113326193 A CN 113326193A CN 202110619251 A CN202110619251 A CN 202110619251A CN 113326193 A CN113326193 A CN 113326193A
Authority
CN
China
Prior art keywords
recording
project
item
event
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
CN202110619251.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.)
WeBank Co Ltd
Original Assignee
WeBank 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 WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202110619251.8A priority Critical patent/CN113326193A/en
Publication of CN113326193A publication Critical patent/CN113326193A/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
    • 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
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

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

Abstract

The invention discloses a method and a device for testing an applet, wherein the method comprises the following steps: after the fact that the small program test is started is monitored, starting local monitoring service through a preset sub-process; when a first project is compiled, replacing a default event in the first project with a user-defined event, recording a test process of the first project based on the user-defined event, and obtaining a recording case of the first project, wherein the recording case is recorded by the local monitoring service; and acquiring a recording use case of the first project based on the record corresponding to the local monitoring service. When the method is applied to financial science and technology (F intech), the automatic recording of the use case of the small program test is realized.

Description

Applet testing method and device
Technical Field
The embodiment of the invention relates to the field of financial technology (Fintech), in particular to a method and a device for testing an applet.
Background
With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changing to financial technology, but due to the requirements of the financial industry on safety and real-time performance, higher requirements are also put forward on the technologies.
The applet is an application which can be used without downloading and installing, realizes the dream of 'being reachable by a touch' of the application, and can be opened by scanning or searching by a user. Based on this feature of the applet, the applet is gradually applied to the field of financial technology to provide more convenient service to the financial enterprise or the client of the financial enterprise. Some financial institutions often rely on applets to implement auxiliary functions, which allow users to operate more conveniently and flexibly. Before a small program is formally on-line, various functional tests are required to be carried out to check bugs.
At present, when a test framework in the prior art tests a small program, a test case cannot be automatically recorded, and under the condition that the test case cannot be automatically recorded, a test can be performed through a recording script at present, but when the test is performed through the recording script, elements are inaccurately positioned, and an error is easily generated when the test script is re-run.
Disclosure of Invention
The invention provides a small program testing method and device, and solves the problems that in the prior art, a case cannot be automatically recorded in a testing process, and even a script cannot be accurately recorded.
In a first aspect, the present invention provides an applet testing method, including: after the fact that the small program test is started is monitored, starting local monitoring service through a preset sub-process; when a first project is compiled, replacing a default event in the first project with a user-defined event, recording a test process of the first project based on the user-defined event, and obtaining a recording case of the first project, wherein the recording case is recorded by the local monitoring service; and acquiring a recording use case of the first project based on the record corresponding to the local monitoring service.
According to the method, after the start of the test of the small program is monitored, the local monitoring service is started through the preset device, namely all states in the test process of the small program can be recorded through the local monitoring service. When the first project is compiled, the default event in the first project can be replaced by the custom event, so that the first project executes the custom event, the custom event also comprises recording logic besides the logic executed by the default event, the test process of the first project can be recorded based on the custom event, the recording case of the first project is obtained, and then the recording case of the first project can be obtained based on the record corresponding to the local monitoring service, so that the automatic recording of the test case is realized, manual processing by a tester is not needed, the test efficiency is improved, and the problem that the recording result is inaccurate due to the fact that the test is performed through the recording script is also solved.
Optionally, before replacing the default event in the first project with the custom event when the first project is compiled, the method further includes: determining whether the first item is an item of a preset type; the preset type comprises a Page type or an App type; when the first item is determined to be a preset type item, when the first item is compiled, replacing a default event in the first item with a custom event.
In the method, before the default event in the first item is replaced with the custom event, it may be further determined whether the type of the first item is a preset type, and after the type of the first item is determined to be the preset type, the default event in the first item is replaced. That is, the above method can make a prejudgment on the type of the first item, enhancing the accuracy of the replacement of the default event.
Optionally, after the recording case of the first item is obtained, the method further includes: performing cyclic traversal on the recording case to obtain the recording operation of testing the first project; analyzing the custom attribute corresponding to the recording operation to obtain an identification array corresponding to each event in the first item; the identification array is used for indicating elements and pages corresponding to each event; and performing playback test processing on the recording case based on the identification array.
Based on the method, the recording operation of the first project for testing can be obtained, the custom attribute corresponding to the recording operation is analyzed, the identification array corresponding to each event in the first project is obtained, and the test case is subjected to playback test processing based on the identification array. That is to say, the custom attribute corresponding to the recording operation has an associated relationship with the identification array, that is, the identification array is correspondingly determined based on the relationship, so as to determine the element and the page corresponding to the event, and then the recording case can be subjected to playback test based on the determined element and page, so that the accuracy of positioning the element during the playback test is improved, the accurate playback of the recording case is realized, and the test efficiency is improved.
Optionally, based on the identifier array, performing playback test processing on the recording case, including: determining first data of a first preset position and second data of a second preset position in the identification array; the first data is used for indicating a page path corresponding to an event in the first project, and the second data is used for indicating an element corresponding to the event in the first project; and performing playback test processing on the recording case based on the first data and the second data.
Based on the method, when the playback test processing is carried out, the elements and the pages can be accurately determined based on the identification array obtained by analyzing the custom attributes, and the operation of a tester can be simulated based on the determined elements and the pages, so that the playback test processing is realized, and the test efficiency is improved.
Optionally, the custom attribute is determined based on the following manner: traversing the wxml file of the first item; generating a new identification array based on the page path, the hash string and the element identification of the wxml file of the first item; and assigning the new identification array to a custom attribute corresponding to each event in the wxml file.
According to the method, the content in the identification array is limited, namely the identification array is generated based on the page path, the hash string and the element identification of the xml file of the first item, the generated identification array is assigned to the custom attribute, so that the identification array can be correspondingly determined based on the custom attribute, the recording operation can be accurately positioned based on the page path and the element identification included in the identification array subsequently, and the accurate playback of the recording case is realized.
Optionally, after the monitoring that the applet test is started, after the local monitoring service is started through a preset sub-process, the method further includes: clearing the existing state of a first item of the applet, recording the new state of the first item, and recording the new state to a local directory corresponding to the first item; and when the naming operation of the first project is received, requesting to end the local monitoring service, and completing recording of the recording use case of the first project.
In the method, a function key for recording the test case is provided, and the control on the end of recording can be realized based on the function key. And the recording use case can be named, and convenience is provided for searching the subsequent recording use case.
Optionally, the obtaining a recording use case of the first item based on the record corresponding to the local monitoring service includes: acquiring a recording use case of the first project from a local directory corresponding to the first project; and the directory comprises a recording file determined in a preset format based on the recording result.
According to the method, the recording files are divided and stored based on different projects, so that the corresponding recording files in the preset format can be quickly and accurately obtained from the automatically recorded local directory, a large amount of time is not required to be consumed for searching the recording files, and the testing efficiency is improved.
In a second aspect, the present invention provides an applet testing apparatus, comprising: the trigger module is used for starting the local monitoring service through a preset subprocess after the small program test is monitored to be started; the processing module is used for replacing a default event in a first project with a user-defined event when the first project is compiled, recording a test process of the first project based on the user-defined event, obtaining a recording case of the first project, and recording the recording case by the local monitoring service; the obtaining module is further configured to obtain a recording use case of the first project based on the record corresponding to the local monitoring service.
Optionally, the apparatus further includes a determining module, configured to: determining whether the first item is an item of a preset type; the preset type comprises a Page type or an App type; when the first item is determined to be a preset type item, when the first item is compiled, replacing a default event in the first item with a custom event.
Optionally, the apparatus further includes a first processing module, configured to: performing cyclic traversal on the recording case to obtain the recording operation of testing the first project; analyzing the custom attribute corresponding to the recording operation to obtain an identification array corresponding to each event in the first item; the identification array is used for indicating elements and pages corresponding to each event; and performing playback test processing on the recording case based on the identification array.
Optionally, the first processing module is specifically configured to: determining first data of a first preset position and second data of a second preset position in the identification array; the first data is used for indicating a page path corresponding to an event in the first project, and the second data is used for indicating an element corresponding to the event in the first project; and performing playback test processing on the recording case based on the first data and the second data.
Optionally, the custom attribute is determined based on the following manner: traversing the wxml file of the first item; generating a new identification array based on the page path, the hash string and the element identification of the wxml file of the first item; and assigning the new identification array to a custom attribute corresponding to each event in the wxml file.
Optionally, the apparatus further includes a recording module, configured to: clearing the existing state of a first item of the applet, recording the new state of the first item, and recording the new state to a local directory corresponding to the first item; and when the naming operation of the first project is received, requesting to end the local monitoring service, and completing recording of the recording use case of the first project.
Optionally, the obtaining module is configured to: acquiring a recording use case of the first project from a local directory corresponding to the first project; and the directory comprises a recording file determined in a preset format based on the recording result.
The advantageous effects of the second aspect and the various optional apparatuses of the second aspect may refer to the advantageous effects of the first aspect and the various optional methods of the first aspect, and are not described herein again.
In a third aspect, the present invention provides a computer device comprising a program or instructions for performing the method of the first aspect and the alternatives of the first aspect when the program or instructions are executed.
In a fourth aspect, the present invention provides a storage medium comprising a program or instructions which, when executed, is adapted to perform the method of the first aspect and the alternatives of the first aspect.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that are required to be used in the description of the embodiments will be briefly described below.
FIG. 1 is a schematic diagram of a process for performing an applet test in the prior art;
FIG. 2 is a flowchart illustrating steps of a method for testing an applet according to an embodiment of the present invention;
fig. 3 is a schematic diagram of function keys for recording test cases according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an applet testing apparatus according to an embodiment of the present invention.
Detailed Description
In order to better understand the technical solutions, the technical solutions will be described in detail below with reference to the drawings and the specific embodiments of the specification, and it should be understood that the embodiments and specific features of the embodiments of the present invention are detailed descriptions of the technical solutions of the present invention, and are not limitations of the technical solutions of the present invention, and the technical features of the embodiments and examples of the present invention may be combined with each other without conflict.
It is noted that the terms first, second and the like in the description and in the claims of the present invention are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the images so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
In order to facilitate understanding of the technical solutions provided by the embodiments of the present invention, some key terms used in the embodiments of the present invention are explained first:
1. native application: the application is developed by using a development tool or a language supported by a mobile platform, and is developed specifically for an operating system, such as an iOS (operating system of apple inc.), Android (Android), and the like.
2. The small program: WeChat applet, one of the applets, the English name Wechat Mini Program, is an application that can be used without downloading and installing, and realizes the dream of being "reachable by the touch" by the user, and the user can open the application by scanning or searching once.
3. Automated testing: automated testing is a process that translates human-driven test behavior into machine execution.
4. Test case: the Test Case (Test Case) refers to the description of a Test task performed on a specific software product, and embodies Test schemes, methods, techniques and strategies. The contents of the test object, the test environment, the input data, the test steps, the expected results, the test scripts and the like are included, and finally, a document is formed.
5. Wxa (weixinapp): is a progressive WeChat applet development framework.
6. WXA-E2E (weixinapp-end to end): WeChat applet UI automation test framework based on WXA
7. Node.js was published in 5 months 2009, developed by Ryan Dahl, is a JavaScript operating environment based on Chrome V8 engine, and uses an event-driven, non-blocking I/O model.
The following briefly introduces the design concept of the embodiment of the present invention:
currently, the testing framework provided in the prior art, such as Appium, is more biased towards the automated testing of native applications and cannot perform automated testing on WeChat applets; for example, the former, i.e., Minitest, depends on Python and needs to manually write a document for recording a test case, and the latter, i.e., Automator, in combination with Jest, also depends on manually writing a document for recording a test case, i.e., cannot record a test case fully automatically.
For example, referring to fig. 1, taking a test frame as Airtest as an example, when recording a case, a tester needs to manually select an element in an interface, specifically, a picture in fig. 1 is the selected element, and then, case logic, that is, codes in lines 5, 7, and 8 in fig. 1, is written in a script. Obviously, the whole process is involved with manpower and is not completely automatically recorded.
Therefore, when the small program is tested based on the test framework in the prior art, the automatic recording of the test case cannot be realized, and errors are easily generated when the test is performed through the recording script and the test script is re-run, so that the test efficiency is low.
In view of this, the invention provides a method and a device for testing an applet, by which a test case can be automatically recorded, the test efficiency is improved, and elements can be accurately positioned, thereby greatly improving the accuracy and stability of test playback.
To further illustrate the scenario of the applet testing method provided in the embodiment of the present invention, the following detailed description is made with reference to the accompanying drawings and the specific embodiments. Although embodiments of the present invention provide method steps as shown in the following embodiments or figures, more or fewer steps may be included in the method based on conventional or non-inventive efforts. In steps where no necessary causal relationship exists logically, the order of execution of the steps is not limited to that provided by embodiments of the present invention. The method can be executed in sequence or in parallel according to the method shown in the embodiment or the figures when the method is executed in an actual processing procedure or a device (for example, a parallel processor or an application environment of multi-thread processing).
The method for testing the applet in the embodiment of the present invention is described below with reference to the method flowchart shown in fig. 2, and the method flow of the embodiment of the present invention is described below.
Step 201: and after the fact that the applet test is started is monitored, starting local monitoring service through a preset sub-process.
Step 202: when the first project is compiled, the default event in the first project is replaced by the user-defined event, the test process of the first project is recorded based on the user-defined event, the recording case of the first project is obtained, and the recording case is recorded by the local monitoring service.
Step 203: and acquiring a recording use case of the first project based on the record corresponding to the local monitoring service.
In step 201, after it is monitored that the applet test is started, the local monitoring service is started through a preset sub-process. The preset sub-process is, for example, a node. Js subprocess, for example, when the applet test is started, another local interception service is started, and the local interception service is, for example: http://127.0.0.1: 9421.
Before the step 202, it may further be determined whether the first item is an item of a preset type, where the specific preset type may be a Page type or an App type. By the judgment, when the item is determined to be the set type item, the operation of replacing the default event with the custom event is automatically triggered. That is to say, when the first item is determined to be a preset type item and the first item corresponding to the applet is compiled, the default event in the first item is replaced by the custom event, that is, the automatic recording of the test case is realized when the first item is tested based on the custom event.
In step 202, a default event corresponding to the first item may be replaced, and the default event may be replaced with a custom event. It should be noted that, in the embodiment of the present invention, an item corresponding to an applet may include a plurality of items, or may include 1 item, which is not limited in the embodiment of the present invention, and the first item in the embodiment of the present invention may be any one of items corresponding to an applet.
Specifically, when the first project is compiled, a recording plug-in may be added to the first project, for example, the first project is an Wxa instance, and the recording plug-in is a $ $ testsutiteplus plug-in, and then the default event may be replaced with the custom event in the recording plug-in, so that when the test case is recorded, after the event is triggered, the logic in the custom event may be executed, that is, in addition to the logic for executing the default event, the recording logic implemented in the default event is also executed, so that the test process of the first project may be recorded based on the custom event, and the recorded case of the first project is recorded by the local monitoring service.
For example, assuming that a recording plug-in is added when a project in a certain applet of an instant messaging application is compiled, a custom event is used to replace a default event, so as to record a test process of a first project based on the custom event. Namely:
Figure BDA0003099071570000091
Figure BDA0003099071570000101
based on this, the default event can be replaced based on the custom event, and executed in logic of the custom event in the later execution, and the recording case of the first project can be obtained.
In the prior art, when playback test processing is performed, the element position is generally determined based on the click coordinate axis of the capture screen, and in such a manner, when playback test processing is performed, errors are easily generated, that is, the accuracy of element positioning in the prior art is poor. In view of this, the embodiment of the present invention provides a method for determining an element, so as to improve accuracy of element positioning.
After step 202, an element capture plug-in may be dynamically injected during compiling of the item corresponding to the applet, where the element capture plug-in may be named as data _ wxatestunqueid, so that when a playback test is subsequently performed on the recording case corresponding to the first item, a recording action is restored based on the data _ wxatestunqueid, and thus, an accurate playback function may be implemented.
Illustratively, the wxml file of the first item may be traversed deeply, inserting data _wxatestuniqueidby hierarchy, that is:
Figure BDA0003099071570000102
specifically, when the first item is compiled, a Parse method is rewritten, that is, a character string representation form of date and time is converted into equivalent time and date, and a wxml file of the first item is traversed; generating an identification array based on a page path, a hash string and an element identification of the wxml file of the first project; and assigning the identification array to the custom attribute of each element in the wxml file, so that a good implementation basis is provided for determining pages and elements based on the data at the preset position in the identification array, and the recording case is subjected to playback test processing based on the pages and the elements.
Illustratively, based on the page path, hash string, and element identification of the wxml file of the first item, a new identification array is generated, and the new identification array is assigned to the custom attribute of each element in the wxml file, which may be expressed as:
let newId=pagePath+hash+element.attribs.id;
element.attribs['data-_wxaTestUniqueId']=newId;
the pagePath is used for representing a page path, the hash is used for representing a hash string, the element.
It should be noted that, in the embodiment of the present invention, the new identifier array may be formed according to the order of the page path, the hash string, and the element identifier, or may be formed according to the order of the element identifier, the hash string, and the page path, which is not limited in the embodiment of the present invention.
After step 201, the state of the first item of the applet may be cleared, a new state of the first item is recorded, the new state is recorded in a local directory corresponding to the first item, and when a naming operation for the first item is received, a request is made to end the local monitoring service, and the acquisition of the recording case for the first item is completed.
In step 203, a recording use case of the first item may be obtained from a directory corresponding to the local first item, where the directory includes a recording file determined by a preset format of the recording result, for example, the preset format may be a Json file format.
In view of the above, in an exemplary embodiment of the present invention, a preset function key for recording a test case may be provided, that is, recording of a recorded test case may be implemented through the function key for recording a test case. Specifically, the user can record the test case of a certain project by using the function key for recording the test case. The recording of the test cases can be completed after the recording of the test cases is completed by the recording of the test case function keys.
For example, referring to fig. 3, a user may click a function key for recording test cases (e.g., a "record end" function key in the upper left corner of fig. 3) provided in the current page to perform a record end process, that is, may end recording of the test cases, and may pop up a prompt box for inputting a record name.
It should be noted that, in the embodiment of the present invention, the operation on the function key for recording the test case may be any mode of operation, such as clicking, long-pressing, dragging, or gesture. In addition, the display mode of the function key of the recorded test case may be that a page is clicked to trigger popup display or that a page is opened to directly display, or of course, the function key may also be triggered to display on the page in other modes, which is not limited in the embodiment of the present disclosure. Moreover, the identifier of the function key for recording the test case may be a rectangle as shown in fig. 3, a polygon, a drop shape, a circle or an ellipse, or may be formed by combining the shapes or the form with the characters or other characters, which is not limited in the embodiment of the present invention.
Specifically, when the recording of the test case of the first project is determined to be finished, a Confirm box in the component can be triggered, and a prompt box for inputting the recording name pops up on a page, so that a user can input the recording name, namely, when the naming operation of the first project is received, a createScript custom event can be triggered, namely, an Http request is sent to the local monitoring service, and the recording of the recording case of the first project is completed.
After step 203, playback test processing may be performed on the recorded case. Specifically, the playback test processing on the recording case may include, but is not limited to, the following steps:
step 1: and determining a recording case according to the path of the first project and the test recording name.
In this step, a corresponding recording case may be determined from a directory corresponding to the local monitoring service according to the path of the first item and the test recording name.
Step 2: and circularly traversing the recording case to obtain the recording operation of testing the first project.
Step 3: analyzing the custom attribute corresponding to the recording operation to obtain an identification array corresponding to each event in the first item; the identification array is used for indicating elements and pages corresponding to each event.
Step 4: and performing playback test processing on the recording case based on the identification array.
At Step4, determining first data identifying a first preset position in an array and second data identifying a second preset position; the first data is used for indicating a page path corresponding to an event in the first project, and the second data is used for indicating an element corresponding to the event in the first project; and performing playback test processing on the recording case based on the first data and the second data.
For example, the first preset position and the second preset position may be correspondingly determined based on the order of assignment of the customized attribute of the recording operation.
For example, if the identifier array is generated according to the order of the page path, the hash string, and the element identifier of the wxml file of the first item, the first bit in the identifier array obtained after the custom attribute of the recording operation determined in the recording case is analyzed may be determined as the page path, and the specified element of the current page is determined based on the third bit.
Illustratively, the playback test processing for the first item may be performed based on:
Figure BDA0003099071570000131
Figure BDA0003099071570000141
therefore, based on the scheme provided by the embodiment of the invention, the test case can be automatically recorded, namely, the test efficiency is improved. In addition, because the elements are positioned based on the custom attributes, the problem of playback failure caused by the element positioning problem is reduced, and the accuracy and the stability of test playback are improved.
As shown in fig. 4, the present invention provides an applet testing apparatus, comprising: the triggering module 401 is configured to start a local monitoring service through a preset subprocess after it is monitored that the applet test is started; a processing module 402, configured to, when a first project is compiled, replace a default event in the first project with a custom event, record a test process of the first project based on the custom event, obtain a recording case of the first project, where the recording case is recorded by the local monitoring service; the obtaining module 403 is further configured to obtain a recording use case for the first item based on the record corresponding to the local monitoring service.
Optionally, the apparatus further includes a determining module, configured to: determining whether the first item is an item of a preset type; the preset type comprises a Page type or an App type; when the first item is determined to be a preset type item, when the first item is compiled, replacing a default event in the first item with a custom event.
Optionally, the apparatus further includes a first processing module, configured to: performing cyclic traversal on the recording case to obtain the recording operation of testing the first project; analyzing the custom attribute corresponding to the recording operation to obtain an identification array corresponding to each event in the first item; the identification array is used for indicating elements and pages corresponding to each event; and performing playback test processing on the recording case based on the identification array.
Optionally, the first processing module is specifically configured to: determining first data of a first preset position and second data of a second preset position in the identification array; the first data is used for indicating a page path corresponding to an event in the first project, and the second data is used for indicating an element corresponding to the event in the first project; and performing playback test processing on the recording case based on the first data and the second data.
Optionally, the custom attribute is determined based on the following manner: traversing the wxml file of the first item; generating a new identification array based on the page path, the hash string and the element identification of the wxml file of the first item; and assigning the new identification array to a custom attribute corresponding to each event in the wxml file.
Optionally, the apparatus further includes a recording module, configured to: clearing the existing state of a first item of the applet, recording the new state of the first item, and recording the new state to a local directory corresponding to the first item; and when the naming operation of the first project is received, requesting to end the local monitoring service, and completing recording of the recording use case of the first project.
Optionally, the obtaining module 403 is configured to: acquiring a recording use case of the first project from a local directory corresponding to the first project; and the directory comprises a recording file determined in a preset format based on the recording result.
Embodiments of the present invention provide a computer device, which includes a program or an instruction, and when the program or the instruction is executed, the program or the instruction is used to execute an applet testing method and any optional method provided by embodiments of the present invention.
The embodiment of the invention provides a storage medium which comprises a program or an instruction, and when the program or the instruction is executed, the program or the instruction is used for executing the small program testing method and any optional method provided by the embodiment of the invention.
Finally, it should be noted that: as will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present invention without departing from the scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. An applet testing method comprising:
after the fact that the small program test is started is monitored, starting local monitoring service through a preset sub-process;
when a first project is compiled, replacing a default event in the first project with a user-defined event, recording a test process of the first project based on the user-defined event, and obtaining a recording case of the first project, wherein the recording case is recorded by the local monitoring service;
and acquiring a recording use case of the first project based on the record corresponding to the local monitoring service.
2. The method of claim 1, wherein prior to replacing a default event in the first project with a custom event when the first project is compiled, the method further comprises:
determining whether the first item is an item of a preset type; the preset type comprises a Page type or an App type;
when the first item is determined to be a preset type item, when the first item is compiled, replacing a default event in the first item with a custom event.
3. The method of claim 1 or 2, wherein after obtaining the recording use case for the first item, the method further comprises:
performing cyclic traversal on the recording case to obtain the recording operation of testing the first project;
analyzing the custom attribute corresponding to the recording operation to obtain an identification array corresponding to each event in the first item; the identification array is used for indicating elements and pages corresponding to each event;
and performing playback test processing on the recording case based on the identification array.
4. The method of claim 3, wherein the performing playback test processing on the recording case based on the identification array comprises:
determining first data of a first preset position and second data of a second preset position in the identification array; the first data is used for indicating a page path corresponding to an event in the first project, and the second data is used for indicating an element corresponding to the event in the first project;
and performing playback test processing on the recording case based on the first data and the second data.
5. The method of claim 3, wherein the custom attribute is determined based on:
traversing the wxml file of the first item;
generating a new identification array based on the page path, the hash string and the element identification of the wxml file of the first item;
and assigning the new identification array to a custom attribute corresponding to each event in the wxml file.
6. The method of claim 1 or 2, wherein after the local listening service is initiated by the pre-defined sub-process, the method further comprises:
clearing the existing state of a first item of the applet, recording the new state of the first item, and recording the new state to a local directory corresponding to the first item;
and when the naming operation of the first project is received, requesting to end the local monitoring service, and completing recording of the recording use case of the first project.
7. The method of claim 6, wherein the obtaining the recording use case of the first item based on the record corresponding to the local listening service comprises:
acquiring a recording use case of the first project from a local directory corresponding to the first project; and the directory comprises a recording file determined in a preset format based on the recording result.
8. An applet testing apparatus, comprising:
the trigger module is used for starting the local monitoring service through a preset subprocess after the small program test is monitored to be started;
the processing module is used for replacing a default event in the first project with a custom event when the first project is compiled, recording a test process of the first project based on the custom event, and obtaining a recording case of the first project, wherein the recording case is recorded by the local monitoring service;
the obtaining module is further configured to obtain a recording use case of the first project based on the record corresponding to the local monitoring service.
9. A computer device comprising a program or instructions that, when executed, perform the method of any of claims 1 to 7.
10. A storage medium comprising a program or instructions which, when executed, perform the method of any one of claims 1 to 7.
CN202110619251.8A 2021-06-03 2021-06-03 Applet testing method and device Pending CN113326193A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110619251.8A CN113326193A (en) 2021-06-03 2021-06-03 Applet testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110619251.8A CN113326193A (en) 2021-06-03 2021-06-03 Applet testing method and device

Publications (1)

Publication Number Publication Date
CN113326193A true CN113326193A (en) 2021-08-31

Family

ID=77421020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110619251.8A Pending CN113326193A (en) 2021-06-03 2021-06-03 Applet testing method and device

Country Status (1)

Country Link
CN (1) CN113326193A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117667748A (en) * 2024-01-31 2024-03-08 成都翌创微电子有限公司 Chip system level verification method based on composite framework

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117667748A (en) * 2024-01-31 2024-03-08 成都翌创微电子有限公司 Chip system level verification method based on composite framework
CN117667748B (en) * 2024-01-31 2024-04-09 成都翌创微电子有限公司 Chip system level verification method based on composite framework

Similar Documents

Publication Publication Date Title
US10552301B2 (en) Completing functional testing
US8312322B2 (en) System for automated generation of computer test procedures
WO2018010552A1 (en) Test method and device
US8434062B2 (en) Enhancing source code debugging and readability using visual symbols
CN104572463B (en) The method and device of test interface information
US20110016452A1 (en) Method and system for identifying regression test cases for a software
AU2017258963A1 (en) Simultaneous multi-platform testing
US9176840B2 (en) Tool for analyzing and resolving errors in a process server
US20150026666A1 (en) Analysis system, analysis method, and computer program product
CN111832236A (en) Chip regression testing method and system, electronic equipment and storage medium
KR20170052668A (en) Data-driven testing framework
Manner et al. Troubleshooting serverless functions: a combined monitoring and debugging approach
CN108874649B (en) Method and device for generating automatic test script and computer equipment thereof
US11422917B2 (en) Deriving software application dependency trees for white-box testing
US20200327043A1 (en) System and a method for automated script generation for application testing
EP3333712A2 (en) Simultaneous multi-platform testing
US20180232299A1 (en) Composing future tests
CN107038117B (en) Web automatic testing method based on definition-reference between event processing functions
US20130339798A1 (en) Methods for automated software testing and devices thereof
US9563541B2 (en) Software defect detection identifying location of diverging paths
CN110928760B (en) Unit test method and device in embedded system
CN110543429A (en) Test case debugging method and device and storage medium
CN113326193A (en) Applet testing method and device
CN111966575A (en) Graphic automation test method for airborne display software
Jain et al. Comparative study of software automation testing tools: OpenScript and selenium

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