CN106502906B - A kind of method and apparatus of test application program - Google Patents

A kind of method and apparatus of test application program Download PDF

Info

Publication number
CN106502906B
CN106502906B CN201610954518.8A CN201610954518A CN106502906B CN 106502906 B CN106502906 B CN 106502906B CN 201610954518 A CN201610954518 A CN 201610954518A CN 106502906 B CN106502906 B CN 106502906B
Authority
CN
China
Prior art keywords
parameter value
interface
input parameter
input
function
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
CN201610954518.8A
Other languages
Chinese (zh)
Other versions
CN106502906A (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.)
Guangzhou Huaduo Network Technology Co Ltd
Original Assignee
Guangzhou Huaduo Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Huaduo Network Technology Co Ltd filed Critical Guangzhou Huaduo Network Technology Co Ltd
Priority to CN201610954518.8A priority Critical patent/CN106502906B/en
Publication of CN106502906A publication Critical patent/CN106502906A/en
Application granted granted Critical
Publication of CN106502906B publication Critical patent/CN106502906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The present invention provides a kind of methods of test application program, belong to field of computer technology.The described method includes: receiving the interface call request for the first interface that SDK caller is sent during test target function, wherein include at least input parameter value in the interface call request and first interface identifies;It is identified based on the input parameter value and first interface, generates and identify the abnormal output parameter value not matched that with the input parameter value and the first interface;To the SDK caller feedback abnormal output parameter value, so that the SDK caller continues to execute the test of the objective function based on the abnormal output parameter value.By the invention it is possible to increase the validity of test result.

Description

