CN112579425B - Method, device and medium for testing applet method interface - Google Patents

Method, device and medium for testing applet method interface Download PDF

Info

Publication number
CN112579425B
CN112579425B CN201910927609.6A CN201910927609A CN112579425B CN 112579425 B CN112579425 B CN 112579425B CN 201910927609 A CN201910927609 A CN 201910927609A CN 112579425 B CN112579425 B CN 112579425B
Authority
CN
China
Prior art keywords
page
applet
test
tested
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910927609.6A
Other languages
Chinese (zh)
Other versions
CN112579425A (en
Inventor
陈俊杰
黄晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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/CN112579425B/en
Publication of CN112579425A publication Critical patent/CN112579425A/en
Application granted granted Critical
Publication of CN112579425B publication Critical patent/CN112579425B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

The invention discloses a method, a device and a medium for testing an applet method interface, wherein the method comprises the steps of obtaining a page to be tested of an applet; when the page to be tested of the applet accords with the newly built test page condition, newly building an applet test page running in a main program corresponding to the applet; adding the page to be tested as a component into the applet test page, and establishing an association 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 form to obtain a test case method, and operating the test case by calling the test case method in the applet test page. The invention can perform free test on the method interfaces of the original applet or the non-original applet, and has good compatibility.

Description

Method, device and medium for testing applet method interface
Technical Field
The present invention relates to the field of unit testing, and in particular, to a method, apparatus, and medium for testing an applet method interface.
Background
As the popularity of applets increases, the need for testing of applets is also increasing. However, the test framework specially applied to the applet is still immature in the prior art, and the existing front-end test framework cannot adapt to the test of the applet.
For example, classical front-end test frameworks such as JEST and Mocha cannot obtain the login state of the main program corresponding to the applet, and therefore cannot test the interface in the applet alone. The test framework Automator special for the applet can only run in a development tool at present and cannot be independently transplanted to a true machine for running; the method can not reach all internal interfaces, such as internal methods which are not mounted on pages and components of the main program, input methods mounted on an input frame and the like, and can not 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 cannot reach various interfaces of an applet in the prior art, test dead zones exist, and test support of the applet developed in a non-native mode is insufficient, the embodiment of the invention provides a method, a device 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 an applet;
When the page to be tested of the applet accords with the newly built test page condition, newly building an applet test page running in a main program corresponding to the applet;
adding the page to be tested as a component into the applet test page, and establishing an association 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 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:
The page to be tested acquisition module is used for acquiring the page to be tested of the applet;
The applet test page creation module is used for creating an applet test page running in a main program corresponding to the applet when the page to be tested of the applet meets the conditions of the created test page;
the association module is used for adding the page to be tested as a component into the applet test page, 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 running the test case by calling the test case method in the applet test page.
In another aspect, the invention provides an apparatus for testing an applet method interface, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set loaded and executed by the processor to implement a method for testing an applet method interface.
In another aspect, the invention provides a computer storage medium having stored therein at least one instruction, at least one program, code set, or instruction set 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. According to the invention, the small program test page is newly built in the main program so as to share the login state with the main program, and the association relation between the small program test page and the page to be tested is established under various conditions, so that various method interfaces in the page to be tested can be mobilized in the small program test page, and the purpose of carrying out method interface test on the page to be tested is achieved. The invention can perform free test on the method interfaces of the original applet or the non-original applet, and has good compatibility.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a test applet using a conventional test framework such as Mocha, JEST, etc., provided by the present invention;
FIG. 2 is a schematic diagram of an automated test framework test applet using Automater or other applets provided by the invention;
FIG. 3 is a schematic diagram of one possible real machine implementation of 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 flow chart of a new applet test page running in a main program corresponding to the applet when the page to be tested of the applet meets the new test page condition;
FIG. 7 is a flow chart of the invention provided if the page to be tested of the applet does not meet the condition of the newly built test page;
FIG. 8 is a flow chart of an applet-based test page test provided by the present invention;
FIG. 9 is a schematic diagram of an implementation effect of a method for testing an applet method interface according to an embodiment of the invention;
FIG. 10 is a block diagram of an apparatus for testing an applet method interface provided by the present invention;
fig. 11 is a schematic hardware structure of an apparatus for implementing the method provided by the embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise 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 or inherent to such process, method, article, or apparatus, 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 of the embodiments of the present invention more apparent, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the detailed description and specific examples, while indicating the embodiment of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more. In order to facilitate understanding of the technical solution and the technical effects thereof described in the embodiments of the present invention, the embodiments of the present invention first explain related terms:
JEST: JEST is a JavaScript unit test framework of FaceBook open source, and can be widely used in front-end H5 page unit/interface test. Currently, in addition to Facebook, internet products such as Twitter, nytimes, airbnb, and the like are also in use JEST. JEST in addition to basic assertion and Mock test functions, there are practical functions such as snapshot test, real-time monitoring mode, coverage report, etc. At the same time JEST can be used with little or no configuration.
Unit test: test work for performing correctness checking on a module, a function or a class.
JavaScript: an transliteration script language is a dynamic type, weak type, prototype-based language, built-in support type. Its interpreter is called JavaScript engine, which is a part of the browser, widely used in the scripting language of clients, and is used at the earliest on HTML (an application under standard universal markup language) web pages to add dynamic functions to HTML web pages.
Mock test: mock testing is a test method in which a virtual object is used to create objects that are not easily constructed or easily obtained during testing.
And H5: the 5 th generation HTML can be used to refer to digital products made in the H5 language. HTML is an english abbreviation for "hypertext markup language". "hypertext" means that a page may contain pictures, links, even non-text elements such as music, programs, etc.
Mocha: the unit test framework is a unit test framework of JavaScript, can be operated in a browser environment or a development platform environment which enables JavaScript to be operated at a server, and is widely used in unit/interface test of a front-end H5 page. Using Mocha, only need to concentrate on writing the unit test itself, then let Mocha to run all the tests automatically and give out the test results. Mocha can test both simple JavaScript functions and asynchronous code.
Automatizer: an applet automatic test framework.
Small procedure: the small program takes the main program as a carrier and parasitizes the running environment of the main program to provide service for users.
Mpvue: an applet development framework which follows the Web development thought and is produced by a beauty group review team.
WePY: wePY is a framework for supporting modular development of applets, and by means of precompiled means, developers can select favorite development styles to develop the applets. The details of the framework are optimized, so that the development of the applet project is simpler and more efficient.
Assertion of: is a programming term, expressed as some boolean expressions, that can enable assertions at test time and disable assertions at deployment time. Using assertions can create more stable, better quality, and less error prone code. Assertions may be used when it is desired to interrupt the current operation when one value is FALSE. Some component-based unit testing must use assertions.
And (3) assembly: a Component (Component) is a simple package of data and methods. The components may have their own properties and methods. The attributes are simple visitors to the component data, and the methods are some simple and visible functions of the component. Drag-and-drop programming, fast property handling, and true object-oriented design can be achieved using components.
Referring to fig. 1, a schematic diagram of a test applet using a conventional test framework such as Mocha, JEST is shown. The applet operates in the operating environment of the main program, and the external test framework can access the applet only on the premise of acquiring the login state of the main program, while the traditional test framework cannot acquire the login state of the main program, so that each interface inside the applet cannot be accessed, and the interface test of the applet cannot be realized.
Referring to FIG. 2, a schematic diagram of an automated test framework test applet using Automater or the like is shown. Automater can reach some interfaces in the applet, but it has many limitations that it cannot reach all internal interfaces of the applet, and it is not friendly to support applets that are not originally developed, nor is it easy to use in a real machine environment.
In order to solve the problems that various test frames cannot reach various interfaces of an applet in the prior art, test dead zones exist, test support of the applet developed in a non-native mode is insufficient, and the like, the embodiment of the invention provides a method for testing an applet method interface, and the test method can be operated in a development environment or a real machine environment.
As shown in fig. 3, which illustrates one possible real machine implementation environment for the one method for testing the applet method interface. The real machine implementation environment may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (augmentedreality, AR)/virtual reality (virtualreality, VR) device, a notebook computer, an ultra-mobilepersonalcomputer (UMPC), a netbook, a Personal Digital Assistant (PDA), or other electronic devices, and the specific type of the electronic device is not limited in the embodiments 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 charge 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, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, a subscriber identity module (subscriberidentificationmodule, SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity 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 should be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (applicationprocessor, AP), a modem processor, a graphics processor (graphicsprocessingunit, GPU), an image signal processor (imagesignalprocessor, ISP), a controller, a memory, a video codec, a digital signal processor (digitalsignalprocessor, DSP), a baseband processor, and/or a neural network processor (neural-networkprocessingunit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and a command center of the electronic device 100, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the 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 the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integratedcircuit, I2C) interface, an integrated circuit built-in audio (inter-integratedcircuitsound, I2S) interface, a pulse code modulation (pulsecodemodulation, PCM) interface, a universal asynchronous receiver transmitter (universalasynchronousreceiver/transmitter, UART) interface, a mobile industry processor interface (mobileindustryprocessorinterface, MIPI), a general-purposeinput/output (GPIO) interface, a subscriber identity module (subscriberidentitymodule, SIM) interface, and/or a Universal Serial Bus (USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (SERIALDATALINE, SDA) and a serial clock line (derailclockline, SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc., respectively, through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, such that the processor 110 communicates with the touch sensor 180K through an I2C bus interface to implement a touch function of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may contain 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 transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through 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 to implement a function of answering a call through the 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 for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically 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 an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
The MIPI interface may be used to connect the processor 110 to peripheral devices such as a display 194, a camera 193, and the like. The MIPI interfaces include camera serial interfaces (CAMERASERIALINTERFACE, CSI), display serial interfaces (DISPLAY SERIALINTERFACE, DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the photographing functions of electronic device 100. The processor 110 and the display 194 communicate via a DSI interface to implement the display functionality of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or 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, an MIPI interface, etc.
The USB interface 130 is an interface conforming to the USB standard, and may specifically be a MiniUSB interface, a micro USB interface, USBTypeC 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 transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and is not meant to limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also employ different interfacing manners in the above embodiments, or a combination of multiple interfacing manners.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive 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 for connecting the battery 142, and the charge 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 configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge 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 may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into 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 for wireless communication including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (lownoiseamplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. 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 provided 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 the 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 transmits the demodulated low frequency baseband signal to the 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 sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images 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 provided in the same device as the mobile communication module or other functional module, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless localareanetworks, WLAN) (e.g., wireless fidelity (WIRELESSFIDELITY, wi-Fi) network), bluetooth (BT), global navigation satellite system (globalnavigationsatellitesystem, GNSS), frequency modulation (frequencymodulation, FM), near Field Communication (NFC), infrared (IR), etc., applied to the electronic device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the 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, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 and mobile communication module 150 of electronic device 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, such that electronic device 100 may communicate with a network and other devices through wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (globalsystemformobilecommunications, GSM), general packet radio service (generalpacketradioservice, GPRS), code division multiple access (codedivisionmultipleaccess, CDMA), wideband code division multiple access (widebandcodedivisionmultipleaccess, WCDMA), time division code division multiple access (time-divisioncodedivisionmultipleaccess, TDSCDMA), long term evolution (longtermevolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (globalpositioningsystem, GPS), a global navigation satellite system (globalnavigationsatellitesystem, GLONASS), a beidou satellite navigation system (beidou navigationsatellitesystem, BDS), a quasi zenith satellite system (quasi-zenithsatellitesystem, QZSS) and/or a satellite based augmentation system (satellitebasedaugmentationsystems, SBAS).
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 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 (AMOLED) or an active-matrix organic light-emitting diode (matrixorganiclightemittingdiode), a flexible light-emitting diode (FLED), miniled, microLed, micro-oLed, a quantum dot light-emitting diode (quantumdotlight emittingdiodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize 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 the 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 onto the photosensitive element. The photosensitive element may be a charge coupled device (chargecoupleddevice, CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, 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: dynamic picture experts group (movingpictureexpertsgroup, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The external memory interface 120 may be used to connect an external memory card, such as a MicroSD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including 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 storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. 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 magnetic disk storage device, a flash memory device, a universal flash memory (universalflashstorage, UFS), and the like.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. 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 a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to 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, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be a USB interface 130 or a 3.5mm open mobile electronic device platform (openmobileterminalplatform, OMTP) standard interface, a american cellular telecommunications industry association (cellulartelecommunicationsindustryassociationoftheUSA, CTIA) standard interface.
The pressure sensor 180A is used to sense a pressure signal, and may convert 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 is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. The capacitance between the electrodes changes when a force is applied to the pressure sensor 180A. 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 touch operation intensity according to the pressure sensor 180A. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., x, y, and z axes) may be determined by gyro 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 the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, so as to realize anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip cover using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. And then according to the detected opening and closing state of the leather sheath or the opening and closing state of the flip, the characteristics of automatic unlocking of the flip and the like are 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 may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture 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, the electronic device 100 may range using the distance sensor 180F to achieve quick 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 outward 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 may be determined that there is an object in the vicinity of the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there is no object in the vicinity of the electronic device. The electronic device 100 can detect that the user holds the electronic device 100 close to the ear by using the proximity light sensor 180G, so as to automatically extinguish the screen for the purpose of saving power. The proximity light sensor 180G may also be used in holster mode, pocket mode to automatically unlock and lock the screen.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to unlock the fingerprint, access the application lock, photograph the fingerprint, answer the incoming call, etc.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs a reduction in the performance of a processor located in the vicinity of temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, 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 for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, bone conduction sensor 180M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 180M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 180M may also be provided in a headset, in combination with an osteoinductive headset. The audio module 170 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 180M, so as to implement a voice function. The application processor may analyze the heart rate information based on the blood pressure beat signal acquired by the bone conduction sensor 180M, so as to implement a heart rate detection function.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. 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 nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. 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 realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: 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, which illustrates a software framework diagram of a method implementation environment for testing an applet method interface, the implementation environment may be the real machine environment shown in fig. 3. The software system of the implementation environment may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. In the embodiment of the application, an Android system with a layered architecture is taken as an example, and the software structure of an implementation environment is exemplified.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun rows and system libraries, and a kernel layer. The application layer may include a series of application packages.
The application layer may include various application programs, and a method for testing an applet method interface according to an embodiment of the present invention is a method for testing an applet method interface in the application layer. The main program parasitic to the applet runs as an application program in the application program layer.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for the application of the application layer. The application framework layer includes a number of predefined functions.
Android runtime include core libraries and virtual machines. Android runtime is responsible for scheduling and core library of android system comprising two parts.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: a surface manager (surface manager), a media library (medialibraries), a three-dimensional graphics processing library (e.g., openGL ES), a 2D graphics engine (e.g., SGL), etc.
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 chart of a method for testing an applet method interface is shown, which may be run in the implementation environment described in FIG. 3, which may include:
S101, acquiring a page to be tested of the applet.
S103, when the page to be tested of the applet meets the conditions of the newly built test page, newly building an applet test page running in the main program corresponding to the applet.
In view of the fact that the automatic test framework for the applet is not friendly to support the non-native applet in the prior art, in order to provide support for testing the non-native applet, in the embodiment of the invention, whether the applet is a native applet or not may be used as a new test page condition, that is, when the page to be tested of the applet meets the new test page condition, a new applet test page running in the main program corresponding to the applet is created, as shown in fig. 6, including:
S1031, judging whether the page to be tested of the applet is a native applet page or not.
S1033, if the page is not the original applet page, judging that the page to be tested of the applet accords with the newly built test page condition.
When the page to be tested of the applet is a native applet page, an automatic applet test framework in the prior art, such as Automater, may also be considered, so the determining whether the page to be tested of the applet is a native applet page further includes:
s1035, if the original applet page is the original applet page, judging whether a method interface to be tested in the applet page to be tested can be touched by a preset applet automatic test frame;
S1037, if not, judging that the page to be tested of the applet meets the condition of the newly built test page.
The automatic applet testing framework in the prior art can touch most interfaces in the original applet page, but can not touch some special interfaces, if the interfaces of the method to be tested belonging to the special interfaces exist, the automatic applet testing framework in the prior art can not achieve the purpose of testing, and the situation also meets the condition of newly built test pages.
The embodiment of the invention divides the interface of the page to be tested of the applet into a method interface and a communication interface, wherein the method interface can be used for realizing a specific non-communication function, and the communication interface can be used for communicating with other equipment so as to carry out data interaction with the other equipment. The interfaces of the method to be tested in the embodiment of the invention belong to the interfaces of the methods.
Accordingly, if yes, it is determined that the page to be tested of the applet does not meet the new test page condition, as shown in fig. 7, if the page to be tested of the applet does not meet the new test page condition, then:
s201, acquiring a test case set of a page to be tested for testing the applet.
Specifically, the test case set may include one or more test cases, where 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 related interface in a preset applet automatic test framework.
S203, running the test case set based on a preset applet automatic test framework.
Specifically, the preset applet automatic test framework is used for testing a native applet page, such as Automater test framework.
S205, obtaining a test result output by the automatic applet test framework.
Taking Automater test framework as an example, it can output test results in the form of assertions.
Step S103 of the embodiment of the present invention is to establish an applet test page running in the main program corresponding to the applet, and use the applet test page as a bearing page of the page to be tested, so as to achieve the purpose of touching the interface of the method to be tested in the page to be tested.
S105, adding the page to be tested as a component into the applet test page, 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 needs to be added into the applet test page as a component, so that the association 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 an intermediate piece. The applet test page is established based on the main program, so that the applet test page shares a login state with the main program, and when the method interface to be tested is called in the method associated with the applet test page, the method in the applet test page can be operated to achieve the purpose of testing the method interface to be tested, thereby solving the technical problem that the method interface in the applet cannot be tested because the login state of the main program cannot be known in the prior art.
The adding the page to be tested as a component to the applet test page comprises:
S1051, if the page to be tested of the applet is a non-native applet page, declaring the page to be tested as a component in the applet test page.
S1053, if the page to be tested of the applet is a native applet page, modifying a 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.
Taking WeChat applet as an example, newly building applet test pages in WeChat main program, modifying corresponding configuration files, and adding usingComponets pages to be tested.
As shown in fig. 8, the establishing the association between the page to be tested and the applet test page includes:
S1055, if the page to be tested of the applet is a non-native applet page, setting a reference value of the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page in a mode that a pointer pointing to the applet test page accesses the reference value.
Specifically, the ref attribute of the page to be tested can be added to the applet test page, and the test page attribute value can be set by setting the value of the ref attribute. For example, if the ref value of the page a to be tested is XXX in the applet test page a-test, the call and the modification of the attribute value of the method interface of the page a to be tested can be realized by this $ refs.xxx.
S1057, if the page to be tested of the applet is a native applet page, setting a class associated with the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page in a class reference mode.
Specifically, common attributes such as id, class and the like can be added to the page A to be tested, then 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 positioned through this is.select component ('. XXX'), and then various calls can be made to the method interface of the page A to be tested.
S107, 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.
Specifically, the test case is used for implementing the test of the method interface to be tested in the page to be tested, so that the test case is necessarily required to access the method interface to be tested, and the test case method in the applet test page can be enabled to reach the method interface to be tested on the basis of establishing the association relationship between the page to be tested and the applet test page in step S105, thereby correctly operating 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 on the basis of accurately realizing the method logic of the test case, and records the test result in the test case method. Different from the limitations of the prior art on the testing of the applet method interfaces, the embodiment of the invention can support the testing of each method interface to be tested in all the relevant scenes thereof.
In a preferred embodiment, all method interfaces of the page to be tested can be scanned based on preset rules, and test cases for testing the method interfaces can be automatically generated, so that labor cost is remarkably saved.
In a preferred embodiment, to facilitate execution of the test case, the method for executing 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 a 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, with execution of the test case method being controlled by writing code or using a code debug tool. In a real machine environment or a simulated machine environment, a user cannot reach the code environment, and the execution of the test flow is controlled through a control. Therefore, in order to facilitate the improvement of the test efficiency, a user can test the interface of the method to be tested of the page to be tested in a non-code environment, and 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 the identifiers 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, a triggering event of the button control is associated with a first test case method in the test case method sequence, and sequential execution of each test case method in the test case method sequence is triggered by triggering the button control.
In another possible embodiment, the control includes a plurality of button controls, each button control is associated with a test case method, and the test case method associated with the button control is run by triggering the button control.
According to the embodiment of the invention, the login state is shared with the main program by newly creating the applet test page in the main program, and the association relation between the applet test page and the page to be tested is established under various conditions, so that various method interfaces in the page to be tested can be mobilized in the applet test page, and the purpose of carrying out method interface test on the page to be tested is achieved. The small program test page is built in the main program, can share a login state with the main program, and still belongs to the small program basically, so that the small program test page can be used as a middleware to realize the test of the page to be tested of the small program. Fig. 9 is a schematic diagram showing an implementation effect of a method for testing an applet method interface according to an embodiment of the invention. The test case method can be called based on the test frame or the test case method mount based on the control, and the small program test page is used as a medium, so that all method interfaces in the page to be tested can be completely touched without being limited by any other conditions. The embodiment of the invention can perform free test on the method interfaces of the native applet or the non-native applet, and has good compatibility.
The embodiment of the invention also provides a device for testing the interface of the applet method, as shown in fig. 10, comprising:
The page to be tested acquisition module 201 is used for acquiring a page to be tested of the applet;
The applet test page creation module 203 is configured to create an applet test page running in a main program corresponding to the applet when a page to be tested of the applet meets a 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;
And 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 operate the test case by calling the test case method in the applet test page.
Further, the apparatus may further include:
the test case set acquisition module 202 is configured to acquire a test case set for testing a page to be tested of the applet;
The automatic test module 204 is configured to run the test case set based on a preset applet automatic test framework;
and the test result output module 206 is configured to obtain a test result output by the applet automatic test framework.
Specifically, the embodiments of an apparatus and a method for testing an applet method interface according to the embodiments of the present invention are all based on the same inventive concept. Please refer to the method embodiment for details, which will not be described herein.
The embodiment of the invention also provides a computer storage medium which can store a plurality of instructions. The instructions may be adapted to be loaded and executed by a processor 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 an applet;
When the page to be tested of the applet accords with the newly built test page condition, newly building an applet test page running in a main program corresponding to the applet;
adding the page to be tested as a component into the applet test page, and establishing an association 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 form 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 the condition of the newly built test page, newly building the applet test page running in the main program corresponding to the applet, including:
judging whether the page to be tested of the applet is a native applet page or not;
If the page is not the original applet page, judging that the page to be tested of the applet accords with the condition of the newly built test page;
If the interface is a native applet page, judging whether a method interface to be tested in the applet page to be tested can be touched by a preset applet automatic test frame;
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 the page to be tested of the applet does not meet the new test page condition, the method further includes:
Acquiring a test case set of a page to be tested for testing the applet;
Operating the test case set based on a preset applet automatic test framework;
And obtaining a test result output by the automatic test framework of the applet.
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 applet is a non-native applet page, declaring the page to be tested as a component in the applet test page;
and if the page to be tested of the applet is a native applet page, modifying a 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 between the page to be tested and the applet test page includes:
If the page to be tested of the applet is a non-native applet page, setting a reference value of the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page in a mode that a pointer pointing to the applet test page accesses the reference value;
If the page to be tested of the applet is a native applet page, setting a class associated with the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page by referring to the class.
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 triggering event of the control with at least one test case method;
And 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 schematic diagram of a hardware structure of an apparatus for implementing the method provided by the embodiment of the present invention, where the apparatus may participate in forming or including the device or the system provided by the embodiment of the present invention. As shown in fig. 11, the apparatus 10 may include one or more processors 102 (shown as 102a, 102b, … …,102n in the figures) which may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, the method may further include: 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 supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 11 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the 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 circuits described above may be referred to generally herein as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. 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 embodiments of the application, the data processing circuit acts as a processor control (e.g., selection of the path of the variable resistor termination connected to the interface).
The memory 104 may be used to store software programs and modules of application software, and the processor 102 executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, i.e., to implement a method for testing an applet method interface as described above. 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 means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communications provider of device 10. In one example, the transmission device 106 includes a network adapter (NetworkInterfaceController, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a radio frequency (RadioFrequency, RF) module for communicating wirelessly with the internet.
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 sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. And the foregoing description has been directed to specific embodiments of this specification. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can 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 are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device and server embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and references to the parts of the description of the method embodiments are only required.
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 for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (9)

1. A method for testing an applet method interface, the method comprising:
acquiring a page to be tested of an applet;
When the page to be tested of the applet accords with the newly built test page condition, newly building an applet test page running in a main program corresponding to the applet;
The page to be tested is used as a component to be added into the applet test page, if the page to be tested of the applet is a non-native applet page, a reference value of the page to be tested is set in the applet test page, and an association relationship between the page to be tested and the applet test page is established in a mode that a pointer pointing to the applet test page accesses the reference value; if the page to be tested of the applet is a native applet page, setting a class associated with the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page in a class referencing manner;
And realizing the test case for testing the page to be tested in the applet test page in a function form 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 according to claim 1, wherein when the page to be tested of the applet meets the new test page condition, creating an applet test page running in the main program corresponding to the applet, comprising:
judging whether the page to be tested of the applet is a native applet page or not;
If the page is not the original applet page, judging that the page to be tested of the applet accords with the condition of the newly built test page;
if the interface is a native applet page, judging whether a method interface to be tested in the applet page to be tested can be touched by a preset applet automatic test frame;
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 meet the new test page condition, and if the page to be tested of the applet does not meet the new test page condition, the method further comprises:
Acquiring a test case set of a page to be tested for testing the applet;
Operating the test case set based on a preset applet automatic test framework;
And obtaining a test result output by the automatic test framework of the applet.
4. The method of claim 1, wherein the adding the page under test as a component to the applet test page comprises:
If the page to be tested of the applet is a non-native applet page, declaring the page to be tested as a component in the applet test page;
and if the page to be tested of the applet is a native applet page, modifying a 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 running the test case by calling a test case method in the applet test page comprises:
Setting a control, and associating a triggering event of the control with at least one test case method;
And monitoring a trigger event of the control, and running a test case method associated with the trigger event when the trigger event occurs.
6. An apparatus for testing an applet method interface, the apparatus comprising:
The page to be tested acquisition module is used for acquiring the page to be tested of the applet;
The applet test page creation module is used for creating an applet test page running in a main program corresponding to the applet when the page to be tested of the applet meets the conditions of the created test page;
The association module is used for adding the page to be tested as a component into the applet test page, if the page to be tested of the applet is a non-native applet page, setting a reference value of the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page in a mode of accessing the reference value by a pointer pointing to the applet test page; if the page to be tested of the applet is a native applet page, setting a class associated with the page to be tested in the applet test page, and establishing an association relationship between the page to be tested and the applet test page in a class referencing manner;
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 running the test case by calling the test case method in the applet test page.
7. The apparatus as recited in claim 6, further comprising:
The test case set acquisition module is used for acquiring a test case set of a page to be tested for testing 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 automatic applet test framework.
8. A computer storage medium having stored therein at least one instruction, at least one program, code set, or instruction set, loaded and executed by a processor to implement a method for testing an applet method interface according to any one of claims 1-5.
9. An apparatus for testing an applet method interface, said apparatus comprising a processor and a memory, said memory storing at least one instruction, at least one program, code set or instruction set, said at least one instruction, said at least one program, said code set or instruction set being loaded by said processor and executing a method for testing an applet method interface according to any one of claims 1-5.
CN201910927609.6A 2019-09-27 2019-09-27 Method, device and medium for testing applet method interface Active CN112579425B (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN112579425A CN112579425A (en) 2021-03-30
CN112579425B true CN112579425B (en) 2024-05-10

Family

ID=75110151

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN112579425B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259195B (en) * 2021-05-10 2022-07-05 中国人民解放军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

Also Published As

Publication number Publication date
CN112579425A (en) 2021-03-30

Similar Documents

Publication Publication Date Title
CN115866121B (en) Application interface interaction method, electronic device and computer readable storage medium
WO2020000448A1 (en) Flexible screen display method and terminal
CN117014567A (en) Video call display method and related device applied to electronic equipment
CN112087649B (en) Equipment searching method and electronic equipment
CN116048358B (en) Method and related device for controlling suspension ball
CN111343326A (en) Method and related device for acquiring test log
CN111104295A (en) Method and equipment for testing page loading process
CN115914461B (en) Position relation identification method and electronic equipment
CN112579425B (en) Method, device and medium for testing applet method interface
CN113645595B (en) Equipment interaction method and device
CN116527266A (en) Data aggregation method and related equipment
CN114006698A (en) token refreshing method and device, electronic equipment and readable storage medium
CN114003241A (en) Interface adaptation display method and system of application program, electronic device and medium
CN116414500A (en) Recording method, acquisition method and terminal equipment for operation guide information of electronic equipment
CN112583651B (en) Method, device and medium for testing applet communication interface
CN116743921B (en) Method for displaying number-carrying network number, electronic equipment and storage medium
CN113626115B (en) Method for generating dial plate and related device
CN115792431B (en) Abnormal position detection method and electronic equipment
CN116048629B (en) System service switching method, control device, electronic equipment and storage medium
CN116450026B (en) Method and system for identifying touch operation
CN117451173B (en) Motor detection method and related equipment
CN114077323B (en) Touch screen false touch prevention method of electronic equipment, electronic equipment and chip system
CN114205318B (en) Head portrait display method and electronic equipment
CN116301510A (en) Control positioning method and electronic equipment
CN117917632A (en) Display method, electronic equipment and system

Legal Events

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