CN113204477A - Application testing method and device, electronic equipment and storage medium - Google Patents

Application testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113204477A
CN113204477A CN202110350138.4A CN202110350138A CN113204477A CN 113204477 A CN113204477 A CN 113204477A CN 202110350138 A CN202110350138 A CN 202110350138A CN 113204477 A CN113204477 A CN 113204477A
Authority
CN
China
Prior art keywords
request
network request
configuration information
preset
target
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.)
Granted
Application number
CN202110350138.4A
Other languages
Chinese (zh)
Other versions
CN113204477B (en
Inventor
张维达
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110350138.4A priority Critical patent/CN113204477B/en
Publication of CN113204477A publication Critical patent/CN113204477A/en
Application granted granted Critical
Publication of CN113204477B publication Critical patent/CN113204477B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal 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)
  • Debugging And Monitoring (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present disclosure relates to an application test method, apparatus, electronic device and storage medium, the method includes responding to an application test instruction, calling a preset wrapper of a network request component; in a preset wrapper, performing request address configuration on an original network request based on preset test configuration information to obtain a target network request; sending request content in the target network request based on a request address in the target network request; in the response wrapper, performing response configuration on the returned original response data based on preset test configuration information to obtain target response data; and determining an application test result according to the target network request and the target response data. By utilizing the embodiment of the disclosure, the operation of application test can be simplified, and the test efficiency is improved.

Description

Application testing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to an application testing method and apparatus, an electronic device, and a storage medium.
Background
With the development of internet technology, various network applications are increasing, and the application test requirements are becoming more and more important. In the related art, because some applications are developed in a cross-platform manner, for example, the applications developed by using a Flutter framework, the Flutter framework is a cross-platform application development framework, when the developed applications are subjected to application testing, proxy settings of a system network cannot be read, a developer needs to perform proxy settings in the applications, further certificate installation is needed, a function of acquiring a request is set to a device corresponding to third-party software, and packet capturing in an application testing process is realized through operation of the device, so that the problems of complex operation, low efficiency and the like of the application testing are caused.
Disclosure of Invention
The present disclosure provides an application test method, an application test apparatus, an electronic device, and a storage medium, so as to solve at least the problems of complex operation, low efficiency, and the like of an application test in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided an application testing method, including:
responding to an application test instruction, and calling a preset wrapper of a network request component, wherein the preset wrapper is used for performing request configuration on an original network request created by the network request component;
in the preset wrapper, performing request configuration on the original network request based on preset test configuration information to obtain a target network request;
sending request content in the target network request based on a request address in the target network request;
in a response wrapper, performing response configuration on the returned original response data based on the preset test configuration information to obtain target response data;
and determining an application test result according to the target network request and the target response data.
Optionally, the performing, in the preset wrapper, request configuration on the original network request based on preset test configuration information to obtain a target network request includes:
in the preset wrapper, performing request address configuration on the original network request based on preset test configuration information, and wrapping the configured network request to obtain a request wrapper;
and in the request wrapper, performing content configuration on the request content in the configured network request based on the preset test configuration information to generate a target network request.
Optionally, the performing, in the preset wrapper, request address configuration on the original network request based on preset test configuration information includes:
calling an original network request component to create an original network request in the preset wrapper;
inquiring the preset test configuration information;
under the condition that the preset test configuration information comprises request address configuration information, establishing a target orientation method;
and modifying the request address in the original network request into the request address configuration information based on the target orientation method to obtain the configured network request.
Optionally, the performing, in the preset wrapper, request address configuration on the original network request based on preset test configuration information further includes:
and taking the original network request as the configured network request under the condition that the preset test configuration information does not include the request address configuration information.
Optionally, in the request wrapper, performing content configuration on request content in the configured network request based on the preset test configuration information, and generating a target network request includes:
in the request wrapper, inquiring the preset test configuration information;
under the condition that the preset test configuration information comprises the request content configuration information, creating a target writing method;
and modifying the request content in the configured network request into the request content configuration information based on the target writing method to obtain the target network request.
Optionally, the requesting wrapper is configured with a preset cache, and modifying the request content in the configured network request into the request content configuration information based on the target writing method to obtain the target network request includes:
writing the request content in the configured network request into the preset cache based on the target writing method to obtain a network request to be processed;
modifying the request content in the preset cache into the request content configuration information based on the target writing method;
and writing the modified request content in the preset cache into the network request to be processed based on the target writing method to obtain the target network request.
Optionally, in the request wrapper, performing content configuration on the request content in the configured network request based on the preset test configuration information, and generating a target network request further includes:
and taking the configured network request as the target network request under the condition that the preset test configuration information does not include the request content configuration information.
Optionally, the method further includes:
in the request wrapper, the original response instance is wrapped, resulting in a response wrapper.
Optionally, in the request wrapper, wrapping an original response instance, and obtaining a response wrapper includes:
in the request wrapper, creating a target response creation method;
and packaging the original response instance based on the target response creating method to obtain the response wrapper.
Optionally, the configuring, by the response wrapper, a response transformation method, where in the response wrapper, performing response configuration on the returned original response data based on the preset test configuration information to obtain target response data includes:
inquiring the preset test configuration information in the response wrapper;
under the condition that the preset test configuration information comprises response content configuration information, establishing a target monitoring method;
inserting the response transformation method before the original monitoring method based on the target monitoring method;
intercepting returned original response data based on the response transformation method, and modifying the original response data into the response content configuration information to obtain the target response data.
Optionally, the performing, in the response wrapper, response configuration on the returned original response data based on the preset test configuration information to obtain target response data further includes:
and taking the original response data as the target response data when the preset test configuration information is inquired to not comprise response content configuration information.
Optionally, the method further includes:
and acquiring the preset test configuration information from a configuration end based on a preset interaction service.
According to a second aspect of the embodiments of the present disclosure, there is provided an application testing apparatus including:
the preset wrapper calling module is configured to execute a preset wrapper responding to an application test instruction and calling a network request component, and the preset wrapper is used for performing request configuration on an original network request created by the network request component;
the network request configuration module is configured to be executed in the preset wrapper, and perform request configuration on the original network request based on preset test configuration information to obtain a target network request;
a request content sending module configured to execute sending the request content in the target network request based on the request address in the target network request;
the response configuration module is configured to execute response configuration on the returned original response data based on the preset test configuration information in a response wrapper to obtain target response data;
an application test result determination module configured to perform determining an application test result according to the target network request and the target response data.
Optionally, the network request configuration module includes:
a network request address configuration unit configured to execute in the preset wrapper, perform request address configuration on the original network request based on preset test configuration information, and wrap the configured network request to obtain a request wrapper;
and the content configuration unit is configured to execute content configuration on the request content in the configured network request based on the preset test configuration information in the request wrapper to generate a target network request.
Optionally, the network request address configuration unit includes:
the original network request creating unit is configured to be executed in the preset wrapper and call an original network request component to create an original network request;
a first preset test configuration information query unit configured to perform query of the preset test configuration information;
the target orientation method creating unit is configured to create a target orientation method under the condition that the preset test configuration information includes request address configuration information;
and the request address modification unit is configured to modify the request address in the original network request into the request address configuration information based on the target orientation method, so as to obtain the configured network request.
Optionally, the network request address configuration unit further includes:
and the configured network request determining unit is configured to execute the original network request as the configured network request when the preset test configuration information is inquired that the request address configuration information is not included.
Optionally, the content configuring unit includes:
a second preset test configuration information query unit configured to execute in the request wrapper to query the preset test configuration information;
a target writing method creating unit configured to perform creating a target writing method in a case where it is queried that the preset test configuration information includes the request content configuration information;
and the request content configuration information modification unit is configured to modify the request content in the configured network request into the request content configuration information based on the target writing method to obtain the target network request.
Optionally, the request wrapper is configured with a preset cache, and the request content configuration information modifying unit includes:
a first request content unit configured to perform writing the request content in the configured network request into the preset cache based on the target writing method to obtain a network request to be processed;
a request content modification unit configured to modify the request content in the preset cache to the request content configuration information based on the target writing method;
and the second request content unit is configured to write the modified request content in the preset cache into the network request to be processed based on the target writing method to obtain the target network request.
Optionally, the content configuring unit further includes:
and the target network request determining unit is configured to execute the configured network request as the target network request under the condition that the preset test configuration information does not include the request content configuration information.
Optionally, the apparatus further comprises:
a response instance wrapping module configured to perform wrapping of an original response instance in the request wrapper to obtain a response wrapper.
Optionally, the response instance packaging module includes:
a target response creation method creation unit configured to execute creating a target response creation method in the request wrapper;
and the response instance packaging unit is configured to perform packaging on the original response instance based on the target response creation method to obtain the response wrapper.
Optionally, the response wrapper is configured with a response transformation method, and the response configuration module includes:
a third preset test configuration information query unit configured to execute in the response wrapper to query the preset test configuration information;
a target monitoring method creating unit configured to create a target monitoring method in a case where it is queried that the preset test configuration information includes response content configuration information;
a response transformation method insertion unit configured to perform insertion of the response transformation method before an original listening method based on the target listening method;
and the response configuration unit is configured to intercept returned original response data based on the response transformation method, modify the original response data into the response content configuration information and obtain the target response data.
Optionally, the response configuration module further includes:
and the target response data determining unit is configured to execute that the original response data is taken as the target response data when the preset test configuration information is inquired that the response content configuration information is not included.
Optionally, the apparatus further comprises:
the preset test configuration information acquisition module is configured to execute acquisition of the preset test configuration information from a configuration terminal based on a preset interaction service.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method of any of the first aspects above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the method of any one of the first aspects of the embodiments of the present disclosure.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of any one of the first aspects of the embodiments of the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
in the application test process, the original network request can be configured by combining the preset test configuration information by calling the preset wrapper to obtain a target network request; after the request content in the target network request is sent based on the request address in the target network request, response configuration is carried out on the returned original response data based on preset test configuration information in a response wrapper to obtain target response data; and finally, determining an application test result according to the target network request and the target response data, in the application test process, the steps of relying on third-party software, avoiding certificate installation and the like are not needed, the operation of application test can be greatly simplified, and the application test efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow diagram illustrating a method of application testing in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating a request address configuration for an original network request based on preset test configuration information in a preset wrapper in accordance with an exemplary embodiment;
FIG. 3 is a flow diagram illustrating a target network request generated by a request wrapper based on preset test configuration information to perform content configuration on request content in a configured network request according to an exemplary embodiment;
FIG. 4 is a flowchart illustrating a target-based write method for modifying request content in a configured network request into request content configuration information to obtain a target network request according to an exemplary embodiment;
FIG. 5 is a flowchart illustrating a response configuration of returned raw response data in a response wrapper based on preset test configuration information to obtain target response data in accordance with an illustrative embodiment;
FIG. 6 is a schematic diagram illustrating an application environment in accordance with an illustrative embodiment;
FIG. 7 is a block diagram illustrating an application testing apparatus according to an exemplary embodiment;
FIG. 8 is a block diagram illustrating an electronic device for application testing in accordance with an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
Fig. 1 is a flowchart illustrating an application testing method according to an exemplary embodiment, where the application testing method is used in an electronic device to be tested or an electronic device installed with an application to be tested, and specifically, the application testing method may include the following steps.
In step S101, a preset wrapper of the network request component is invoked in response to applying the test instruction.
In practical applications, the application to be tested may include a business logic component and a network request component. In a particular embodiment, the business logic component can be a component for implementing the business logic of the application under test. The network request component may create a network requested component for the business logic corresponding to the combined business logic component. In an alternative embodiment, the business logic component may invoke a preset wrapper of the network request component.
In a specific embodiment, a network request may include request content and a request address. In practical application, the request address in the network request is often a background service address corresponding to the application program to be tested. In a specific embodiment, in application testing, in order to avoid affecting the service of the application program to be tested, it is often necessary to modify and configure the request address in the network request to redirect to a specified request address, such as a test server or a local access address. Correspondingly, the application to be tested may further include a preset wrapper. Specifically, the preset wrapper may be a wrapper of a preconfigured network request component, and specifically, the preset wrapper may be used to perform request configuration on an original network request created by the network request component.
In a specific embodiment, in the case that the request address in the network request needs to be redirected to the local, the application to be tested may also be provided with a local server. Alternatively, the local server may be a mini-server. Specifically, the local server may be in an open state and respond to the corresponding network request by monitoring the corresponding port.
In a specific embodiment, the application to be tested may further be provided with a preset interaction service, specifically, the preset interaction service may be used for performing interaction communication with the outside, and optionally, the preset interaction service may be a web service. In a specific embodiment, the method may further include: and acquiring preset test configuration information from the configuration terminal based on the preset interaction service.
In a specific embodiment, the preset test configuration information may include request address configuration information, request content configuration information, and response content configuration information. Specifically, the request address configuration information may be a pre-configured request address, the request content configuration information may be pre-configured request content, and the response content configuration information may be pre-configured response content.
In practical applications, at least one of the request address, the request content and the response content may be pre-configured in advance according to application requirements.
In a specific embodiment, assuming that a test needs to be performed on a login service, for example, when a user registers, a password is required to be greater than 8 bits before a registration button is clicked (i.e., the button becomes operable after the 8 bits are input), and accordingly, a case that the password submitted by the test cannot be tested is smaller than 8 bits can be realized by modifying request content in a network request, and accordingly, request content configuration information of "a password smaller than 8 bits" can be preconfigured.
In a specific embodiment, it is assumed that a test needs to be performed on a login service, for example, a user logs in through a mobile phone number, and the mobile phone number input by the user is correct; under normal conditions, the response data is successful in login; if the test of response failure needs to be carried out, the test can be realized by modifying the response data, and correspondingly, the response content configuration information of 'response failure' can be configured in advance.
In a specific embodiment, the configuration end may be a terminal that provides a test configuration service for a user, and specifically, the configuration end may be provided with a configuration page, and accordingly, the user may input preset test configuration information based on the configuration page, and transmit the preset test configuration information to the application to be tested based on the preset interaction service. Optionally, the preset test configuration information may also be transmitted to the electronic device where the application program to be tested is located, and optionally, the preset test configuration information may be stored in the electronic device.
In the above embodiment, the configuration end is used for configuring the test configuration information in advance, so that the test configuration can be conveniently and directly performed subsequently based on the preset test configuration information, and the test efficiency is improved.
In step S103, in the preset wrapper, request configuration is performed on the original network request based on the preset test configuration information, so as to obtain a target network request.
In an optional embodiment, in the preset wrapper, the obtaining the target network request by performing request configuration on the original network request based on the preset test configuration information may include: in a preset wrapper, performing request address configuration on an original network request based on preset test configuration information, and wrapping the configured network request to obtain a request wrapper; and in the request wrapper, performing content configuration on request content in the configured network request based on preset test configuration information to generate a target network request.
In the above embodiment, by calling the preset wrapper, the request address configuration may be performed on the original network request in combination with the preset test configuration information, and the configured network request is wrapped to obtain the request wrapper; furthermore, in the request wrapper, the content configuration can be performed on the request content in the configured network request by combining with the preset test configuration information to generate the target network request, so that the modification of the request address and the request content in the original network request can be realized, and the test requirement of the modification of the request address and the request content can be met.
In an alternative embodiment, as shown in fig. 2, the performing, in the preset wrapper, request address configuration on the original network request based on the preset test configuration information may include the following steps:
in step S201, in a preset wrapper, an original network request component is called to create an original network request;
in step S203, preset test configuration information is queried;
in step S205, in the case that it is found that the preset test configuration information includes the request address configuration information, a target targeting method is created;
in step S207, the request address in the original network request is modified into the request address configuration information based on the target oriented method, so as to obtain the configured network request.
In a particular embodiment, the target-oriented method may be a recreated method for opening the request address. In the embodiment of the present specification, by a method of recreating an opening request address, modification of a request address in a network request may be implemented, and a configured network request may be generated.
In a specific embodiment, if it is found that the preset test configuration information includes request address configuration information, that is, the current test needs to modify the request address, correspondingly, the request address in the original network request may be modified to the request address configuration information based on a target orientation method, so as to obtain the configured network request;
in the above embodiment, the current test requirement may be quickly and effectively identified by querying the preset test configuration information, and the modification of the request address in the original network request may be implemented by the method of re-creating the request address under the condition that the current test requirement includes the modification of the request address, so as to meet the test requirement of the request address modification.
In an alternative embodiment, as shown in fig. 2, the performing, in the preset wrapper, request address configuration on the original network request based on the preset test configuration information further includes the following steps:
in step S209, in the case that it is queried that the preset test configuration information does not include the request address configuration information, the original network request is taken as the configured network request.
In a specific embodiment, if it is found that the preset test configuration information does not include the request address configuration information, that is, the current test does not need to modify the request address, the original network request may be used as the configured network request.
In addition, it should be noted that, in practical applications, the target orientation method may also be created in advance before the preset test configuration information is queried.
In the above embodiment, the current test requirement can be quickly and effectively identified by querying the preset test configuration information, and the original network request is directly used as the configured network request under the condition that the current test requirement does not include the modification of the request address, so that the request address in the test process can be quickly determined, and the test efficiency is further improved.
In a specific embodiment, wrapping the configured network request, and obtaining the request wrapper may include: and generating a request wrapper based on the configured network request and the preset cache.
In a specific embodiment, the request wrapper may be a wrapper for wrapping the request content in the network request, and specifically, the preset cache is configured in the request wrapper, so that when the request content in the network request needs to be modified, the request content is stored by using the preset cache, and further, the request content in the network request can be rapidly modified.
In an alternative embodiment, as shown in fig. 3, the above-mentioned performing, in the request wrapper, content configuration on the request content in the configured network request based on the preset test configuration information may include the following steps:
in step S301, in the request wrapper, preset test configuration information is queried;
in step S303, in a case where it is found that the preset test configuration information includes the request content configuration information, a target writing method is created;
in step S305, based on the target writing method, the request content in the configured network request is modified into the request content configuration information, so as to obtain the target network request.
In a particular embodiment, the target write method may be used to perform a write process involving data during a requested content modification process.
In a specific embodiment, if it is found that the preset test configuration information includes request content configuration information, that is, the request content needs to be modified in the current test, the request content in the configured network request may be modified into the request content configuration information by combining with the recreated target writing method, so as to obtain the target network request.
In the above embodiment, the current test requirement may be quickly and effectively identified by querying the preset test configuration information, and the modification of the request content in the original network request may be realized by the recreated target writing method under the condition that the current test requirement includes the modification of the request content, so as to meet the test requirement for the request content modification.
In an optional embodiment, as shown in fig. 3, in the request wrapper, performing content configuration on the request content in the configured network request based on the preset test configuration information, and generating the target network request may further include:
in step S307, in the case that it is queried that the preset test configuration information does not include the request content configuration information, the configured network request is taken as the target network request.
In a specific embodiment, if it is found that the preset test configuration information does not include the request content configuration information, that is, the current test does not need to modify the request content, the configured network request may be used as the target network request.
In the above embodiment, the current test requirement can be quickly and effectively identified by querying the preset test configuration information, and the configured network request is directly used as the configured network request under the condition that the request content is not modified in the current test requirement, so that the target network request in the test process can be quickly determined, and the test efficiency is further improved.
In a specific embodiment, the requesting wrapper is configured with a preset cache, and accordingly, as shown in fig. 4, the modifying the request content in the configured network request into the request content configuration information based on the target writing method to obtain the target network request may include the following steps:
in step S401, writing request content in the configured network request into a preset cache based on a target writing method, so as to obtain a network request to be processed;
in step S403, modifying the request content in the preset cache to request content configuration information based on the target writing method;
in step S405, based on the target writing method, the modified request content in the preset cache is written into the network request to be processed, so as to obtain the target network request.
In a specific embodiment, after the request content in the configured network request is written into the preset cache based on the target writing method, the network request to be processed does not include the request content; correspondingly, under the condition that the request content needs to be modified, the modified request content in the preset cache can be written into the network request to be processed, so that the target network request is obtained.
In addition, it should be noted that, before querying the preset test configuration information, a target write method may also be created, and request content in the configured network request is written into the preset cache, and correspondingly, when querying that the preset test configuration information does not include the request content configuration information, the request content in the preset cache may be rewritten into the network request to be processed, so as to obtain the target network request.
In the above embodiment, the preset cache is configured in the request wrapper, so that when the request content in the network request needs to be modified, the request content is stored by using the preset cache, and further the request content in the network request can be rapidly modified.
In step S105, the request content in the target network request is transmitted based on the request address in the target network request.
In a specific embodiment, the request content in the target network request may be sent to the device corresponding to the request address, so that the corresponding device may process the target network request and return corresponding original response data.
In step S107, in the response wrapper, response configuration is performed on the returned original response data based on the response transformation method and the preset test configuration information, so as to obtain target response data.
In an optional embodiment, the method may further include: in the request wrapper, wrapping the original response instance to obtain a response wrapper;
in a specific embodiment, the original response instance may be an instance corresponding to the pre-generated original response data, and the instance may have the same data structure as the original response data.
In an alternative embodiment, wrapping the original response instance in the request wrapper may include: in a request wrapper, creating a target response creation method; and packaging the original response instance based on a target response creating method to obtain a response wrapper.
In the above embodiment, the response wrapper is obtained by wrapping the original response instance, so that when the response data modification requirement exists, the response data can be modified and configured conveniently, and the test requirement of the response data modification is met.
In a particular embodiment, wrapping the original response instance based on the target response creation method, and obtaining the response wrapper may include generating the response wrapper based on the response instance and the response transformation method.
In a specific embodiment, the response wrapper may be a wrapper for wrapping the response instance, and in particular, the response transformation method may be used to intercept the original response data and transform the original response data when the response data modification is required.
In an alternative embodiment, the configuring, by the response wrapper, a response transformation method, and accordingly, as shown in fig. 5, the performing, in the response wrapper, response configuration on the returned original response data based on the preset test configuration information to obtain target response data may include the following steps:
in step S1071, in the response wrapper, querying preset test configuration information;
in step S1073, in case that it is found that the preset test configuration information includes the response content configuration information, a target listening method is created;
in step S1075, a response transformation method is inserted before the original monitoring method based on the target monitoring method;
in step S1077, the returned original response data is intercepted based on the response transformation method, and the original response data is modified into the response content configuration information, resulting in the target response data.
In a specific embodiment, the target listening method may be used to perform listening configuration, and specifically, the target response data may be obtained by inserting a response transformation method before the original listening method, so that the response transformation method intercepts returned original response data, and modifies the original response data into response content configuration information.
In a specific embodiment, if it is found that the preset test configuration information includes response content configuration information, that is, the response content needs to be modified in the current test, the original response data may be modified into the response content configuration information by combining a target monitoring method and a response transformation method, so as to obtain target response data.
In the above embodiment, the current test requirement can be quickly and effectively identified by querying the preset test configuration information, and the modification of the original response data can be realized by the recreated target monitoring method and the response transformation method under the condition that the current test requirement includes the modification of the response content, so that the test requirement of the modification of the response data is met.
In an alternative embodiment, as shown in fig. 5, the performing response configuration on the returned original response data based on the preset test configuration information in the response wrapper to obtain the target response data may further include the following steps:
in step S1079, in the case where it is inquired that the preset test configuration information does not include the response content configuration information, the original response data is taken as the target response data.
In a specific embodiment, if it is found that the preset test configuration information does not include the response content configuration information, that is, the response content does not need to be modified in the current test, the original response data may be used as the target response data.
In the above embodiment, the current test requirement can be quickly and effectively identified by querying the preset test configuration information, and the target response data in the test process can be quickly determined by using the direct original response data as the target response data under the condition that the current test requirement does not include the modification of the response content, so that the test efficiency is improved.
In step S109, an application test result is determined according to the target network request and the target response data.
In a particular embodiment, the target network request and target response data may be used as application test results. In a specific embodiment, the application test result can be archived and stored, so that relevant personnel can perform test analysis by combining the application test result, and further, the application program can be improved better.
In a specific embodiment, a user can view an application test result at a configuration end through a preset interaction service built in an application program to be tested.
According to the technical scheme of the embodiment of the specification, the specification can carry out request configuration on the original network request by combining with the preset test configuration information through calling the preset wrapper in the application test process to obtain the target network request; after the request content in the target network request is sent based on the request address in the target network request, response configuration is carried out on the returned original response data based on preset test configuration information in a response wrapper to obtain target response data; and finally, determining an application test result according to the target network request and the target response data, in the application test process, the steps of relying on third-party software, avoiding certificate installation and the like are not needed, the operation of application test can be greatly simplified, and the application test efficiency is improved.
In a specific embodiment, as shown in fig. 6, fig. 6 is a schematic diagram illustrating an application environment according to an exemplary embodiment, and as shown in fig. 6, the application environment may include a terminal 100, a configuration end 200, and a server 300.
In a specific embodiment, the terminal 100 may run an application to be tested, and the terminal 100 may be used for application testing. Specifically, the application to be tested may include a business logic component 101, a preset wrapper 102, a request wrapper 103, a response wrapper 104, a local server 105, and a preset interaction service 106 during the testing process. Specifically, the configuration end 200 may provide the user with a test configuration service and a viewing access of the test results. Specifically, the server 300 may be a background server corresponding to the application to be tested.
In practical application, a user may, in combination with practical application requirements, perform configuration of preset test configuration information in advance based on the configuration end 200, and specifically, may perform configuration of preset test configuration information on an application program to be tested based on the preset interaction service 106; when a test is required, the service logic component 101 may call the preset wrapper 102, and in the preset wrapper 102, the preset test configuration information may be checked, and if it is checked that the preset test configuration information includes the request address configuration information, the request address configuration is performed on the original network request, and the configured network request is packaged to obtain a request wrapper 103; next, in the request wrapper 103, preset test configuration information may be checked, and if it is detected that the preset test configuration information includes request content configuration information, content configuration is performed on request content in the configured network request, so as to generate a target network request; then, the request content can be sent to the server 300 or the local server 105 by combining the request address in the target network request; in the request wrapper 103, wrapping the original response instance to obtain a response wrapper 104; furthermore, in the response wrapper 104, in the case of original response data returned by the server 300 or the local server 105, preset test configuration information may be checked, and if it is checked that the preset test configuration information includes response content configuration information, response configuration may be performed on the original response data to obtain target response data; and determining an application test result according to the target network request and the target response data. Optionally, the user may view the application test result through the configuration end 200, and specifically, the configuration end 200 may view the application test result based on the preset interaction service 106.
In an alternative embodiment, the terminal 100 and the configuration end 200 may include, but are not limited to, smart phones, desktop computers, tablet computers, notebook computers, smart speakers, digital assistants, Augmented Reality (AR)/Virtual Reality (VR) devices, smart wearable devices, and other types of electronic devices. Optionally, the operating system running on the electronic device may include, but is not limited to, an android system, an IOS system, linux, windows, and the like.
In an optional embodiment, the server 300 may be an independent physical server, may also be a server cluster or a distributed system formed by a plurality of physical servers, and may also be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like.
In this embodiment, the terminal 100, the configuration end 200, and the server 300 may be directly or indirectly connected through wired or wireless communication, and the disclosure is not limited herein.
FIG. 7 is a block diagram illustrating an application testing apparatus according to an exemplary embodiment. Referring to fig. 7, the apparatus includes:
a preset wrapper calling module 710 configured to execute calling a preset wrapper of the network request component in response to the application test instruction, the preset wrapper being used for performing request address configuration on the original network request created by the network request component;
a network request configuration module 720, configured to execute in a preset wrapper, perform request configuration on an original network request based on preset test configuration information, and obtain a target network request;
a request content sending module 730 configured to execute sending the request content in the target network request based on the request address in the target network request;
a response configuration module 740 configured to execute response configuration on the returned original response data based on the preset test configuration information in the response wrapper to obtain target response data;
an application test result determination module 750 configured to perform determining an application test result based on the target network request and the target response data.
Optionally, the network request configuration module 720 includes:
the network request address configuration unit is configured to be executed in a preset wrapper, perform request address configuration on an original network request based on preset test configuration information, and wrap the configured network request to obtain a request wrapper;
and the content configuration unit is configured to execute content configuration on the request content in the configured network request based on preset test configuration information in the request wrapper to generate the target network request.
Optionally, the network request address configuration unit includes:
the original network request creating unit is configured to be executed in a preset wrapper and call an original network request component to create an original network request;
a first preset test configuration information query unit configured to perform query of preset test configuration information;
the target orientation method creating unit is configured to create a target orientation method when the preset test configuration information is inquired to include the request address configuration information;
and the request address modification unit is configured to modify the request address in the original network request into request address configuration information based on a target orientation method, so as to obtain the configured network request.
Optionally, the network request address configuration unit further includes:
and the configured network request determining unit is configured to execute the original network request as the configured network request under the condition that the query result shows that the preset test configuration information does not include the request address configuration information.
Optionally, the content configuration unit includes:
a second preset test configuration information query unit configured to be executed in the request wrapper to query the preset test configuration information;
a target writing method creating unit configured to perform creating a target writing method in a case where it is queried that the preset test configuration information includes the request content configuration information;
and the request content configuration information modification unit is configured to execute a target writing method, modify the request content in the configured network request into request content configuration information and obtain the target network request.
Optionally, the request wrapper is configured with a preset cache, and the request content configuration information modifying unit includes:
the first request content unit is configured to write the request content in the configured network request into a preset cache based on a target writing method to obtain a network request to be processed;
a request content modification unit configured to perform modification of request content in a preset cache to request content configuration information based on a target writing method;
and the second request content unit is configured to execute a target writing method, write the modified request content in the preset cache into the network request to be processed, and obtain the target network request.
Optionally, the content configuration unit further includes:
and the target network request determining unit is configured to execute the configured network request as the target network request under the condition that the preset test configuration information does not include the request content configuration information.
Optionally, the apparatus further comprises:
and the response instance wrapping module is configured to be executed in the request wrapper to wrap the original response instance to obtain the response wrapper.
Optionally, the response instance wrapping module includes:
a target response creation method creation unit configured to execute creating a target response creation method in the request wrapper;
and the response instance packaging unit is configured to execute a target response creation method, package the original response instance and obtain a response wrapper.
Optionally, the response wrapper is configured with a response transformation method, and the response configuration module 740 includes:
a third preset test configuration information query unit configured to be executed in the response wrapper to query the preset test configuration information;
a target monitoring method creating unit configured to create a target monitoring method in a case where it is queried that the preset test configuration information includes the response content configuration information;
a response transformation method insertion unit configured to perform insertion of a response transformation method before an original listening method based on a target listening method;
and the response configuration unit is configured to intercept the returned original response data based on a response transformation method, modify the original response data into response content configuration information and obtain target response data.
Optionally, the response configuration module 740 further includes:
and the target response data determining unit is configured to perform that the original response data is taken as the target response data when the preset test configuration information is inquired that the response content configuration information is not included.
Optionally, the apparatus further comprises:
and the preset test configuration information acquisition module is configured to execute acquisition of the preset test configuration information from the configuration terminal based on the preset interaction service.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 8 is a block diagram illustrating an electronic device for application testing, which may be a terminal, according to an exemplary embodiment, and an internal structure thereof may be as shown in fig. 8. The electronic device comprises a processor, a memory, a network interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement an application testing method. The display screen of the electronic equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the electronic equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and does not constitute a limitation on the electronic devices to which the disclosed aspects apply, as a particular electronic device may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
In an exemplary embodiment, there is also provided an electronic device including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the application testing method as in the embodiments of the present disclosure.
In an exemplary embodiment, there is also provided a computer-readable storage medium, in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform an application testing method in embodiments of the present disclosure.
In an exemplary embodiment, a computer program product containing instructions is also provided, which when run on a computer, causes the computer to perform the application testing method in the embodiments of the present disclosure.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An application testing method, comprising:
responding to an application test instruction, and calling a preset wrapper of a network request component, wherein the preset wrapper is used for performing request configuration on an original network request created by the network request component;
in the preset wrapper, performing request configuration on the original network request based on preset test configuration information to obtain a target network request;
sending request content in the target network request based on a request address in the target network request;
in a response wrapper, performing response configuration on the returned original response data based on the preset test configuration information to obtain target response data;
and determining an application test result according to the target network request and the target response data.
2. The application testing method of claim 1, wherein the performing, in the preset wrapper, a request configuration on the original network request based on preset test configuration information to obtain a target network request comprises:
in the preset wrapper, performing request address configuration on the original network request based on preset test configuration information, and wrapping the configured network request to obtain a request wrapper;
and in the request wrapper, performing content configuration on the request content in the configured network request based on the preset test configuration information to generate a target network request.
3. The application testing method of claim 2, wherein the performing, in the preset wrapper, request address configuration on the original network request based on preset test configuration information comprises:
calling an original network request component to create an original network request in the preset wrapper;
inquiring the preset test configuration information;
under the condition that the preset test configuration information comprises request address configuration information, establishing a target orientation method;
and modifying the request address in the original network request into the request address configuration information based on the target orientation method to obtain the configured network request.
4. The application testing method of claim 3, wherein the performing, in the preset wrapper, request address configuration on the original network request based on preset test configuration information further comprises:
and taking the original network request as the configured network request under the condition that the preset test configuration information does not include the request address configuration information.
5. The application testing method of claim 2, wherein the performing, in the request wrapper, content configuration on the request content in the configured network request based on the preset test configuration information, and generating a target network request comprises:
in the request wrapper, inquiring the preset test configuration information;
under the condition that the preset test configuration information comprises the request content configuration information, creating a target writing method;
and modifying the request content in the configured network request into the request content configuration information based on the target writing method to obtain the target network request.
6. The application testing method of claim 5, wherein the request wrapper is configured with a preset cache, and the modifying the request content in the configured network request into the request content configuration information based on the target writing method to obtain the target network request comprises:
writing the request content in the configured network request into the preset cache based on the target writing method to obtain a network request to be processed;
modifying the request content in the preset cache into the request content configuration information based on the target writing method;
and writing the modified request content in the preset cache into the network request to be processed based on the target writing method to obtain the target network request.
7. An application testing apparatus, comprising:
the preset wrapper calling module is configured to execute a preset wrapper responding to an application test instruction and calling a network request component, and the preset wrapper is used for performing request configuration on an original network request created by the network request component;
the network request configuration module is configured to be executed in the preset wrapper, and perform request configuration on the original network request based on preset test configuration information to obtain a target network request;
a request content sending module configured to execute sending the request content in the target network request based on the request address in the target network request;
the response configuration module is configured to execute response configuration on the returned original response data based on the preset test configuration information in a response wrapper to obtain target response data;
an application test result determination module configured to perform determining an application test result according to the target network request and the target response data.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the application testing method of any of claims 1 to 6.
9. A computer readable storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the application testing method of any of claims 1 to 6.
10. A computer program product comprising computer instructions, characterized in that the computer instructions, when executed by a processor, implement the application testing method of any of claims 1 to 6.
CN202110350138.4A 2021-03-31 2021-03-31 Application testing method and device, electronic equipment and storage medium Active CN113204477B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110350138.4A CN113204477B (en) 2021-03-31 2021-03-31 Application testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110350138.4A CN113204477B (en) 2021-03-31 2021-03-31 Application testing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113204477A true CN113204477A (en) 2021-08-03
CN113204477B CN113204477B (en) 2024-01-12

Family

ID=77025995

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110350138.4A Active CN113204477B (en) 2021-03-31 2021-03-31 Application testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113204477B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664395A (en) * 2018-04-26 2018-10-16 武汉斗鱼网络科技有限公司 Applied program testing method, device, equipment and storage medium
US10146666B1 (en) * 2017-08-29 2018-12-04 Facebook, Inc. Systems and methods for improving comparative performance test results of mobile applications
CN109582556A (en) * 2017-09-29 2019-04-05 阿里巴巴集团控股有限公司 Test method, the device and system of a kind of application program in running of mobile terminal situation
CN110413512A (en) * 2019-07-03 2019-11-05 深圳市珍爱捷云信息技术有限公司 AB test method, device, computer equipment and storage medium
CN110727589A (en) * 2019-09-30 2020-01-24 北京创鑫旅程网络技术有限公司 Test method, device and equipment
CN110753020A (en) * 2018-07-24 2020-02-04 北京京东尚科信息技术有限公司 Network request processing method and device
CN111914262A (en) * 2020-08-12 2020-11-10 中国工商银行股份有限公司 Test method, device, system, electronic equipment and storage medium
CN112306858A (en) * 2020-05-21 2021-02-02 北京字节跳动网络技术有限公司 Test method and device and electronic equipment
EP3786824A1 (en) * 2019-08-30 2021-03-03 Beijing Xiaomi Mobile Software Co., Ltd. Methods and devices for testing an application on a terminal

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10146666B1 (en) * 2017-08-29 2018-12-04 Facebook, Inc. Systems and methods for improving comparative performance test results of mobile applications
CN109582556A (en) * 2017-09-29 2019-04-05 阿里巴巴集团控股有限公司 Test method, the device and system of a kind of application program in running of mobile terminal situation
CN108664395A (en) * 2018-04-26 2018-10-16 武汉斗鱼网络科技有限公司 Applied program testing method, device, equipment and storage medium
CN110753020A (en) * 2018-07-24 2020-02-04 北京京东尚科信息技术有限公司 Network request processing method and device
CN110413512A (en) * 2019-07-03 2019-11-05 深圳市珍爱捷云信息技术有限公司 AB test method, device, computer equipment and storage medium
EP3786824A1 (en) * 2019-08-30 2021-03-03 Beijing Xiaomi Mobile Software Co., Ltd. Methods and devices for testing an application on a terminal
CN110727589A (en) * 2019-09-30 2020-01-24 北京创鑫旅程网络技术有限公司 Test method, device and equipment
CN112306858A (en) * 2020-05-21 2021-02-02 北京字节跳动网络技术有限公司 Test method and device and electronic equipment
CN111914262A (en) * 2020-08-12 2020-11-10 中国工商银行股份有限公司 Test method, device, system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113204477B (en) 2024-01-12

Similar Documents

Publication Publication Date Title
CN110008118B (en) Page data testing method and device, computer equipment and storage medium
CN110990205B (en) Interface call testing method, device and computer readable storage medium
US10263910B2 (en) Resource calling for hybrid applications
US10305962B1 (en) Unit testing clients of web services
CN109190067B (en) Browser input box display method and device, computer equipment and storage medium
CN103970760B (en) A kind of web-page requests processing method and processing device
CN107181779B (en) Method, device and system for processing access request
CN108108219B (en) Application program running method and device, computer equipment and storage medium
CN111008132B (en) Application debugging method and device for Android system, computer equipment and storage medium
CN110597709B (en) Interactive debugging method and device for mixed-mode mobile application and computer equipment
CN111193768A (en) Network data processing method and device, computer equipment and storage medium
CN111431767B (en) Multi-browser resource synchronization method and device, computer equipment and storage medium
CN115225707A (en) Resource access method and device
CN114661580A (en) Flow recording playback method and device, computer equipment and storage medium
CN112685669A (en) Page rendering method and system
CN113726770A (en) Data interception method and device, computer equipment and storage medium
CN109889468B (en) Network data transmission method, system, device, equipment and storage medium
CN112822061A (en) Method and system for exposing service to outside by edge node
CN113467855A (en) Webpage request processing method and device, electronic equipment and storage medium
CN112507298B (en) User authentication method, device, server and storage medium
TWI672019B (en) Method and device for calling a file
CN113204477B (en) Application testing method and device, electronic equipment and storage medium
CN111552643A (en) Multi-browser webpage access synchronization method and system
CN109492144B (en) Association relation analysis method, device and storage medium for software system
CN113419968B (en) Application testing method and device, electronic equipment and storage medium

Legal Events

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