CN112579425A - Method, device and medium for testing small program method interface - Google Patents

Method, device and medium for testing small program method interface Download PDF

Info

Publication number
CN112579425A
CN112579425A CN201910927609.6A CN201910927609A CN112579425A CN 112579425 A CN112579425 A CN 112579425A CN 201910927609 A CN201910927609 A CN 201910927609A CN 112579425 A CN112579425 A CN 112579425A
Authority
CN
China
Prior art keywords
page
test
applet
tested
small program
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
CN201910927609.6A
Other languages
Chinese (zh)
Inventor
陈俊杰
黄晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910927609.6A priority Critical patent/CN112579425A/en
Publication of CN112579425A publication Critical patent/CN112579425A/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

Abstract

The invention discloses a method, a device and a medium for testing a small program method interface, wherein the method comprises the steps of obtaining a page to be tested of a small program; when the page to be tested of the small program meets the condition of newly building a test page, newly building a small program test page running in a main program corresponding to the small program; adding the page to be tested as a component into the applet test page, and establishing an incidence relation between the page to be tested and the applet test page; and realizing the test case for testing the page to be tested in the applet test page in a function mode to obtain a test case method, and operating the test case by calling the test case method in the applet test page. The method and the system can freely test the method interfaces of the native applet or the non-native applet, and have good compatibility.

Description