A kind of method and apparatus of test application program
Technical field
The present invention relates to field of computer technology, in particular to a kind of method and apparatus of test application program.
Background technique
With the development of computer technology, the quantity of application program is more and more, in order to avoid application program is in publication Error is run after line, before application program is formally issued, it usually needs test application program, only application program is transported Row is smooth, could formally issue online.
In the prior art, in development and application program, in order to accelerate the development rate of application program, part general utility functions Code is often encapsulated as SDK (Software Development Kit, software development kit), and SDK can provide multiple connect Mouthful, it is used for application program, in this way, technical staff only needs to write the code in application program in addition to SDK, referred to as SDK tune With program, in this way, application program is made of SDK and SDK caller two parts.SDK caller can be by calling SDK's Interface is interacted with SDK.Before application issued is online, need to test (such as each function of application program Input function, function of search etc.), illustrated for testing function of search below, tested SDK can be called journey by technical staff Sequence and corresponding SDK installation in the terminal, then in the input frame of SDK caller, input the interior of default correct format Holding, then clicks search key, SDK caller can then obtain the corresponding interface identifier of function of search and input parameter value, and Interface identifier and input parameter value are added in interface call request, are sent to SDK, SDK can using input parameter value as The input of the corresponding interface function of the interface identifier returns to output parameter value to tested SDK caller, is tested SDK and calls journey Sequence then executes the subsequent processing (such as showing search content) for searching plain function, if search content can normally be shown, it is determined that Function of search is normal.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:
When testing SDK caller, generally, many technical staff often can only consider normally to be inputted, and test certain Function, in this way, can test and solve the problems, such as application program when handling normal input there may be.However this The test of sample can not test the ability of the abnormal input parameter value of application program processing, and application program is abnormal in processing When input parameter value, it is possible that problem.As it can be seen that the validity of the test result of above-mentioned test mode is poor.
Summary of the invention
In order to solve problems in the prior art, the embodiment of the invention provides a kind of method of test application program and dresses It sets.The technical solution is as follows:
In a first aspect, providing a kind of method of test application program, which comprises
During test target function, the interface call request for the first interface that SDK caller is sent is received, In, input parameter value is included at least in the interface call request and first interface identifies;
It is identified, is generated and the input parameter value and the first interface mark based on the input parameter value and first interface Know the abnormal output parameter value not matched that;
To the SDK caller feedback abnormal output parameter value, so that the SDK caller is based on described different Normal output parameter value continues to execute the test of the objective function.
Optionally, described to be identified based on the input parameter value and first interface, it generates and the input parameter value and institute It states first interface and identifies the abnormal output parameter value not matched that, comprising:
The input parameter value is modified, modified input parameter value is obtained;
The input of corresponding first interface function is identified using the modified input parameter value as the first interface, Generate abnormal output parameter value;Alternatively,
The input of corresponding first interface function, generation and institute are identified using the input parameter value as the first interface State input parameter value and output parameter value that the first interface function matches;
The output parameter value to match with the input parameter value and the first interface function is revised as exception Output parameter value.
Optionally, the modification input parameter value, obtains modified input parameter value, comprising:
The input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
The input parameter value is replaced with into preset first parameter value, obtains modified input parameter value;Alternatively,
The value type of the input parameter value is revised as preset first value type, obtains modified input ginseng Numerical value.
Optionally, described by the output parameter value to match with the input parameter value and the first interface function It is revised as abnormal output parameter value, comprising:
The output parameter value to match with the input parameter value and the first interface function is increasedd or decreased Second preset value obtains abnormal output parameter value;Alternatively,
The output parameter value to match with the input parameter value and the first interface function is replaced with default The second parameter value, obtain abnormal output parameter value;Alternatively,
The value type of the output parameter value that matches with the input parameter value and the first interface function is repaired It is changed to preset second value type, obtains abnormal output parameter value.
Optionally, described to be identified based on the input parameter value and first interface, it generates and the input parameter value and institute It states first interface and identifies the abnormal output parameter value not matched that, comprising:
When detecting that carrying test in the interface call request identifies, it is based on the input parameter value and first interface Mark generates and identifies the abnormal output parameter value not matched that with the input parameter value and the first interface.
Optionally, described to be identified based on the input parameter value and first interface, it generates and the input parameter value and institute It states first interface and identifies the abnormal output parameter value not matched that, comprising:
According to the corresponding relationship of interface identifier and wrong interface function, determine that the first interface mark corresponding second connects Mouth function;
Using the input parameter value as the input of the second interface function, generate and the input parameter value and described First interface identifies the abnormal output parameter value not matched that.
Second aspect, provides a kind of device of test application program, and described device includes:
Receiving module, for receiving connecing for the first interface that SDK caller is sent during test target function Mouth call request, wherein include at least input parameter value in the interface call request and first interface identifies;
Generation module, for being identified based on the input parameter value and first interface, generate with the input parameter value and The first interface identifies the abnormal output parameter value not matched that;
Feedback module, for feeding back the abnormal output parameter value to the SDK caller, so that the SDK is called Program continues to execute the test of the objective function based on the abnormal output parameter value.
Optionally, the generation module includes modification submodule and the first input submodule, in which:
The modification submodule obtains modified input parameter value for modifying the input parameter value;
First input submodule, for using the modified input parameter value as first interface mark pair The input for the first interface function answered generates abnormal output parameter value;Alternatively,
First input submodule, for using the input parameter value as first interface mark corresponding first The input of interface function generates the output parameter value to match with the input parameter value and the first interface function;
The modification submodule, for by it is described match with the input parameter value and the first interface function it is defeated Parameter value is revised as abnormal output parameter value out.
Optionally, the modification submodule, is used for:
The input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
The input parameter value is replaced with into preset first parameter value, obtains modified input parameter value;Alternatively,
The value type of the input parameter value is revised as preset first value type, obtains modified input ginseng Numerical value.
Optionally, the modification submodule, is used for:
The output parameter value to match with the input parameter value and the first interface function is increasedd or decreased Second preset value obtains abnormal output parameter value;Alternatively,
The output parameter value to match with the input parameter value and the first interface function is replaced with default The second parameter value, obtain abnormal output parameter value;Alternatively,
The value type of the output parameter value that matches with the input parameter value and the first interface function is repaired It is changed to preset second value type, obtains abnormal output parameter value.
Optionally, the generation module, is used for:
When detecting that carrying test in the interface call request identifies, it is based on the input parameter value and first interface Mark generates and identifies the abnormal output parameter value not matched that with the input parameter value and the first interface.
Optionally, the generation module includes determining submodule and the second input submodule, in which:
The determining submodule determines described first for the corresponding relationship according to interface identifier and wrong interface function The corresponding second interface function of interface identifier;
Second input submodule, for using the input parameter value as the input of the second interface function, life The abnormal output parameter value not matched that is identified at the input parameter value and the first interface.
Technical solution provided in an embodiment of the present invention has the benefit that
In the embodiment of the present invention, during test target function, SDK can receive the of SDK caller transmission The interface call request of one interface, wherein include at least input parameter value in interface call request and first interface identifies, SDK It can be identified based on input parameter value and first interface, generate and identify the exception not matched that with input parameter value and first interface Output parameter value feeds back abnormal output parameter value to SDK caller, so that SDK caller is based on abnormal output parameter value Continue to execute the test of objective function.In this way, when the objective function to application program is tested, it can be with simulation application The case where using abnormal input parameter value, to be tested, and then available application program is handling abnormal input parameter value When test result, so as to increase the validity of test result.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is the method flow diagram of test application program provided in an embodiment of the present invention;
Fig. 2 is the schematic diagram of a scenario of test application program provided in an embodiment of the present invention;
Fig. 3 is the schematic diagram of a scenario of test application program provided in an embodiment of the present invention;
Fig. 4 is the schematic diagram of a scenario of test application program provided in an embodiment of the present invention;
Fig. 5 is the apparatus structure schematic diagram of test application program provided in an embodiment of the present invention;
Fig. 6 is the apparatus structure schematic diagram of test application program provided in an embodiment of the present invention;
Fig. 7 is the apparatus structure schematic diagram of test application program provided in an embodiment of the present invention;
Fig. 8 is the structural schematic diagram of terminal provided in an embodiment of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
The embodiment of the invention provides a kind of method of test application program, the executing subject of this method can be SDK, peace Dress is equipped with SDK caller and SDK in the terminal, in terminal, and SDK caller and SDK are two of an application program Point, it include at least one interface, the corresponding interface function of each interface in SDK.Processor can be set in the terminal, deposited Reservoir, transceiver etc., processor can be used for the processing of the process of test application program, and memory can be used for storing test and answer With the data of the data and generation needed during program, transceiver can be used for receiving and transmitting data.In terminal The input-output equipment such as screen are also provided with, screen is displayed for test result and operation interface etc..
As shown in Figure 1, the process flow of this method may include following step:
Step 101, during test target function, the interface tune for the first interface that SDK caller is sent is received With request, wherein include at least input parameter value in interface call request and first interface identifies.
Wherein, objective function is any function of application program, such as function of search, input function.
In an implementation, when technical staff tests the objective function of some application program, can install in terminal should Application program, application program include two parts of SDK caller and SDK, and then user can click the figure of the application program Mark, terminal can then detect the enabled instruction of application program, and terminal can star the application program.If technical staff will be to mesh Mark function is tested, and technical staff can click the corresponding option of operation of the function, and SDK caller can then detect operation The corresponding operational order of option, and then can determine that the operational order is corresponding according to the corresponding relationship of operational order and interface The first interface of the first interface of SDK identifies and the corresponding input parameter value of the operational order, and generates interface calling and ask It asks, first interface mark and input parameter value is added in the interface call request, the interface of first interface is then sent to SDK Call request.SDK can receive SDK caller transmission interface call request, and therefrom parsing obtain input parameter value and First interface mark.
Step 102, it is identified based on input parameter value and first interface, generates and identified not with input parameter value and first interface The abnormal output parameter value to match.
In an implementation, SDK is parsed after obtaining input parameter value and first interface mark, and SDK can be based on to input parameter Value modifies or modifies to the corresponding output parameter value of input parameter value, makes the output parameter value and input generated Parameter value and first interface mark do not match that, obtain abnormal output parameter value.
Optionally, test process can be executed when detecting test mark, corresponding processing can be such that
When detecting that carrying test in interface call request identifies, identified based on input parameter value and first interface, it is raw The abnormal output parameter value not matched that is identified at input parameter value and first interface.
In an implementation, SDK caller can also add to when SDK transmission interface call request in interface call request Test is added to identify.It, can be with base if carrying test mark in interface call request after SDK receives interface call request In modifying to input parameter value or modifying to the corresponding output parameter value of input parameter value, make the output generated Parameter value is not matched that with input parameter value and first interface mark, obtains abnormal output parameter value
Optionally, it is identified based on input parameter value and first interface, generates and identified not with input parameter value and first interface Three kinds of feasible modes are given below in there are many ways to abnormal output parameter value to match:
Mode one: modification input parameter value, obtain modified input parameter value, using modified input parameter value as First interface identifies the input of corresponding first interface function, generates abnormal output parameter value.
Wherein, first interface function is that first interface identifies corresponding correct interface function in SDK.
In an implementation, as shown in Fig. 2, technical staff (can such as add one section of generation in the outer envelope SDK implanted layer of SDK Code etc.), SDK implanted layer can be used for obtaining input parameter value, modify to input parameter value.SDK parses to obtain input ginseng After numerical value and first interface mark, input parameter value can be modified, modified input parameter value is obtained, then from interface identifier In the corresponding relationship of correct interface function, determine that first interface identifies corresponding first interface function, and will be modified defeated Enter input of the parameter value as first interface function, since the input parameter value of first interface function has been modified, SDK output Output parameter value be abnormal output parameter value.
Mode two: identifying the input of corresponding first interface function using input parameter value as first interface, generate with it is defeated Enter the output parameter value that parameter value and first interface function match.
Wherein, first interface function is that first interface identifies corresponding correct interface function in SDK.
In an implementation, as shown in figure 3, technical staff (can such as add one section of generation in the outer envelope SDK implanted layer of SDK Code etc.), SDK implanted layer can be used for obtaining output parameter value, modify to output parameter value.SDK parses to obtain input ginseng After numerical value and first interface mark, first interface mark can be determined from the corresponding relationship of interface identifier and correct interface function Corresponding first interface function is known, then using input parameter value as the input of first interface function, due to first interface function Input parameter value be that correctly, can generally export correct output parameter value, i.e., identified with input parameter value and first interface The output parameter value (subsequent to be properly termed as normal input parameter value) to match, then SDK can modify correct output parameter Value obtains identifying the abnormal output parameter value not matched that with input parameter value and first interface.
Mode three: according to the corresponding relationship of interface identifier and wrong interface function, first interface mark corresponding the is determined Two interface functions are generated and are identified with input parameter value and first interface using input parameter value as the input of second interface function The abnormal output parameter value not matched that.
In an implementation, as shown in figure 4, technical staff can respectively correspond each interface addition wrong interface letter in SDK Number, the corresponding corresponding relationship that interface identifier and wrong interface function are added in SDK, for example, first interface mark is corresponding with First interface function and second interface function, wherein first interface function is correct interface function, and second interface function is mistake Interface function.Compiler toggle can also be arranged in technical staff in SDK, and the compiler toggle in SDK can be used for selecting interface mark Know corresponding wrong interface function.
SDK caller is marked to that when SDK transmission interface call request, can also add test in interface call request Know.After SDK receives interface call request, if carrying test mark in interface call request, SDK can connect according to first Mouth mark identifies corresponding second interface letter from first interface in the corresponding relationship of interface identifier and wrong interface function, is obtained Number, and it is abnormal defeated to will lead to due to call error interface function for generation using input parameter value as the input of second interface function Parameter value out.
Optionally, in mode one, modify the mode of input parameter value can have it is following several:
Input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
Input parameter value is replaced with into preset first parameter value;Alternatively,
The value type of input parameter value is revised as preset first value type, obtains modified input parameter Value.
In an implementation, the first preset value can be set in technical staff, and stores to being equipped with SDK and SDK caller Terminal in.SDK is parsed after obtaining input parameter value and first interface mark, available pre-stored first preset value, And input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value, by means of which, modification Input parameter value afterwards is only that size changes.For example, the first preset value is 1, input parameter value 0 can join input Numerical value is revised as 1, in this way, modified input parameter value is 1.
Alternatively, the first parameter value can be set in technical staff, and store to the end for being equipped with SDK and SDK caller In end.SDK is parsed after obtaining input parameter value and first interface mark, available pre-stored preset first parameter Value, then replaces with the first parameter value for input parameter value, obtains modified input parameter value, by means of which, modification Input parameter value afterwards is only that size changes.For example, the first parameter value is 5, input parameter value 2 can join input Numerical value is revised as 5, in this way, modified input parameter value is 5.
Alternatively, the first value type, such as int type (integer type), string type (serial type) can be set in technical staff, and And it stores to being equipped in the terminal of SDK and SDK caller.SDK is parsed after obtaining input parameter value and first interface mark, Available pre-stored preset first value type, is then revised as the first numerical value for the value type of input parameter value Type obtains modified input parameter value, and by means of which, modified input parameter value is only that value type becomes Change.For example, the first value type is int type, the value type of input parameter value is string type, string type can be inputted Parameter value is revised as int type input parameter value.
Optionally, in mode two, obtain the mode of abnormal output parameter value can have it is following several:
The output parameter value to match with input parameter value and first interface function is increasedd or decreased into the second preset value, is obtained To abnormal output parameter value;Alternatively,
The output parameter value to match with input parameter value and first interface function is replaced with into preset second parameter value, Obtain abnormal output parameter value;Alternatively,
Preset will be revised as with the match value type of output parameter value of input parameter value and first interface function Two value types obtain abnormal output parameter value.
In an implementation, the second preset value can be set in technical staff, and stores to being equipped with SDK and SDK caller Terminal in.SDK can be by output parameter value (the normal input of output to match with input parameter value and first interface mark Parameter value), the second preset value is increasedd or decreased, abnormal output parameter value is obtained, by means of which, obtained abnormal output ginseng Numerical value is only that size is not identical with normal output parameter value.For example, the second preset value is 1, normal output parameter value is 4, can be with Normal output parameter value is revised as 5, in this way, abnormal output parameter value is 5.
Alternatively, the second parameter value can be set in technical staff, and store to the end for being equipped with SDK and SDK caller In end.The output parameter value of output to match with input parameter value and first interface mark (can normally be inputted parameter by SDK Value), the second parameter value is replaced with, abnormal output parameter value is obtained, by means of which, abnormal output parameter value and normal output Parameter value is only that size is not identical.For example, the second parameter value is 2, normal output parameter value is 4, can be by normal output parameter Value is revised as 2, in this way, abnormal output parameter value is 2.
Alternatively, second value type, such as int type, string type can be set in technical staff, and store to being equipped with In the terminal of SDK and SDK caller.The value type of the normal output parameter value of output can be revised as the second number by SDK Value Types obtain abnormal output parameter value, and by means of which, abnormal output parameter value and normal output parameter value are only numerical value Type is not identical.For example, second value type is int type, the value type of normal output parameter value is string type, can be incited somebody to action String type output parameter value is revised as int type output parameter value.
Step 103, abnormal output parameter value is fed back to SDK caller, so that SDK caller is based on abnormal output ginseng Numerical value continues to execute the test of objective function.
In an implementation, after SDK determines abnormal output parameter value, abnormal output parameter value can be fed back to SDK caller, After SDK caller receives abnormal output parameter value, the subsequent survey that abnormal output parameter value carries out objective function can be used Examination (as test input function, follow-up test can with when show corresponding input results etc.).Technical staff can check that SDK is called The case where program continues to execute objective function using abnormal output parameter value, if application program shows the prompt of " operating mistake " Message, then it is assumed that there is no problem for the corresponding part code of objective function in SDK caller, if application program is directly moved back Out or blank screen, then it is assumed that for the corresponding part code of objective function there are problem, technical staff can be into SDK caller One step detect corresponding this partial code of objective function there are the problem of.
In the embodiment of the present invention, during test target function, SDK can receive the of SDK caller transmission The interface call request of one interface, wherein include at least input parameter value in interface call request and first interface identifies, SDK It can be identified based on input parameter value and first interface, generate and identify the exception not matched that with input parameter value and first interface Output parameter value feeds back abnormal output parameter value to SDK caller, so that SDK caller is based on abnormal output parameter value Continue to execute the test of objective function.In this way, when the objective function to application program is tested, it can be with simulation application The case where using abnormal input parameter value, to be tested, and then available application program is handling abnormal input parameter value When test result, so as to increase the validity of test result.
Based on the same technical idea, the embodiment of the invention provides a kind of devices of test application program, such as Fig. 5 institute Show, which includes:
Receiving module 510, for during test target function, receiving the first interface that SDK caller is sent Interface call request, wherein include at least input parameter value and first interface in the interface call request and identify;
Generation module 520 is generated and the input parameter value for being identified based on the input parameter value and first interface The abnormal output parameter value not matched that is identified with the first interface;
Feedback module 530, for feeding back the abnormal output parameter value to the SDK caller, so that the SDK tune The test of the objective function is continued to execute based on the abnormal output parameter value with program.
Optionally, as shown in fig. 6, the generation module 520 includes modifying submodule 521 and the first input submodule 522, Wherein:
The modification submodule 521 obtains modified input parameter value for modifying the input parameter value;
First input submodule 522, for using the modified input parameter value as the first interface mark Know the input of corresponding first interface function, generates abnormal output parameter value;Alternatively,
First input submodule 522, it is corresponding for being identified using the input parameter value as the first interface The input of first interface function generates the output parameter value to match with the input parameter value and the first interface function;
The modification submodule 521, for matching described with the input parameter value and the first interface function Output parameter value be revised as abnormal output parameter value.
Optionally, the modification submodule 521, is used for:
The input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
The input parameter value is replaced with into preset first parameter value, obtains modified input parameter value;Alternatively,
The value type of the input parameter value is revised as preset first value type, obtains modified input ginseng Numerical value.
Optionally, the modification submodule 521, is used for:
The output parameter value to match with the input parameter value and the first interface function is increasedd or decreased Second preset value obtains abnormal output parameter value;Alternatively,
The output parameter value to match with the input parameter value and the first interface function is replaced with default The second parameter value, obtain abnormal output parameter value;Alternatively,
The value type of the output parameter value that matches with the input parameter value and the first interface function is repaired It is changed to preset second value type, obtains abnormal output parameter value.
Optionally, the generation module 520, is used for:
When detecting carrying test mark in the interface call request, it is based on the input parameter value and first interface mark Know, generates and identify the abnormal output parameter value not matched that with the input parameter value and the first interface.
Optionally, as shown in fig. 7, the generation module 520 includes determining submodule 523 and the second input submodule 524, Wherein:
The determining submodule 523 determines described for the corresponding relationship according to interface identifier and wrong interface function The corresponding second interface function of one interface identifier;
Second input submodule 524, for using the input parameter value as the input of the second interface function, It generates and identifies the abnormal output parameter value not matched that with the input parameter value and the first interface.
In the embodiment of the present invention, during test target function, SDK can receive the of SDK caller transmission The interface call request of one interface, wherein include at least input parameter value in interface call request and first interface identifies, SDK It can be identified based on input parameter value and first interface, generate and identify the exception not matched that with input parameter value and first interface Output parameter value feeds back abnormal output parameter value to SDK caller, so that SDK caller is based on abnormal output parameter value Continue to execute the test of objective function.In this way, when the objective function to application program is tested, it can be with simulation application The case where using abnormal input parameter value, to be tested, and then available application program is handling abnormal input parameter value When test result, so as to increase the validity of test result.
It should be understood that the device of test application program provided by the above embodiment is in test application program, only with The division progress of above-mentioned each functional module can according to need and for example, in practical application by above-mentioned function distribution by not Same equipment is completed, i.e., the internal structure of device is divided into different equipment, described above all or part of to complete Function.In addition, the device of test application program provided by the above embodiment and the embodiment of the method for test application program belong to together One design, specific implementation process are detailed in embodiment of the method, and which is not described herein again.
Referring to FIG. 8, the terminal can be electricity it illustrates the structural schematic diagram of terminal involved in the embodiment of the present invention Brain etc. can be used for implementing the method for the test application program provided in above-described embodiment.Specifically:
Terminal 800 may include RF (Radio Frequency, radio frequency) circuit 110, include one or more meter The memory 120 of calculation machine readable storage medium storing program for executing, input unit 130, display unit 140, sensor 150, voicefrequency circuit 160, WiFi (wireless fidelity, Wireless Fidelity) module 170, the processing for including one or more than one processing core The components such as device 180 and power supply 190.It will be understood by those skilled in the art that terminal structure shown in Fig. 8 is not constituted pair The restriction of terminal may include perhaps combining certain components or different component cloth than illustrating more or fewer components It sets.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station After downlink information receives, one or the processing of more than one processor 180 are transferred to;In addition, the data for being related to uplink are sent to Base station.In general, RF circuit 110 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, uses Family identity module (SIM) card, transceiver, coupler, LNA (Low Noise Amplifier, low-noise amplifier), duplex Device etc..In addition, RF circuit 110 can also be communicated with network and other equipment by wireless communication.The wireless communication can make With any communication standard or agreement, and including but not limited to GSM (Global System of Mobile communication, entirely Ball mobile communcations system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (Short Messaging Service, short message service) etc..
Memory 120 can be used for storing software program and module, and processor 180 is stored in memory 120 by operation Software program and module, thereby executing various function application and data processing.Memory 120 can mainly include storage journey Sequence area and storage data area, wherein storing program area can the (ratio of application program needed for storage program area, at least one function Such as sound-playing function, image player function) etc.;Storage data area, which can be stored, uses created number according to terminal 800 According to (such as audio data, phone directory etc.) etc..In addition, memory 120 may include high-speed random access memory, can also wrap Include nonvolatile memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts. Correspondingly, memory 120 can also include Memory Controller, to provide processor 180 and input unit 130 to memory 120 access.
Input unit 130 can be used for receiving the number or character information of input, and generate and user setting and function Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 130 may include touching Sensitive surfaces 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad are collected and are used Family on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive table Operation on face 131 or near touch sensitive surface 131), and corresponding attachment device is driven according to preset formula.It is optional , touch sensitive surface 131 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is used The touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touch Touch information is received in detection device, and is converted into contact coordinate, then gives processor 180, and can receive processor 180 The order sent simultaneously is executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves Realize touch sensitive surface 131.In addition to touch sensitive surface 131, input unit 130 can also include other input equipments 132.Specifically, Other input equipments 132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.), One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 140 can be used for showing information input by user or the information and terminal 800 that are supplied to user Various graphical user interface, these graphical user interface can be made of figure, text, icon, video and any combination thereof. Display unit 140 may include display panel 141, optionally, can use LCD (Liquid Crystal Display, liquid crystal Show device), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure display panel 141.Further, touch sensitive surface 131 can cover display panel 141, when touch sensitive surface 131 detects touching on it or nearby After touching operation, processor 180 is sent to determine the type of touch event, is followed by subsequent processing device 180 according to the type of touch event Corresponding visual output is provided on display panel 141.Although in fig. 8, touch sensitive surface 131 and display panel 141 are conducts Two independent components realize input and input function, but in some embodiments it is possible to by touch sensitive surface 131 and display Panel 141 is integrated and realizes and outputs and inputs function.
Terminal 800 may also include at least one sensor 150, such as optical sensor, motion sensor and other sensings Device.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 141, and proximity sensor can close display when terminal 800 is moved in one's ear Panel 141 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect in all directions (generally Three axis) acceleration size, can detect that size and the direction of gravity when static, can be used to identify mobile phone posture application (ratio Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);Extremely In other sensors such as gyroscope, barometer, hygrometer, thermometer, the infrared sensors that terminal 800 can also configure, herein It repeats no more.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the audio interface between user and terminal 800.Audio Electric signal after the audio data received conversion can be transferred to loudspeaker 161, be converted to sound by loudspeaker 161 by circuit 160 Sound signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 162, after being received by voicefrequency circuit 160 Audio data is converted to, then by after the processing of audio data output processor 180, such as another end is sent to through RF circuit 110 End, or audio data is exported to memory 120 to be further processed.Voicefrequency circuit 160 is also possible that earphone jack, To provide the communication of peripheral hardware earphone Yu terminal 800.
WiFi belongs to short range wireless transmission technology, and terminal 800 can help user's transceiver electronics by WiFi module 170 Mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 8 is shown WiFi module 170, but it is understood that, and it is not belonging to must be configured into for terminal 800, it can according to need completely Do not change in the range of the essence of invention and omits.
Processor 180 is the control centre of terminal 800, utilizes each portion of various interfaces and connection whole mobile phone Point, by running or execute the software program and/or module that are stored in memory 120, and calls and be stored in memory 120 Interior data execute the various functions and processing data of terminal 800, to carry out integral monitoring to mobile phone.Optionally, processor 180 may include one or more processing cores;Preferably, processor 180 can integrate application processor and modem processor, Wherein, the main processing operation system of application processor, user interface and application program etc., modem processor mainly handles nothing Line communication.It is understood that above-mentioned modem processor can not also be integrated into processor 180.
Terminal 800 further includes the power supply 190 (such as battery) powered to all parts, it is preferred that power supply can pass through electricity Management system and processor 180 are logically contiguous, to realize management charging, electric discharge and power consumption by power-supply management system The functions such as management.Power supply 190 can also include one or more direct current or AC power source, recharging system, power supply event Hinder the random components such as detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal 800 can also include camera, bluetooth module etc., and details are not described herein.Specifically in this reality It applies in example, the display unit of terminal 800 is touch-screen display, and terminal 800 further includes having memory and one or one Above program, one of them perhaps more than one program be stored in memory and be configured to by one or one with Upper processor execution states one or more than one program includes the instruction for performing the following operation:
During test target function, the interface call request for the first interface that SDK caller is sent is received, In, input parameter value is included at least in the interface call request and first interface identifies;
It is identified, is generated and the input parameter value and the first interface mark based on the input parameter value and first interface Know the abnormal output parameter value not matched that;
To the SDK caller feedback abnormal output parameter value, so that the SDK caller is based on described different Normal output parameter value continues to execute the test of the objective function.
Optionally, described to be identified based on the input parameter value and first interface, it generates and the input parameter value and institute It states first interface and identifies the abnormal output parameter value not matched that, comprising:
The input parameter value is modified, modified input parameter value is obtained;
The input of corresponding first interface function is identified using the modified input parameter value as the first interface, Generate abnormal output parameter value;Alternatively,
The input of corresponding first interface function, generation and institute are identified using the input parameter value as the first interface State input parameter value and output parameter value that the first interface function matches;
The output parameter value to match with the input parameter value and the first interface function is revised as exception Output parameter value.
Optionally, the modification input parameter value, obtains modified input parameter value, comprising:
The input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
The input parameter value is replaced with into preset first parameter value, obtains modified input parameter value;Alternatively,
The value type of the input parameter value is revised as preset first value type, obtains modified input ginseng Numerical value.
Optionally, described by the output parameter value to match with the input parameter value and the first interface function It is revised as abnormal output parameter value, comprising:
The output parameter value to match with the input parameter value and the first interface function is increasedd or decreased Second preset value obtains abnormal output parameter value;Alternatively,
The output parameter value to match with the input parameter value and the first interface function is replaced with default The second parameter value, obtain abnormal output parameter value;Alternatively,
The value type of the output parameter value that matches with the input parameter value and the first interface function is repaired It is changed to preset second value type, obtains abnormal output parameter value.
Optionally, described to be identified based on the input parameter value and first interface, it generates and the input parameter value and institute It states first interface and identifies the abnormal output parameter value not matched that, comprising:
When detecting that carrying test in the interface call request identifies, it is based on the input parameter value and first interface Mark generates and identifies the abnormal output parameter value not matched that with the input parameter value and the first interface.
Optionally, described to be identified based on the input parameter value and first interface, it generates and the input parameter value and institute It states first interface and identifies the abnormal output parameter value not matched that, comprising:
According to the corresponding relationship of interface identifier and wrong interface function, determine that the first interface mark corresponding second connects Mouth function;
Using the input parameter value as the input of the second interface function, generate and the input parameter value and described First interface identifies the abnormal output parameter value not matched that.
In the embodiment of the present invention, during test target function, SDK can receive the of SDK caller transmission The interface call request of one interface, wherein include at least input parameter value in interface call request and first interface identifies, SDK It can be identified based on input parameter value and first interface, generate and identify the exception not matched that with input parameter value and first interface Output parameter value feeds back abnormal output parameter value to SDK caller, so that SDK caller is based on abnormal output parameter value Continue to execute the test of objective function.In this way, when the objective function to application program is tested, it can be with simulation application The case where using abnormal input parameter value, to be tested, and then available application program is handling abnormal input parameter value When test result, so as to increase the validity of test result.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (12)