Method, device and medium for testing small program method interface
Technical Field
The present invention relates to the field of unit testing, and in particular, to a method, an apparatus, and a medium for testing an applet method interface.
Background
As the popularity of applets increases, the need for testing of applets is also becoming more stringent. However, the test framework specifically applied to the small programs in the prior art is not mature, and the existing front-end test framework cannot adapt to the test of the small programs.
For example, classical front-end testing frameworks such as JEST and Mocha cannot obtain the login state of the main program corresponding to the applet, and therefore, the interface in the applet cannot be tested separately. The test framework Automator special for the small program can only operate in a development tool at present and cannot be independently transplanted to a real machine to operate; all internal interfaces cannot be touched, and if the internal methods of the main program page and the components are not mounted, the input methods mounted on the input box and the like cannot be tested; and support for applets developed in a non-native manner based on third party frameworks such as Mpvue, WePY is very unfriendly.
Disclosure of Invention
In order to solve the technical problems that various test frames in the prior art cannot reach various interfaces of an applet, a test blind area exists, and the test support degree of the applet developed in a non-native mode is insufficient, embodiments of the present invention provide a method, an apparatus, and a medium for testing an applet method interface.
In one aspect, the present invention provides a method for testing an applet method interface, the method comprising:
acquiring a page to be tested of the small program;
when the page to be tested of the small program meets the condition of newly building a test page, newly building a small program test page running in a main program corresponding to the small program;
adding the page to be tested as a component into the applet test page, and establishing an incidence relation between the page to be tested and the applet test page;
and realizing the test case for testing the page to be tested in the applet test page in a function mode to obtain a test case method, and operating the test case by calling the test case method in the applet test page.
In another aspect, the present invention provides an apparatus for testing an applet method interface, the apparatus comprising:
the page to be tested acquisition module is used for acquiring a page to be tested of the small program;
the small program test page creating module is used for creating a small program test page running in the main program corresponding to the small program when the page to be tested of the small program meets the condition of creating the new test page;
the association module is used for adding the page to be tested into the applet test page as a component and establishing an association relation between the page to be tested and the applet test page;
and the test module is used for realizing the test case for testing the page to be tested in the applet test page in a functional form to obtain a test case method, and operating the test case by calling the test case method in the applet test page.
In another aspect, the present invention provides an apparatus for testing an applet method interface, the apparatus comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, set of codes or set of instructions, the at least one instruction, the at least one program, the set of codes or set of instructions being loaded and executed by the processor to implement a method for testing an applet method interface.
In another aspect, the present invention provides a computer storage medium having stored therein at least one instruction, at least one program, set of codes, or set of instructions that is loaded by a processor and that performs a method for testing an applet method interface.
The invention provides a method, a device and a medium for testing an applet method interface. The invention creates the small program test page in the main program so as to share the login state with the main program, and establishes the incidence relation between the small program test page and the page to be tested under various conditions, so that various method interfaces in the page to be tested can be called in the small program test page, and the purpose of testing the method interfaces of the page to be tested is further achieved. The method and the system can freely test the method interfaces of the native applet or the non-native applet, and have good compatibility.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of the present invention providing a test applet using a conventional test framework such as Mocha, JEST, etc.;
FIG. 2 is a schematic diagram of an applet tested using an automatic test framework such as Automater, provided in the present invention;
FIG. 3 is a schematic diagram of a possible real machine implementation environment for a method for testing an applet method interface provided by the present invention;
FIG. 4 is a software framework diagram of a method implementation environment for testing an applet method interface provided by the present invention;
FIG. 5 is a flow chart of a method for testing an applet method interface provided by the present invention;
FIG. 6 is a flowchart of creating an applet test page running in a main program corresponding to the applet when a page to be tested of the applet meets a new test page condition according to the present invention;
FIG. 7 is a flowchart illustrating a process of determining if a page to be tested of the applet does not meet the condition of creating a new test page according to the present invention;
FIG. 8 is a flow chart of an applet-based test page test provided by the present invention;
FIG. 9 is a schematic diagram illustrating an implementation effect of a method for testing an applet method interface according to an embodiment of the present invention;
FIG. 10 is a block diagram of an apparatus for testing an applet method interface provided in the present invention;
fig. 11 is a hardware structural diagram of an apparatus for implementing the method provided by the embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above 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 data so used is 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. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In order to make the objects, technical solutions and advantages disclosed in the embodiments of the present invention more clearly apparent, the embodiments of the present invention are described in further detail below with reference to the accompanying drawings and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of the invention and are not intended to limit the embodiments of the invention.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present embodiment, "a plurality" means two or more unless otherwise specified. In order to facilitate understanding of the technical solutions and the technical effects thereof described in the embodiments of the present invention, the embodiments of the present invention first explain related terms:
JEST is a JavaScript unit test framework for FaceBook opening, and can be widely used in unit/interface test of front-end H5 page. In addition to Facebook, JEST is also currently used by internet products such as Twitter, Nytimes, Airbnb. Besides basic assertion and Mock testing functions, JEST also has practical functions such as snapshot testing, real-time monitoring mode, coverage reporting and the like. And JEST requires almost no configuration to be used.
Unit testing: test work for checking the correctness of a module, a function or a class.
JavaScript: an transliterated script language is a dynamic type, weak type, prototype-based language and built-in support type. Its interpreter, called JavaScript engine, is a part of the browser, a scripting language widely used on clients, and was originally used on HTML (an application under the standard universal markup language) web pages to add dynamic functionality to the HTML web pages.
And (4) Mock testing: the Mock test is a test method which is created by using a virtual object for some objects which are not easy to construct or obtain in the test process.
H5: generation 5 HTML, which may be used to refer to digital products made in the alternate H5 language. HTML is the english abbreviation of "hypertext markup language". "hypertext" means that a page may contain pictures, links, and even non-textual elements such as music, programs, etc.
Mocha: the unit testing framework of the JavaScript can be operated in a browser environment, can also be operated in a development platform environment of a server side, and is widely used in unit/interface testing of a front-end H5 page. By using the Mocha, only the writing unit test itself needs to be concentrated, and then the Mocha is enabled to automatically run all tests and give test results. Mocha can test both simple JavaScript functions and asynchronous codes.
Automator: an automatic test framework for small programs.
The small program: the small program takes the main program as a carrier and is parasitized in the running environment of the main program to provide service for users.
Mpvue: a small program development framework for the production of a group of American points evaluation team following the Web development idea.
WePY: WePY is a framework for supporting the modular development of the small program, and a developer can select a favorite development style to develop the small program through a precompilation means. The details of the framework are optimized, and the development of the small program project can be simpler and more efficient.
Assertion: is a programming term, expressed as some boolean expression, that enables assertions at test time and disables assertions at deployment time. Using assertions can create code that is more stable, better quality, and less prone to errors. An assertion may be used when it is desired to interrupt the current operation when a value is FALSE. Unit testing based on certain components must use assertions.
Assembly of: the Component (Component) is a simple encapsulation of data and methods. The components may have their own properties and methods. Attributes are simple visitors of component data, and methods are some simple and visible functions of a component. The use of components can enable drag-and-drop programming, fast property handling, and true object-oriented design.
Referring to FIG. 1, a schematic diagram of a test applet using a conventional test framework such as Mocha, JEST, etc. is shown. The small program runs in the running environment of the main program, the external test frame can access the small program only on the premise of acquiring the login state of the main program, and the traditional test frame cannot acquire the login state of the main program, so that each interface inside the small program cannot be touched, and the interface test of the small program cannot be realized.
Referring to FIG. 2, a schematic diagram of an applet testing using an Automate or similar applet automatic test framework is shown. The Automater can reach part of interfaces in the applet, but has a plurality of limitations, cannot reach all internal interfaces of the applet, is not friendly to the support of the non-native developed applet, and is difficult to be used in a real machine environment.
In order to solve the problems that various test frames in the prior art cannot reach various interfaces of an applet, have test blind areas, and the test support degree of the applet developed in a non-native mode is insufficient, the embodiment of the invention provides a method for testing the method interface of the applet, and the test method can be operated in a development environment or a real machine environment.
One possible real machine implementation environment for the method for testing an applet method interface is shown in fig. 3. The real-machine implementation environment may be an electronic device such as a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), and the like, and the specific type of the electronic device is not limited in the embodiment of the present application.
The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like. It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processor (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processor (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bi-directional synchronous serial bus that includes a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K via an I2C interface, such that the processor 110 and the touch sensor 180K communicate via an I2C bus interface to implement the touch functionality of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may communicate audio signals to the wireless communication module 160 via the I2S interface, enabling answering of calls via a bluetooth headset.
The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled by a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to implement a function of answering a call through a bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a bluetooth headset.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the capture functionality of electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, and the like.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a MiniUSB interface, a microsusb interface, a USB type c interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other electronic devices, such as AR devices and the like.
It should be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only an illustration, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be separate from the processor 110 and may be located in the same device as the mobile communication module or other functional modules.
The wireless communication module 160 may provide a solution for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Global Navigation Satellite Systems (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (TDSCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou satellite navigation system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may employ a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-o led, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, with N being a positive integer greater than 1.
The electronic device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image visible to naked eyes. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. Applications such as intelligent recognition of the electronic device 100 can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a MicroSD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high speed random access memory, and may further include a nonvolatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus 100 can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic apparatus 100 receives a call or voice information, it can receive voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking the user's mouth near the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C to achieve a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, perform directional recording, and so on.
The headphone interface 170D is used to connect a wired headphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a CTIA (cellular telecommunications industry association) standard interface.
The pressure sensor 180A is used for sensing a pressure signal, and converting the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A can be of a wide variety, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic apparatus 100 may also calculate the touched position from the detection signal of the pressure sensor 180A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., the x, y, and z axes) may be determined by gyroscope sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects a shake angle of the electronic device 100, calculates a distance to be compensated for by the lens module according to the shake angle, and allows the lens to counteract the shake of the electronic device 100 through a reverse movement, thereby achieving anti-shake. The gyroscope sensor 180B may also be used for navigation, somatosensory gaming scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude, aiding in positioning and navigation, from barometric pressure values measured by barometric pressure sensor 180C.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. And then according to the opening and closing state of the leather sheath or the opening and closing state of the flip cover, the automatic unlocking of the flip cover is set.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. The method can also be used for recognizing the posture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, taking a picture of a scene, electronic device 100 may utilize range sensor 180F to range for fast focus.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light to the outside through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there are no objects near the electronic device. The electronic device 100 can utilize the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to achieve the purpose of saving power. The proximity light sensor 180G may also be used in a holster mode, a pocket mode automatically unlocks and locks the screen.
The ambient light sensor 180L is used to sense the ambient light level. Electronic device 100 may adaptively adjust the brightness of display screen 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust the white balance when taking a picture. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 can utilize the collected fingerprint characteristics to unlock the fingerprint, access the application lock, photograph the fingerprint, answer an incoming call with the fingerprint, and so on.
The temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 implements a temperature processing strategy using the temperature detected by temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 performs a reduction in performance of a processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, the electronic device 100 heats the battery 142 when the temperature is below another threshold to avoid the low temperature causing the electronic device 100 to shut down abnormally. In other embodiments, when the temperature is lower than a further threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, the bone conduction sensor 180M may acquire a vibration signal of the human vocal part vibrating the bone mass. The bone conduction sensor 180M may also contact the human pulse to receive the blood pressure pulsation signal. In some embodiments, the bone conduction sensor 180M may also be disposed in a headset, integrated into a bone conduction headset. The audio module 170 may analyze a voice signal based on the vibration signal of the bone mass vibrated by the sound part acquired by the bone conduction sensor 180M, so as to implement a voice function. The application processor can analyze heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so as to realize the heart rate detection function.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be brought into and out of contact with the electronic apparatus 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support a NanoSIM card, a MicroSIM card, a SIM card, etc. The same SIM card interface 195 can be inserted with multiple cards at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
As shown in fig. 4, there is a software framework diagram illustrating a method implementation environment for testing an applet method interface, which may be the live machine environment shown in fig. 3. The software system of the implementation environment may employ a hierarchical architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the application takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of an implementation environment.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, which are an application layer, an application framework layer, an Android runtime and system library, and a kernel layer from top to bottom. The application layer may include a series of application packages.
The application layer may include various applications, and the method for testing the applet method interface according to the embodiment of the present invention is a method for testing the method interface of an applet in the application layer. And the main program parasitized by the small program is used as an application program to run on an application program layer.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
The Android runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling of an Android system and a core library comprises two parts.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media libraries (media libraries), three-dimensional graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), and the like.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
Referring to FIG. 5, a flow diagram of a method for testing an applet method interface is shown, which may be run in the implementation environment of FIG. 3 and which may include:
s101, obtaining a page to be tested of the small program.
And S103, when the page to be tested of the small program meets the condition of newly-built test pages, newly building small program test pages running in the main program corresponding to the small program.
In view of the fact that the applet automatic test framework in the prior art is not friendly to the support of the non-native applet, in order to provide the support of the test of the non-native applet, in the embodiment of the present invention, whether the applet is the native applet or not may be used as a new test page condition, that is, when a page to be tested of the applet meets the new test page condition, a new applet test page running in a main program corresponding to the applet is created, as shown in fig. 6, including:
and S1031, judging whether the page to be detected of the small program is a native small program page.
S1033, if the page is not the original small program page, judging that the page to be tested of the small program meets the condition of a newly-built test page.
When the page to be tested of the applet is a native applet page, it may also be considered to use an applet automatic test framework in the prior art, such as an Automater, so that the determining whether the page to be tested of the applet is a native applet page further includes:
s1035, if the original small program page is obtained, judging whether a to-be-tested method interface in the to-be-tested page of the small program can be touched by a preset small program automatic testing frame;
and S1037, if not, judging that the page to be tested of the small program meets the condition of a newly-built test page.
The automatic test framework of the small program in the prior art can touch most of interfaces in the original small program page, but can not touch some special interfaces, if the interface of the method to be tested belongs to the special interface, the automatic test framework of the small program in the prior art can not achieve the test purpose, and the condition also accords with the condition of a newly-built test page.
The method comprises the steps that the interface of the page to be tested of the applet is divided into a method interface and a communication interface, the method interface can be used for achieving a certain specific non-communication function, and the communication interface can be used for communicating with other equipment so as to perform data interaction with the other equipment. The interfaces of the method to be tested in the embodiment of the invention all belong to method interfaces.
Correspondingly, if yes, it is determined that the page to be tested of the applet does not conform to the newly-built test page condition, as shown in fig. 7, if the page to be tested of the applet does not conform to the newly-built test page condition, then:
s201, obtaining a test case set for testing the page to be tested of the small program.
Specifically, the test case set may include one or more test cases, and the test case set may implement access to a method interface to be tested of a page to be tested of the applet by calling a relevant interface in a preset applet automatic test framework.
S203, the test case set is operated based on a preset small program automatic test framework.
Specifically, the preset applet automatic test framework is used for testing a native applet page, such as an Automater test framework.
And S205, obtaining a test result output by the small program automatic test framework.
Taking the Automater test framework as an example, it can output the test result through the assertion form.
Step S103 in the embodiment of the present invention is to create an applet test page running in a main program corresponding to the applet, and use the applet test page as a load page of a page to be tested, so as to achieve the purpose of touching a method interface to be tested in the page to be tested.
And S105, adding the page to be tested into the applet test page as a component, and establishing an association relation between the page to be tested and the applet test page.
In order to achieve the purpose of testing the page to be tested based on the applet test page, the page to be tested is required to be added to the applet test page as an assembly, so that the incidence relation between the page to be tested and the applet test page is established, and the purpose of testing the page to be tested is achieved by taking the applet test page as a middleware. The small program test page is established based on the main program, so that the small program test page and the main program share a login state, when a method interface to be tested is called in a method associated with the small program test page, the purpose of testing the method interface to be tested can be achieved by operating the method in the small program test page, and the technical problem that the method interface in the small program cannot be tested because the login state of the main program cannot be obtained in the prior art is solved.
Adding the page to be tested as a component to the applet test page, including:
s1051, if the page to be tested of the small program is a non-native small program page, declaring the page to be tested as a component in the small program test page.
S1053, if the page to be tested of the small program is a native small program page, modifying the configuration file of the small program test page so as to configure the page to be tested into the component of the small program test page in the configuration file.
Taking the WeChat small program as an example, a small program test page is newly created in the WeChat main program, the corresponding configuration file is modified, and the page to be tested is added into the using Compounds.
As shown in fig. 8, the establishing of the association relationship between the page to be tested and the applet test page includes:
s1055, if the page to be tested of the small program is a non-native small program page, setting a reference value of the page to be tested in the small program test page, and establishing an incidence relation between the page to be tested and the small program test page in a mode that a pointer pointing to the small program test page accesses the reference value.
Specifically, a ref attribute of the page to be tested can be added to the applet test page, and the test page attribute value is set by setting the value of the ref attribute. For example, setting ref value XXX of page a to be tested in applet test pages a-test, the invocation of method interface and attribute value modification of page a to be tested can be realized through this. $ refs.
S1057, if the page to be tested of the small program is a native small program page, setting a class associated with the page to be tested in the small program test page, and establishing an association relation between the page to be tested and the small program test page in a class reference mode.
Specifically, common attributes such as id and class can be added to the page a to be tested, then the class XXX associated with the page to be tested is set in the applet test page a-test, the page a to be tested can be located through this.
S107, the test case for testing the page to be tested is realized in the small program test page in a functional mode to obtain a test case method, and the test case is operated by calling the test case method in the small program test page.
Specifically, the test case is used to implement the test on the interface of the method to be tested in the page to be tested, so that the test case inevitably requires to access the interface of the method to be tested, and on the basis of establishing the association relationship between the page to be tested and the applet test page in step S105, the test case method in the applet test page can contact the interface of the method to be tested, thereby correctly running the test case.
On the basis of accurately realizing the method logic of the test case, the test case method can further improve the test logic by modifying the associated attribute value of the page to be tested, checking the input and output values of the interface of the method to be tested and the like, and record the test result in the test case method. Different from the limitations of the prior art on the interface test of the small program method, the embodiment of the invention can support the test of each interface of the method to be tested in all the relevant scenes.
In a preferred embodiment, all the method interfaces of the page to be tested can be scanned based on preset rules, and test cases for testing each method interface are automatically generated, so that the labor cost is remarkably saved.
In a preferred embodiment, in order to facilitate the execution of the test case, the running the test case by calling the test case method in the applet test page, as shown in fig. 8, includes:
s1071, setting a control, and associating the trigger event of the control with at least one test case method.
S1073, monitoring a trigger event of the control, and running a test case method associated with the trigger event when the trigger event occurs.
The test method including steps S101-S107 may be run in a code environment, and the execution of the test case method may be controlled by writing code or using a code debugging tool. In a real machine environment or a simulated machine environment, a user cannot touch a code environment, and the execution of a test flow needs to be controlled through a control. Therefore, in order to improve the testing efficiency and enable a user to test the interface of the method to be tested of the page to be tested in the non-code environment, the embodiment of the invention also triggers the execution of the test case method by setting the control.
In one possible embodiment, the controls include a list control and a button control. The identifiers corresponding to the test case methods can be displayed in a list mode, the selection result of the user on each identifier in the list control is obtained, and the test case method corresponding to the selection result is operated under the triggering of the button control.
In another possible embodiment, the control includes a button control, the trigger event of the button control is associated with a first test case method in the test case method sequence, and the button control is triggered to trigger sequential execution of each test case method in the test case method sequence.
In another possible embodiment, the control includes a plurality of button controls, each button control is associated with one test case method, and the test case method associated with the button control is run by triggering the button control.
The embodiment of the invention shares the login state with the main program by newly creating the small program test page in the main program, and can invoke various method interfaces in the page to be tested in the small program test page by establishing the incidence relation between the small program test page and the page to be tested under various conditions, thereby achieving the purpose of testing the method interfaces of the page to be tested. The small program test page is established in the main program, can share the login state with the main program, and essentially still belongs to the small program, so that the small program test page can be used as the middleware to realize the test of the page to be tested which is also the small program. Fig. 9 is a schematic diagram illustrating an implementation effect of a method for testing an applet method interface according to an embodiment of the present invention. The test case method can be called based on a test frame or mounted based on a control, and all method interfaces in the page to be tested can be completely touched by taking the small program test page as a medium without being limited by any other conditions. The method and the device can freely test the method and the interface of the native applet or the non-native applet, and have good compatibility.
An embodiment of the present invention further provides a device for testing an applet method interface, as shown in fig. 10, including:
a to-be-tested page obtaining module 201, configured to obtain a to-be-tested page of an applet;
the small program test page creating module 203 is used for creating a small program test page running in the main program corresponding to the small program when the page to be tested of the small program meets the condition of creating the new test page;
the association module 205 is configured to add the page to be tested as a component to the applet test page, and establish an association relationship between the page to be tested and the applet test page;
the test module 207 is configured to implement a test case for testing the page to be tested in the applet test page in a functional form to obtain a test case method, and execute the test case by calling the test case method in the applet test page.
Further, the apparatus may further include:
a test case set obtaining module 202, configured to obtain a test case set used for testing a page to be tested of the applet;
the automatic test module 204 is used for running the test case set based on a preset applet automatic test framework;
and the test result output module 206 is configured to obtain the test result output by the applet automatic test framework.
Specifically, the apparatus and the method for testing an applet method interface according to the embodiments of the present invention are all based on the same inventive concept. For details, please refer to the method embodiment, which is not described herein.
The embodiment of the invention also provides a computer storage medium, and the computer storage medium can store a plurality of instructions. The instructions may be adapted to be loaded by a processor and to perform a method for testing an applet method interface according to an embodiment of the invention, the method comprising at least the steps of:
a method for testing an applet method interface, the method comprising:
acquiring a page to be tested of the small program;
when the page to be tested of the small program meets the condition of newly building a test page, newly building a small program test page running in a main program corresponding to the small program;
adding the page to be tested as a component into the applet test page, and establishing an incidence relation between the page to be tested and the applet test page;
and realizing the test case for testing the page to be tested in the applet test page in a function mode to obtain a test case method, and operating the test case by calling the test case method in the applet test page.
In a preferred embodiment, when the page to be tested of the applet meets a new test page condition, newly creating an applet test page running in the main program corresponding to the applet, including:
judging whether the page to be detected of the small program is a native small program page or not;
if the page is not the original small program page, judging that the page to be tested of the small program meets the condition of a newly-built test page;
if the native applet page is the native applet page, judging whether a to-be-tested method interface in the to-be-tested page of the applet can be touched by a preset applet automatic test framework;
and if not, judging that the page to be tested of the applet meets the condition of the newly-built test page.
In a preferred embodiment, if yes, it is determined that the page to be tested of the applet does not meet the new test page condition, and if not, the method further includes:
acquiring a test case set for testing a page to be tested of the applet;
running the test case set based on a preset applet automatic test framework;
and acquiring a test result output by the small program automatic test framework.
In a preferred embodiment, the adding the page to be tested as a component to the applet test page includes:
if the page to be tested of the small program is a non-native small program page, declaring the page to be tested as a component in the small program test page;
and if the page to be tested of the applet is a native applet page, modifying the configuration file of the applet test page so as to configure the page to be tested as a component of the applet test page in the configuration file.
In a preferred embodiment, the establishing the association relationship between the page to be tested and the applet test page includes:
if the page to be tested of the small program is a non-native small program page, setting a reference value of the page to be tested in the small program test page, and establishing an incidence relation between the page to be tested and the small program test page in a mode that a pointer pointing to the small program test page accesses the reference value;
if the page to be tested of the small program is a native small program page, setting a class associated with the page to be tested in the small program test page, and establishing an association relation between the page to be tested and the small program test page in a class reference mode.
In a preferred embodiment, the running the test case by calling the test case method in the applet test page includes:
setting a control, and associating a trigger event of the control with at least one test case method;
monitoring a trigger event of the control, and running a test case method associated with the trigger event when the trigger event occurs.
Further, fig. 11 shows a hardware structure diagram of an apparatus for implementing the method provided by the embodiment of the present invention, and the apparatus may participate in forming or containing the device or system provided by the embodiment of the present invention. As shown in fig. 11, the device 10 may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration and is not intended to limit the structure of the electronic device. For example, device 10 may also include more or fewer components than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuitry may be a single, stand-alone processing module, or incorporated in whole or in part into any of the other elements in the device 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used for storing software programs and modules of application software, such as program instructions/data storage devices corresponding to the methods described in the embodiments of the present invention, and the processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 104, namely, implementing one of the methods for testing an applet method interface described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of such networks may include wireless networks provided by the communication provider of the device 10. In one example, the transmission device 106 includes a network adapter (NIC) that can be connected to other network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the device 10 (or mobile device).
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device and server embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the partial description of the method embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for testing an applet method interface, the method comprising:
acquiring a page to be tested of the small program;
when the page to be tested of the small program meets the condition of newly building a test page, newly building a small program test page running in a main program corresponding to the small program;
adding the page to be tested as a component into the applet test page, and establishing an incidence relation between the page to be tested and the applet test page;
and realizing the test case for testing the page to be tested in the applet test page in a function mode to obtain a test case method, and operating the test case by calling the test case method in the applet test page.
2. The method of claim 1, wherein when the page to be tested of the applet meets a new test page condition, newly creating an applet test page running in a main program corresponding to the applet, comprising:
judging whether the page to be detected of the small program is a native small program page or not;
if the page is not the original small program page, judging that the page to be tested of the small program meets the condition of a newly-built test page;
if the native applet page is the native applet page, judging whether a to-be-tested method interface in the to-be-tested page of the applet can be touched by a preset applet automatic test framework;
and if not, judging that the page to be tested of the applet meets the condition of the newly-built test page.
3. The method of claim 2, wherein if yes, determining that the page to be tested of the applet does not comply with the new test page condition, and if the page to be tested of the applet does not comply with the new test page condition, the method further comprises:
acquiring a test case set for testing a page to be tested of the applet;
running the test case set based on a preset applet automatic test framework;
and acquiring a test result output by the small program automatic test framework.
4. The method of claim 1, wherein adding the page under test as a component to the applet test page comprises:
if the page to be tested of the small program is a non-native small program page, declaring the page to be tested as a component in the small program test page;
and if the page to be tested of the applet is a native applet page, modifying the configuration file of the applet test page so as to configure the page to be tested as a component of the applet test page in the configuration file.
5. The method of claim 1, wherein the establishing the association relationship between the page to be tested and the applet test page comprises:
if the page to be tested of the small program is a non-native small program page, setting a reference value of the page to be tested in the small program test page, and establishing an incidence relation between the page to be tested and the small program test page in a mode that a pointer pointing to the small program test page accesses the reference value;
if the page to be tested of the small program is a native small program page, setting a class associated with the page to be tested in the small program test page, and establishing an association relation between the page to be tested and the small program test page in a class reference mode.
6. The method of claim 1, wherein the running the test case by calling a test case method in the applet test page comprises:
setting a control, and associating a trigger event of the control with at least one test case method;
monitoring a trigger event of the control, and running a test case method associated with the trigger event when the trigger event occurs.
7. An apparatus for testing an applet method interface, the apparatus comprising:
the page to be tested acquisition module is used for acquiring a page to be tested of the small program;
the small program test page creating module is used for creating a small program test page running in the main program corresponding to the small program when the page to be tested of the small program meets the condition of creating the new test page;
the association module is used for adding the page to be tested into the applet test page as a component and establishing an association relation between the page to be tested and the applet test page;
and the test module is used for realizing the test case for testing the page to be tested in the applet test page in a functional form to obtain a test case method, and operating the test case by calling the test case method in the applet test page.
8. The apparatus of claim 7, further comprising:
the test case set acquisition module is used for acquiring a test case set used for testing a page to be tested of the applet;
the automatic test module is used for running the test case set based on a preset applet automatic test framework;
and the test result output module is used for acquiring the test result output by the small program automatic test framework.
9. A computer storage medium having stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to carry out a method of testing an applet method interface as claimed in any one of claims 1 to 6.
10. An apparatus for testing an applet method interface, the apparatus comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, set of codes or set of instructions, the at least one instruction, the at least one program, set of codes or set of instructions being loaded by the processor and performing a method for testing an applet method interface as claimed in any one of claims 1-6.
CN201910927609.6A 2019-09-27 2019-09-27 Method, device and medium for testing small program method interface Pending CN112579425A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910927609.6A CN112579425A (en) 2019-09-27 2019-09-27 Method, device and medium for testing small program method interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910927609.6A CN112579425A (en) 2019-09-27 2019-09-27 Method, device and medium for testing small program method interface

Publications (1)

Publication Number Publication Date
CN112579425A true CN112579425A (en) 2021-03-30

Family

ID=75110151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910927609.6A Pending CN112579425A (en) 2019-09-27 2019-09-27 Method, device and medium for testing small program method interface

Country Status (1)

Country Link
CN (1) CN112579425A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259195A (en) * 2021-05-10 2021-08-13 中国人民解放军63660部队 Message middleware performance test method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7330887B1 (en) * 2003-01-06 2008-02-12 Cisco Technology, Inc. Method and system for testing web-based applications
CN103886029A (en) * 2014-03-03 2014-06-25 百度在线网络技术(北京)有限公司 Method, device, server and system for implementing webpage application
CN107590068A (en) * 2017-08-04 2018-01-16 东软集团股份有限公司 Browser page method of testing, device and computer equipment
CN107679166A (en) * 2017-09-27 2018-02-09 风变科技(深圳)有限公司 Fragmentation reading method, device, system and the storage medium paid online
CN109002389A (en) * 2017-06-07 2018-12-14 北京京东尚科信息技术有限公司 The method and apparatus of page automatic test
CN110083526A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Applied program testing method, device, computer installation and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7330887B1 (en) * 2003-01-06 2008-02-12 Cisco Technology, Inc. Method and system for testing web-based applications
CN103886029A (en) * 2014-03-03 2014-06-25 百度在线网络技术(北京)有限公司 Method, device, server and system for implementing webpage application
CN109002389A (en) * 2017-06-07 2018-12-14 北京京东尚科信息技术有限公司 The method and apparatus of page automatic test
CN107590068A (en) * 2017-08-04 2018-01-16 东软集团股份有限公司 Browser page method of testing, device and computer equipment
CN107679166A (en) * 2017-09-27 2018-02-09 风变科技(深圳)有限公司 Fragmentation reading method, device, system and the storage medium paid online
CN110083526A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Applied program testing method, device, computer installation and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259195A (en) * 2021-05-10 2021-08-13 中国人民解放军63660部队 Message middleware performance test method
CN113259195B (en) * 2021-05-10 2022-07-05 中国人民解放军63660部队 Message middleware performance test method

Similar Documents

Publication Publication Date Title
CN112130742B (en) Full screen display method and device of mobile terminal
CN110798568A (en) Display control method of electronic equipment with folding screen and electronic equipment
CN110727380A (en) Message reminding method and electronic equipment
CN114727220B (en) Equipment searching method and electronic equipment
CN115589051B (en) Charging method and terminal equipment
CN111343326A (en) Method and related device for acquiring test log
CN114125793A (en) Bluetooth data transmission method and related device
CN111104295A (en) Method and equipment for testing page loading process
CN113641271A (en) Application window management method, terminal device and computer readable storage medium
CN114995715B (en) Control method of floating ball and related device
CN115032640B (en) Gesture recognition method and terminal equipment
CN114006698B (en) token refreshing method and device, electronic equipment and readable storage medium
CN112579425A (en) Method, device and medium for testing small program method interface
CN113407300B (en) Application false killing evaluation method and related equipment
CN115022807A (en) Express delivery information reminding method and electronic equipment
CN114003241A (en) Interface adaptation display method and system of application program, electronic device and medium
CN112583651B (en) Method, device and medium for testing applet communication interface
CN111586236A (en) Electronic equipment marking method and device, computer readable medium and electronic equipment
CN114285946B (en) Number portability number display method, electronic equipment and storage medium
CN113905334B (en) Information sharing method and device
CN114125805B (en) Bluetooth reconnection method and terminal equipment
US20240098354A1 (en) Connection establishment method and electronic device
CN113364067B (en) Charging precision calibration method and electronic equipment
CN115906033A (en) Voiceprint authentication response method and system and electronic equipment
CN117251223A (en) Cloud function plug-in configuration and scheduling method, system and electronic equipment

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