1. a kind of method of test application program, which is characterized in that the described method includes:
During test target function, the interface for receiving the first interface that software development kit SDK caller is sent is called Request, wherein include at least input parameter value in the interface call request and first interface identifies, the software development kit SDK caller is made of the code in the application program in addition to SDK, and the objective function is appointing for the application program One function, the first interface are the either interface for including in SDK;
It is identified based on the input parameter value and first interface, generates and identified not with the input parameter value and the first interface The abnormal output parameter value to match;
To the SDK caller feedback abnormal output parameter value, so that the SDK caller is defeated based on the exception Parameter value continues to execute the test of the objective function out.
2. the method according to claim 1, wherein described be based on the input parameter value and first interface mark Know, generate and identify the abnormal output parameter value not matched that with the input parameter value and the first interface, comprising:
The input parameter value is modified, modified input parameter value is obtained;
The input of corresponding first interface function is identified using the modified input parameter value as the first interface, is generated Abnormal output parameter value;Alternatively,
Identify the input of corresponding first interface function using the input parameter value as the first interface, generate with it is described defeated Enter the output parameter value that parameter value and the first interface function match;
The output parameter value to match with the input parameter value and the first interface function is revised as abnormal output Parameter value.
3. according to the method described in claim 2, it is characterized in that, the modification input parameter value, obtains modified Input parameter value, comprising:
The input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
The input parameter value is replaced with into preset first parameter value, obtains modified input parameter value;Alternatively,
The value type of the input parameter value is revised as preset first value type, obtains modified input parameter Value.
4. according to the method described in claim 2, it is characterized in that, described will described and the input parameter value and described first The output parameter value that interface function matches is revised as abnormal output parameter value, comprising:
The output parameter value to match with the input parameter value and the first interface function is increasedd or decreased second Preset value obtains abnormal output parameter value;Alternatively,
By described with the input parameter value and output parameter value that the first interface function matches replaces with preset the Two parameter values obtain abnormal output parameter value;Alternatively,
The value type of the output parameter value that matches with the input parameter value and the first interface function is revised as Preset second value type, obtains abnormal output parameter value.
5. the method according to claim 1, wherein described be based on the input parameter value and first interface mark Know, generate and identify the abnormal output parameter value not matched that with the input parameter value and the first interface, comprising:
When detecting that carrying test in the interface call request identifies, it is based on the input parameter value and first interface mark Know, generates and identify the abnormal output parameter value not matched that with the input parameter value and the first interface.
6. according to the method described in claim 5, it is characterized in that, described be based on the input parameter value and first interface mark Know, generate and identify the abnormal output parameter value not matched that with the input parameter value and the first interface, comprising:
According to the corresponding relationship of interface identifier and wrong interface function, determine that the first interface identifies corresponding second interface letter Number;
Using the input parameter value as the input of the second interface function, generate and the input parameter value and described first The abnormal output parameter value that interface identifier does not match that.
7. a kind of device of test application program, which is characterized in that described device includes:
Receiving module connects for during test target function, receiving software development kit SDK caller is sent first The interface call request of mouth, wherein input parameter value is included at least in the interface call request and first interface identifies, it is described Software development kit SDK caller is made of the code in the application program in addition to SDK, and the objective function is described answers With any function of program, the first interface is the either interface for including in SDK;
Generation module is generated and the input parameter value and described for being identified based on the input parameter value and first interface First interface identifies the abnormal output parameter value not matched that;
Feedback module, for feeding back the abnormal output parameter value to the SDK caller, so that the SDK caller The test of the objective function is continued to execute based on the abnormal output parameter value.
8. device according to claim 7, which is characterized in that the generation module includes modification submodule and the first input Submodule, in which:
The modification submodule obtains modified input parameter value for modifying the input parameter value;
First input submodule, it is corresponding for being identified using the modified input parameter value as the first interface The input of first interface function generates abnormal output parameter value;Alternatively,
First input submodule, for identifying corresponding first interface for the input parameter value as the first interface The input of function generates the output parameter value to match with the input parameter value and the first interface function;
The modification submodule, for joining the output to match with the input parameter value and the first interface function Numerical value is revised as abnormal output parameter value.
9. device according to claim 8, which is characterized in that the modification submodule is used for:
The input parameter value is increasedd or decreased into the first preset value, obtains modified input parameter value;Alternatively,
The input parameter value is replaced with into preset first parameter value, obtains modified input parameter value;Alternatively,
The value type of the input parameter value is revised as preset first value type, obtains modified input parameter Value.
10. device according to claim 8, which is characterized in that the modification submodule is used for:
The output parameter value to match with the input parameter value and the first interface function is increasedd or decreased second Preset value obtains abnormal output parameter value;Alternatively,
By described with the input parameter value and output parameter value that the first interface function matches replaces with preset the Two parameter values obtain abnormal output parameter value;Alternatively,
The value type of the output parameter value that matches with the input parameter value and the first interface function is revised as Preset second value type, obtains abnormal output parameter value.
11. device according to claim 7, which is characterized in that the generation module is used for:
When detecting that carrying test in the interface call request identifies, it is based on the input parameter value and first interface mark Know, generates and identify the abnormal output parameter value not matched that with the input parameter value and the first interface.
12. device according to claim 11, which is characterized in that the generation module includes that determining submodule and second are defeated Enter submodule, in which:
The determining submodule determines the first interface for the corresponding relationship according to interface identifier and wrong interface function Identify corresponding second interface function;
Second input submodule, for using the input parameter value as the input of the second interface function, generate with The input parameter value and the first interface identify the abnormal output parameter value not matched that.
CN201610954518.8A 2016-10-27 2016-10-27 A kind of method and apparatus of test application program Active CN106502906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610954518.8A CN106502906B (en) 2016-10-27 2016-10-27 A kind of method and apparatus of test application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610954518.8A CN106502906B (en) 2016-10-27 2016-10-27 A kind of method and apparatus of test application program

Publications (2)

Publication Number Publication Date
CN106502906A CN106502906A (en) 2017-03-15
CN106502906B true CN106502906B (en) 2019-02-26

Family

ID=58321381

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610954518.8A Active CN106502906B (en) 2016-10-27 2016-10-27 A kind of method and apparatus of test application program

Country Status (1)

Country Link
CN (1) CN106502906B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107450909B (en) * 2017-06-30 2020-09-08 武汉斗鱼网络科技有限公司 Processing method and device for software development kit integration validity check
CN107861865B (en) * 2017-08-29 2020-11-17 平安普惠企业管理有限公司 SDK positioning method, device and computer readable storage medium
CN107943688A (en) * 2017-11-02 2018-04-20 北京奇虎科技有限公司 A kind of SDK inspection methods, device, terminal device and storage medium
CN109491905A (en) * 2018-11-02 2019-03-19 北京金山云网络技术有限公司 Head end test method, apparatus and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0594888A1 (en) * 1992-10-30 1994-05-04 International Business Machines Corporation Method and apparatus for computer software testing
CN103488489A (en) * 2013-09-30 2014-01-01 乐视网信息技术(北京)股份有限公司 Data processing method and device
CN105741093A (en) * 2016-01-25 2016-07-06 网易(杭州)网络有限公司 Payment method, device and system of mobile application

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9826045B2 (en) * 2014-09-26 2017-11-21 Oracle International Corporation Efficient means to test server generated applications on mobile device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0594888A1 (en) * 1992-10-30 1994-05-04 International Business Machines Corporation Method and apparatus for computer software testing
CN103488489A (en) * 2013-09-30 2014-01-01 乐视网信息技术(北京)股份有限公司 Data processing method and device
CN105741093A (en) * 2016-01-25 2016-07-06 网易(杭州)网络有限公司 Payment method, device and system of mobile application

Also Published As

Publication number Publication date
CN106502906A (en) 2017-03-15

Similar Documents

Publication Publication Date Title
CN106502906B (en) A kind of method and apparatus of test application program
CN105320598B (en) Method for testing software and device
CN105404585B (en) Obtain the method and device of code coverage
CN104636047B (en) The method, apparatus and touch screen terminal operated to the object in list
CN105278937B (en) A kind of method and device showing pop-up box message
CN104142868B (en) Establish the method and device of connection
CN104978176B (en) Application programming interfaces call method, device and computer readable storage medium
CN104954233B (en) Information-pushing method, device and system
CN104516812A (en) Method and device for testing software
CN105389259B (en) A kind of method, apparatus and system for carrying out Application testing
CN104965722B (en) A kind of method and device of display information
CN105808043B (en) A kind of setting method and mobile terminal of terminal applies
CN104516624B (en) A kind of method and device inputting account information
CN106294168B (en) A kind of method and system carrying out Application testing
CN104572046B (en) A kind of storehouse restoring method and computer system
CN106303605B (en) A kind of methods, devices and systems to send a notification message
CN104751333B (en) A kind of method, apparatus and system of information exchange
CN105847325B (en) The adjustment method and device of applications client
CN110413639A (en) Data check method and device, electronic equipment and computer readable storage medium
CN105530239B (en) Multi-medium data acquisition methods and device
CN105550316B (en) The method for pushing and device of audio list
CN104951324A (en) Method and device for acquiring application calling relation table
CN104699501B (en) A kind of method and device for running application program
CN105208057B (en) The correlating method and device of network account
CN106126411B (en) The method and apparatus that a kind of pair of tested program code is tested

Legal Events

Date Code Title Description
PB01 Publication
C06 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