CN115905020A - Application testing method and device, electronic equipment and storage medium - Google Patents
Application testing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN115905020A CN115905020A CN202211719144.3A CN202211719144A CN115905020A CN 115905020 A CN115905020 A CN 115905020A CN 202211719144 A CN202211719144 A CN 202211719144A CN 115905020 A CN115905020 A CN 115905020A
- Authority
- CN
- China
- Prior art keywords
- application
- target
- test
- case
- testing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 280
- 238000003860 storage Methods 0.000 title claims abstract description 29
- 238000000034 method Methods 0.000 claims abstract description 52
- 238000004590 computer program Methods 0.000 claims description 14
- 230000009471 action Effects 0.000 claims description 10
- 230000004044 response Effects 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 21
- 230000008569 process Effects 0.000 description 16
- 230000006870 function Effects 0.000 description 9
- 238000012545 processing Methods 0.000 description 6
- 230000008901 benefit Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 238000010998 test method Methods 0.000 description 4
- 238000002360 preparation method Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 238000009434 installation Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 241000218691 Cupressaceae Species 0.000 description 1
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 description 1
- XSQUKJJJFZCRTK-NJFSPNSNSA-N UREA C 14 Chemical compound N[14C](N)=O XSQUKJJJFZCRTK-NJFSPNSNSA-N 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 235000014510 cooky Nutrition 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 229910052711 selenium Inorganic materials 0.000 description 1
- 239000011669 selenium Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The disclosure provides an application testing method, an application testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring an executable file for carrying out automatic testing on a target application; setting an application test environment corresponding to the target application by installing the executable file; under the condition that an application test case is compiled in an application test environment, a test result aiming at a target application is obtained by executing the application test case. The application test case is compiled in an application test environment corresponding to the target application, so that the test requirement of the target application is met, the automatic application test can be performed through the automatic execution of the application test case, and the test efficiency is high.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an application testing method and apparatus, an electronic device, and a storage medium.
Background
After the application program is developed, the application program needs to be tested, so that problems can be found in time according to the test result, and the application program can be modified and improved. The test here may be, for example, a User Interface (UI) test.
In the traditional technology, a test script for UI test is generally written and debugged manually, and much time is consumed in the process of writing and debugging the test script.
Disclosure of Invention
The embodiment of the disclosure at least provides an application testing method, an application testing device, electronic equipment and a storage medium, so as to automatically perform testing, and the testing efficiency is high.
In a first aspect, an embodiment of the present disclosure provides an application testing method, including:
acquiring an executable file for carrying out automatic testing on a target application;
setting an application test environment corresponding to the target application by installing the executable file;
and under the condition that an application test case is compiled in the application test environment, a test result aiming at the target application is obtained by executing the application test case.
In a possible implementation manner, in a case that the application test case includes a first sub-case for operating on a user interface UI in the target application, the obtaining a test result for the target application by executing the application test case includes:
acquiring a first operation flow matched with the first sub-case;
determining whether a target UI element can be located while the first operation flow is executed;
if so, determining a successful test result aiming at the UI in the target application;
and if not, determining a test failure result aiming at the UI in the target application.
In one possible implementation, the determining whether the target UI element can be located includes:
judging whether a preset positioning configuration rule corresponding to the target UI element exists or not to obtain a judgment result;
and determining whether the target UI element is positioned or not based on the judgment result.
In a possible implementation manner, the determining whether to locate the target UI element based on the determination result includes:
determining to locate the target UI element under the condition that a preset locating configuration rule corresponding to the target UI element is judged to exist within a preset time length; or,
judging that no preset positioning configuration rule corresponding to a target UI element exists within preset time length, and acquiring an HTML source code corresponding to a UI in the target application; and determining whether the target UI element is positioned or not by analyzing the HTML source codes.
In a possible implementation, the determining whether to locate the target UI element by parsing the HTML source code includes:
analyzing the HTML source code, and determining whether an action tag corresponding to a target UI element exists;
in an instance in which it is determined that an action tag exists, it is determined to locate the target UI element.
In a possible embodiment, the preset positioning configuration rule is determined according to the following steps:
under the application test environment, generating an automatic test item by calling an uprunner command; the automatic test items comprise preset positioning configuration rules corresponding to the target UI elements.
In one possible embodiment, the generating an automated test item by invoking an uprunner command includes:
calling an uprunner command and starting a scaffold tool;
creating a UI element folder using the scaffold tool; the UI element folder comprises preset positioning configuration rules corresponding to the target UI elements.
In one possible embodiment, the method further comprises:
acquiring attribute information of the target application;
and updating the preset positioning configuration rule based on the attribute information, or reestablishing the positioning configuration rule aiming at other UI elements.
In a possible implementation manner, in a case that the application test case includes a second sub-case for operating an HTTP interface in the target application, the obtaining a test result for the target application by executing the application test case includes:
acquiring a second operation flow matched with the second sub-case;
under the condition of executing the second operation flow, sending a first request message to the HTTP interface;
and determining a test result aiming at the HTTP interface in the target application based on the response result returned by the HTTP interface.
In a possible implementation manner, in a case that the application test case includes a third sub-case operating on a Form in the target application, the obtaining a test result for the target application by executing the application test case includes:
acquiring a third operation flow matched with the third sub-case;
under the condition of executing the third operation flow, sending a second request message to a Form skip platform;
and determining a test result aiming at the Form in the target application based on the skip result on the Form skip platform.
In a possible implementation manner, in a case that the application test case includes a plurality of sub-cases operating on elements in the target application, the obtaining a test result for the target application by executing the application test case includes:
obtaining writing structure contents corresponding to the plurality of sub-cases; the writing structure content defines the operation sequence for executing the plurality of sub-cases;
and executing the plurality of sub-cases according to the operation sequence to obtain a test result aiming at the target application.
In a second aspect, the present disclosure also provides an application testing apparatus, including:
the system comprises an acquisition module, a test module and a control module, wherein the acquisition module is used for acquiring an executable file for automatically testing a target application;
the setting module is used for setting an application test environment corresponding to the target application by installing the executable file;
and the testing module is used for obtaining a testing result aiming at the target application by executing the application testing case under the condition that the application testing case is compiled in the application testing environment.
In a third aspect, the present disclosure also provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the application testing method according to the first aspect and any of its various embodiments.
In a fourth aspect, the present disclosure also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the application testing method according to the first aspect and any of its various embodiments.
By adopting the application testing method, the application testing device, the electronic equipment and the storage medium, under the condition that the executable file for automatically testing the target application is obtained, the application testing environment corresponding to the target application is set by installing the executable file, so that under the condition that the application testing case is compiled under the application testing environment, the testing result aiming at the target application can be obtained by executing the application testing case. The application test case is compiled under the application test environment corresponding to the target application, the test requirement of the target application is better met, automatic application test can be performed through automatic execution of the application test case, and the test efficiency is higher.
Other advantages of the present disclosure will be explained in more detail in conjunction with the following description and the accompanying drawings.
It should be understood that the above description is only an outline of the technical solution of the present disclosure so that the technical means of the present disclosure can be more clearly understood, and thus can be implemented according to the content of the specification. In order to make the aforementioned and other objects, features and advantages of the present disclosure comprehensible, specific embodiments thereof are described below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty. Also, like reference numerals are used to refer to like elements throughout. In the drawings:
FIG. 1 is a flow chart illustrating an application testing method provided by an embodiment of the present disclosure;
fig. 2 is a diagram illustrating a specific example of an application test case in the application test method provided in the embodiment of the present disclosure;
FIG. 3 is a diagram illustrating a specific example of generating an automated test item in the application testing method provided by the embodiment of the present disclosure;
fig. 4 is a flowchart illustrating a specific method for UI testing in the application testing method provided in the embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an automated testing framework in an application testing method provided by an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of an automation case in the application testing method provided by the embodiment of the disclosure;
FIG. 7 is a schematic diagram of an application testing apparatus provided in an embodiment of the present disclosure;
fig. 8 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In the description of the embodiments of the present disclosure, it is to be understood that terms such as "including" or "having" are intended to indicate the presence of the features, numbers, steps, actions, components, parts, or combinations thereof disclosed in the specification, and are not intended to preclude the presence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.
Unless otherwise stated, "/" indicates an OR meaning, e.g., A/B may indicate A or B; "and/or" herein is merely an association relationship describing an associated object, and means that there may be three relationships, for example, a and/or B, and may mean: a exists alone, A and B exist simultaneously, and B exists alone.
The terms "first", "second", and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or to implicitly indicate the number of technical features indicated. Thus, features defined as "first", "second", etc. may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present disclosure, "a plurality" means two or more unless otherwise specified.
Through research, some automated testing frameworks are provided in the related art, and either testing interfaces or testing pure UIs are provided, however, for some common B2C financial products (such as application programs of online payment of the union of business, web page payment of a mobile phone, a cash desk on the union of business and the like), it is found that the testing process of such products includes both interfaces and page UIs, and meanwhile, the display of pages is diversified. It can be seen that the test scenario of the conventional test framework is single, and the test framework cannot be adapted to the automatic test of such products. Meanwhile, most of common financial products relate to versions, are fast in iteration and high in requirements, and the testing efficiency and the quality guarantee need to be improved through automation.
At present, most solutions in the industry related to automated UI testing are written in a dimension of a case using a script, which requires a certain front-end basis and encoding capability for a case writer and increases difficulty in case management.
The automated testing framework or tool currently prevailing in the industry is shown in the following table:
test scenario | Automated test framework or tool |
Pages class | selenium、cypress |
Interface class | jmeter、postman、httpRunner |
APP classes | appium、airtest |
1) The test scene of the automatic test framework is single, and B2C products relate to the scenes related to pages and interfaces and cannot support the products to finish automatic tests.
2) The framework only realizes some automatic capabilities, the definition of an automatic case, the execution of a test task and the test result are not clear, and the construction process needs to be finished through a third-party component (such as nose, pytest and the like), so that the complexity of constructing an automatic test system is further increased.
3) The automatic frame related to the page needs a certain coding capability and a front-end foundation of a case writer and a certain writing threshold, and the case writing of the automatic case writing image interface class related to the page cannot be easily realized.
To address, at least in part, one or more of the above issues and other potential issues, the present disclosure provides an automated testing solution for B2C financial products that enables automated testing of B2C products with fast access, multi-scenario coverage, and the like.
To facilitate understanding of this embodiment, first, an application testing method disclosed in the embodiments of the present disclosure is described in detail, where an execution subject of the application testing method provided in the embodiments of the present disclosure is generally an electronic device with certain computing capability, and the electronic device includes, for example: a terminal device, which may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a vehicle-mounted device, a wearable device, or the like, or a server or other processing device. In some possible implementations, the application test method may be implemented by a processor calling computer readable instructions stored in a memory.
Referring to fig. 1, a flowchart of an application testing method provided in the embodiment of the present disclosure is shown, where the method includes steps S101 to S103, where:
s101: acquiring an executable file for automatically testing a target application;
s102: setting an application test environment corresponding to the target application by installing the executable file;
s103: under the condition that an application test case is compiled in an application test environment, a test result for a target application is obtained by executing the application test case.
In order to facilitate understanding of the application testing method provided in the embodiment of the present disclosure, first, an application scenario of the method is specifically described below. The Application test method in the embodiment of the present disclosure may be mainly applied to various related fields that need to perform product tests, where the product may be a financial Application program, for example, a B2C product of a union pay system (union pay online payment, mobile web page payment, cashier desk on the union pay online, etc.), and besides, other various products may also be used, where no specific limitation is made, and in consideration of the wide Application of a union pay mobile Wireless communication Protocol (WAP) payment product, the following description is given by taking this product as an example.
The target application may be any product to be tested, for example, a payment-type application program that needs to be released locally, or, for example, an online checkout counter product that needs to be released remotely, and before the product is released, an all-around product test is often needed to better meet the application requirement.
In order to implement the automated testing for the target application, it is first necessary to set up a corresponding application testing environment based on the installation of the executable file. And the application test environments correspondingly set are different when the application is different.
In practical application, the executable file can be released in a private mirror image warehouse as an automation framework, and can be installed through pip under the condition that product testing is required. For example, the executable file is installed by executing "pip install uprunner".
After the installation is successful, the application test environment corresponding to the target application can be set. In addition, under the condition that problems are found through testing, application repairing and updating can be carried out in time, and the use experience of subsequent product release is remarkably improved.
In practical application, a corresponding application test case can be set in combination with a specific service application, for example, in a consumption service of a payment product, a series of processes such as HTTP interface access, form skip, UI operation and the like can be used as specific implementation contents of the application test case, and the test requirements of the consumption service can be well met by executing the processes in order.
The application test case in the embodiment of the disclosure may include a plurality of sub-cases and writing structure contents corresponding to the plurality of sub-cases, and the plurality of sub-cases may be executed based on an operation sequence defined in the writing structure contents for executing the plurality of sub-cases, thereby implementing a comprehensive test for a target application.
The sub-case may be a first sub-case for operating a user interface UI in the target application, a second sub-case for operating an HTTP interface in the target application, a third sub-case for operating a Form in the target application, or other sub-cases.
In practical applications, an application test case may include only one sub-case, for example, only the test for the UI is implemented, and may also include two or more sub-cases, for example, a combination of any one of the above sub-cases, which is not limited herein.
Next, specific implementations of the above three seed cases will be described.
In the first aspect, in the process of testing the UI in the target application, the following steps may be performed:
step one, acquiring a first operation flow matched with a first sub-case;
step two, under the condition of executing the first operation flow, determining whether a target UI element can be positioned or not;
if yes, determining a successful test result aiming at the UI in the target application; and if not, determining a test failure result aiming at the UI in the target application.
Here, for a UI operation, a related first operation flow may be written in an application test case, and a specific writing rule may be implemented based on JSON format. Fig. 2 shows a specific implementation diagram of an automated case of a consumption transaction of a wap payment product of a banking phone, wherein the UI operation step may correspond to the first operation flow, and specifically may include steps of "inputting a banking card number", "clicking a next step", "waiting for 2 seconds" \8230 \ 8230; "inputting a verification code" \8230; "clicking to return to a merchant", and the like.
In the process of actually executing the application test case, the first operation flow is executed, and based on the judgment result of whether the target UI element can be located, the test result for the UI can be determined.
Here, it may be determined whether a preset positioning configuration rule corresponding to the target UI element exists first, and if it is determined that the preset positioning configuration rule corresponding to the target UI element exists within a preset time period, it is determined that the target UI element is positioned; if the preset positioning configuration rule corresponding to the target UI element does not exist within the preset time length, acquiring an HTML source code corresponding to the UI in the target application; whether the target UI element is located is determined by parsing the HTML source code.
Here, the positioning configuration rule for the target UI element may be preset in advance, and the target UI element may be quickly found based on the configuration rule. The target UI element may be a key execution step in executing the UI test process, for example, a UI element for inputting a bank card number, and a UI element for inputting a verification code.
In the embodiment of the disclosure, in the current application test environment, an automated test item including the preset positioning configuration rule may be generated by calling an uphanner command.
In practical application, a scaffold tool can be started by calling an uprunner command, and a UI element folder is created by using the scaffold tool; the UI element folder contains preset positioning configuration rules corresponding to the target UI elements. In the practice of banking multiple B2C product automation, some positioning configuration rules have been built in to satisfy the positioning of common elements.
Fig. 3 is a diagram illustrating an example of invoking the uphanner command to automatically generate an automation test item, where match _ class.json, match _ css _ selector.json, match _ id.json, and match _ xpath.json may correspond to a preset location configuration rule for an element.
However, in practical applications, considering the complexity of various services, a preset positioning configuration position may not be found, and at this time, the HTML source code of the current test product needs to be analyzed to perform automatic element positioning, as shown in fig. 4, if an element is positioned based on a positioning rule within a limited time, the element itself may be returned, and if the element is not positioned within the limited time, an automatic positioning logic is entered, that is, the current HTML source code is analyzed to position an action tag, so as to determine whether a target UI element is finally positioned.
It can be known that, combining the preset positioning configuration rule and the automatic positioning process can further improve the testing performance, and the practicability is better.
In practical application, in addition to element positioning based on a built-in positioning rule, here, a page positioning rule under a UI element folder may be updated or created by combining with attribute characteristics of a product to be tested, and in addition, configuration for an automated test project may be implemented by configuring app _ cfg.yaml, for example, manual configuration may be performed, so as to further improve test performance of subsequent targeted tests for a target application.
In the second aspect, in the process of testing the HTTP interface in the target application, the following steps may be performed:
step one, acquiring a second operation flow matched with a second sub-case;
step two, under the condition of executing a second operation flow, sending the first request message to an HTTP interface;
and step three, determining a test result aiming at the HTTP interface in the target application based on a response result returned by the HTTP interface.
Here, for the HTTP interface operation, a related second operation flow may be written in the application test case, and the specific writing rule may be implemented based on the JSON format. Here, still taking the consumption transaction automation case of the union pay phone wap payment product shown in fig. 2 as an example, the HTTP interface step may correspond to the second operation flow, and specifically may include a step of initiating a request, "a step of returning a signature," and the like.
In the process of actually executing the application test case, the second operation flow is executed, a plug-in function is called in a precondition to simulate a 'new card' scene, namely, the new card is not paid in the Unionpay network, aiming at the HTTP interface class, a message is sent to a tool for processing such as signature according to an interface specification group provided by the Unionpay for a merchant, and the message signed by the tool is extracted.
In a third aspect, in the process of testing for Form forms in a target application, the method can be implemented by the following steps:
step one, acquiring a third operation flow matched with a third sub-case;
step two, under the condition of executing a third operation flow, sending a second request message to a Form skip platform;
and step three, determining a test result aiming at the Form in the target application based on the skip result on the Form skip platform.
Here, for the Form operation, a related third operation flow may be written in an application test case, and a specific writing rule may be implemented based on the JSON format. Still taking the consumption transaction automation case of the union pay phone wap payment product shown in fig. 2 as an example, the Form test may be a step after the interface type test is carried out, a signed message extracted by the interface type test is composed into a Form of HTML and submitted to the unified front of the full channel system, and the front will recognize the transaction according to the received message and then jump to a page for mobile phone wap payment.
After jumping to the payment page, the remaining steps are to simulate the page interaction of the user (corresponding to UI operation), and the last step can call a plug-in method to assert a foreground notification message of the UnionPay to the merchant.
In practical application, in the process of executing an application test case, each sub-case included in the application test case is executed in sequence, and the specific execution can be realized by calling the following commands: jnon, as will be described below.
Where application test case files are typically placed in a test case directory, or other primary directory or root directory of the project, otherwise they may fail because no anchor points are found.
If the test result storage path is configured, the related operation result can be stored in the corresponding directory, the log of case operation is recorded, and if the element positioning fails, screenshot storage can be carried out.
Here, in order to further understand an automated testing framework applying the testing method provided by the embodiment of the present disclosure, a unified description may be provided below with reference to fig. 5 and 6.
As shown in fig. 5, the overall structure diagram of the automated testing framework is simply divided into three blocks, namely basic service, page automation, and interface automation.
1) The basic services are mainly responsible for some basic capabilities of the output framework, such as parameter management (including automated business parameters), plug-in modules (plug-in methods cited in execution cases, such methods are customized in functino.
2) The UI part mainly aims at two modules of page related automation, element positioning and element operation, mainly aims at operation actions of front-end elements, simulates a Form and an HTML rendering module to realize a page for driving Form and HTML rendering initiation, and manages cookies to realize case independence.
3) The interface automation part mainly provides the automation capability of interface steps, such as response extraction and response assertion.
Based on the fact that the automated test cases are complete and independent and are an ordered set of test steps, an automated case structure is defined, as shown in fig. 6, plug-in functions are called in preconditions and can be used for case test preparation (such as test data preparation, environment preparation and the like), and the test steps comprise 4 step types, interface types, form types, UI types, plug-in methods and the like. The post condition is mainly used for data and environmental cleaning.
To sum up, compared with the prior art, the scheme has the advantages that:
1. the method is created based on the technical and business characteristics of the B2C product, and supports the steps of simultaneously including an interface, a page, webview and the like in an automatic case.
2. The framework comprises a scaffold tool, automatic test items are generated by one key, the building from zero is avoided, and the simple configuration can be executed.
3. With the development of the current front-end engineering, the front end forms modularization, and after each component positioning rule is configured, a case writer can write UI steps through natural language, so that the writing threshold is greatly reduced, and the case readability is improved.
4. The framework has definite definition aiming at the automation case, is written in a JSON form, simultaneously encapsulates a case execution module, provides corresponding cmd, and an access person can quickly write the case and execute a test task.
5. The framework is better integrated with the devops because it provides command lines to perform test tasks.
6. The framework provides a hooks mechanism, plug-in writing can be completed in a customized mode, and personalized requirements are supplemented.
In the description of the present specification, reference to a description of the term "some possible embodiments," "some embodiments," "examples," "specific examples," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the various embodiments or examples and features of the various embodiments or examples described in this specification can be combined and combined by those skilled in the art without contradiction.
With regard to the method flow diagrams of the disclosed embodiments, certain operations are described as different steps performed in a certain order. Such flow diagrams are illustrative and not restrictive. Certain steps described herein may be grouped together and performed in a single operation, certain steps may be separated into sub-steps, and certain steps may be performed in an order different than presented herein. The various steps shown in the flowcharts may be implemented in any way by any circuit structure and/or tangible mechanism (e.g., by software running on a computer device, hardware (e.g., logical functions implemented by a processor or chip), etc., and/or any combination thereof).
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, an application testing device corresponding to the application testing method is also provided in the embodiments of the present disclosure, and as the principle of solving the problem of the device in the embodiments of the present disclosure is similar to the application testing method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 7, a schematic diagram of an application testing apparatus provided in an embodiment of the present disclosure is shown, where the apparatus includes: an acquisition module 701, a setting module 702 and a test module 703; wherein,
an obtaining module 701, configured to obtain an executable file for performing an automated test on a target application;
a setting module 702, configured to set an application test environment corresponding to a target application by installing an executable file;
the testing module 703 is configured to obtain a testing result for the target application by executing the application test case when the application test case is written in the application testing environment.
By adopting the application testing device, under the condition that the executable file for automatically testing the target application is obtained, the application testing environment corresponding to the target application is set by installing the executable file, so that under the condition that the application testing case is compiled under the application testing environment, the testing result aiming at the target application can be obtained by executing the application testing case. The application test case is compiled under the application test environment corresponding to the target application, the test requirement of the target application is better met, automatic application test can be performed through automatic execution of the application test case, and the test efficiency is higher.
In a possible implementation manner, in the case that the application test case includes a first sub-case for operating on the user interface UI in the target application, the testing module 703 is configured to obtain a test result for the target application by executing the application test case according to the following steps:
acquiring a first operation flow matched with the first sub-case;
determining whether the target UI element can be located or not under the condition that the first operation flow is executed;
if so, determining a successful test result aiming at the UI in the target application;
and if not, determining a test failure result aiming at the UI in the target application.
In one possible implementation, the testing module 703 is configured to determine whether the target UI element can be located according to the following steps:
judging whether a preset positioning configuration rule corresponding to the target UI element exists or not to obtain a judgment result;
and determining whether the target UI element is positioned or not based on the judgment result.
In a possible implementation, the testing module 703 is configured to determine whether the target UI element is located based on the determination result according to the following steps:
determining to locate the target UI element under the condition that a preset locating configuration rule corresponding to the target UI element is judged to exist within a preset time length; or,
judging that no preset positioning configuration rule corresponding to the target UI element exists within preset time length, and acquiring an HTML source code corresponding to a UI in the target application; whether the target UI element is located is determined by parsing the HTML source code.
In one possible implementation, the testing module 703 is configured to determine whether the target UI element is located by parsing the HTML source code according to the following steps:
analyzing the HTML source code, and determining whether an action tag corresponding to the target UI element exists;
in the event that it is determined that an action tag exists, it is determined to locate the target UI element.
In a possible embodiment, the testing module 703 is configured to determine the preset positioning configuration rule according to the following steps:
under the application test environment, generating an automatic test item by calling an uprunner command; the automatic test items comprise preset positioning configuration rules corresponding to the target UI elements.
In one possible embodiment, the test module 703 is used to generate an automated test item by invoking the uprunner command as follows:
calling an uprunner command and starting a scaffold tool;
creating a UI element folder by using a scaffold tool; the UI element folder contains preset positioning configuration rules corresponding to the target UI elements.
In a possible implementation, the testing module 703 is further configured to:
acquiring attribute information of a target application;
and updating the preset positioning configuration rule based on the attribute information, or re-establishing the positioning configuration rule aiming at other UI elements.
In a possible embodiment, in the case that the application test case includes a second sub-case operating on an HTTP interface in the target application, the testing module 703 is configured to obtain a testing result for the target application by executing the application test case according to the following steps:
acquiring a second operation flow matched with the second sub-case;
under the condition of executing the second operation flow, sending the first request message to an HTTP interface;
and determining a test result aiming at the HTTP interface in the target application based on the response result returned by the HTTP interface.
In a possible embodiment, in the case that the application test case includes a third sub-case for performing an operation on a Form in the target application, the testing module 703 is configured to obtain a testing result for the target application by executing the application test case according to the following steps:
acquiring a third operation flow matched with the third sub-case;
under the condition of executing a third operation flow, sending a second request message to a Form skip platform;
and determining a test result aiming at the Form in the target application based on the jump result on the Form jump platform.
In a possible embodiment, in the case that the application test case includes a plurality of sub-cases operating on elements in the target application, the testing module 703 is configured to obtain a test result for the target application by executing the application test case according to the following steps:
obtaining writing structure contents corresponding to a plurality of sub-cases; the writing structure content defines the operation sequence for executing a plurality of sub-cases;
and executing the plurality of sub-cases according to the operation sequence to obtain a test result aiming at the target application.
It should be noted that the apparatus in the embodiment of the present disclosure may implement each process of the embodiment of the foregoing method, and achieve the same effect and function, which are not described herein again.
An embodiment of the present disclosure further provides an electronic device, as shown in fig. 8, which is a schematic structural diagram of the electronic device provided in the embodiment of the present disclosure, and includes: a processor 801, a memory 802, and a bus 803. The memory 802 stores machine-readable instructions executable by the processor 801 (for example, execution instructions corresponding to the obtaining module 701, the setting module 702, and the testing module 703 in the apparatus in fig. 7, and the like), when the electronic device is operated, the processor 801 communicates with the memory 802 through the bus 803, and when the machine-readable instructions are executed by the processor 801, the following processes are performed:
acquiring an executable file for carrying out automatic testing on a target application;
setting an application test environment corresponding to the target application by installing the executable file;
under the condition that an application test case is compiled in an application test environment, a test result aiming at a target application is obtained by executing the application test case.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the application testing method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
An embodiment of the present disclosure further provides a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the application test method in the foregoing method embodiment, which may be specifically referred to in the foregoing method embodiment and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK) or the like.
The embodiments in the disclosure are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for apparatus, device, and computer-readable storage medium embodiments, the description of which is simplified since it is substantially similar to the method embodiments, and where relevant, reference may be made to some descriptions of the method embodiments.
The apparatus, the device, and the computer-readable storage medium provided in the embodiments of the present disclosure correspond to the method one to one, and therefore, the apparatus, the device, and the computer-readable storage medium also have similar advantageous technical effects to the corresponding method.
As will be appreciated by one of skill in the art, embodiments of the present disclosure may be provided as a method, apparatus (device or system), or computer-readable storage medium. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer-readable storage medium embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices or systems), and computer-readable storage media according to embodiments of the disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Further, while the operations of the disclosed methods are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the present disclosure have been described with reference to several particular embodiments, it is to be understood that the present disclosure is not limited to the particular embodiments disclosed, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims (14)
1. An application testing method, comprising:
acquiring an executable file for carrying out automatic testing on a target application;
setting an application test environment corresponding to the target application by installing the executable file;
and under the condition that an application test case is compiled in the application test environment, obtaining a test result aiming at the target application by executing the application test case.
2. The method according to claim 1, wherein in a case that the application test case includes a first sub-case for operating on the user interface UI in the target application, the obtaining of the test result for the target application by executing the application test case includes:
acquiring a first operation flow matched with the first sub-case;
determining whether a target UI element can be located while the first operation flow is executed;
if so, determining a successful test result aiming at the UI in the target application;
and if not, determining a test failure result aiming at the UI in the target application.
3. The method of claim 2, wherein the determining whether the target UI element can be located comprises:
judging whether a preset positioning configuration rule corresponding to the target UI element exists or not to obtain a judgment result;
and determining whether the target UI element is positioned or not based on the judgment result.
4. The method of claim 3, wherein the determining whether to locate the target UI element based on the determination comprises:
determining to position the target UI element under the condition that a preset positioning configuration rule corresponding to the target UI element is judged to exist within a preset time length; or,
judging that no preset positioning configuration rule corresponding to a target UI element exists within preset time length, and acquiring an HTML source code corresponding to a UI in the target application; and determining whether the target UI element is positioned or not by analyzing the HTML source codes.
5. The method of claim 4, wherein determining whether to locate the target UI element by parsing the HTML source code comprises:
analyzing the HTML source code, and determining whether an action tag corresponding to the target UI element exists;
in an instance in which it is determined that an action tag exists, it is determined to locate the target UI element.
6. The method according to any of claims 3 to 5, wherein the preset positioning configuration rule is determined according to the following steps:
under the application test environment, generating an automatic test item by calling an uprunner command; the automatic test items comprise preset positioning configuration rules corresponding to the target UI elements.
7. The method of claim 6, wherein generating the automated test items by invoking an uprunner command comprises:
calling an uprunner command and starting a scaffold tool;
creating a UI element folder using the scaffold tool; the UI element folder comprises preset positioning configuration rules corresponding to the target UI elements.
8. The method of claim 6, further comprising:
acquiring attribute information of the target application;
and updating the preset positioning configuration rule based on the attribute information, or reestablishing the positioning configuration rule aiming at other UI elements.
9. The method as claimed in claim 1, wherein in a case that the application test case includes a second sub-case operating on an HTTP interface in the target application, the obtaining a test result for the target application by executing the application test case includes:
acquiring a second operation flow matched with the second sub-case;
under the condition of executing the second operation flow, sending a first request message to the HTTP interface;
and determining a test result aiming at the HTTP interface in the target application based on the response result returned by the HTTP interface.
10. The method of claim 1, wherein in a case that the application test case contains a third sub-case for operating on a Form in the target application, the obtaining of the test result for the target application by executing the application test case comprises:
acquiring a third operation flow matched with the third sub-case;
under the condition of executing the third operation flow, sending a second request message to a Form jump platform;
and determining a test result aiming at the Form in the target application based on the skip result on the Form skip platform.
11. The method according to claim 1, wherein in a case that the application test case includes a plurality of sub-cases for performing operations on elements in the target application, the obtaining of the test result for the target application by executing the application test case includes:
obtaining writing structure contents corresponding to the plurality of sub-cases; the writing structure content defines the operation sequence for executing the plurality of sub-cases;
and executing the plurality of sub-cases according to the operation sequence to obtain a test result aiming at the target application.
12. An application testing apparatus, comprising:
the system comprises an acquisition module, a test module and a control module, wherein the acquisition module is used for acquiring an executable file for automatically testing a target application;
the setting module is used for setting an application test environment corresponding to the target application by installing the executable file;
and the testing module is used for obtaining a testing result aiming at the target application by executing the application testing case under the condition that the application testing case is compiled in the application testing environment.
13. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the application testing method of any of claims 1 to 11.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the application testing method of any one of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211719144.3A CN115905020A (en) | 2022-12-30 | 2022-12-30 | Application testing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211719144.3A CN115905020A (en) | 2022-12-30 | 2022-12-30 | Application testing method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115905020A true CN115905020A (en) | 2023-04-04 |
Family
ID=86471151
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211719144.3A Pending CN115905020A (en) | 2022-12-30 | 2022-12-30 | Application testing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115905020A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118113623A (en) * | 2024-04-29 | 2024-05-31 | 之江实验室 | Automatic interface testing method and device, storage medium and electronic equipment |
-
2022
- 2022-12-30 CN CN202211719144.3A patent/CN115905020A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118113623A (en) * | 2024-04-29 | 2024-05-31 | 之江实验室 | Automatic interface testing method and device, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109325195B (en) | Rendering method and system for browser, computer device and computer storage medium | |
US9846638B2 (en) | Exposing method related data calls during testing in an event driven, multichannel architecture | |
CN109656807B (en) | Information security-based interface mock testing method, device, equipment and storage medium | |
US9170921B2 (en) | Application testing automation | |
CN106648556B (en) | Method and device for front-end and back-end integrated development test | |
US10951486B2 (en) | Terminal device, UI expansion method, and UI expansion program | |
CN110806868A (en) | Single-page building and loading method | |
CN113704110A (en) | Automatic testing method and device for user interface | |
CN115905020A (en) | Application testing method and device, electronic equipment and storage medium | |
CN111897738A (en) | Automatic testing method and device based on atomic service | |
CN115841236A (en) | Business modeling method, device and medium for realizing quick response | |
US20150234732A1 (en) | Executable software specification generation | |
CN113296740A (en) | Service object processing method, device, equipment and machine readable medium | |
CN103838575A (en) | Plug-in type page customization implementation method based on EXTJS frame | |
CN110471828B (en) | Operating system testing method, device and equipment thereof | |
CN114936152A (en) | Application testing method and device | |
CN114741294A (en) | Page debugging method, device, equipment and storage medium | |
CN114637672A (en) | Automatic data testing method and device, computer equipment and storage medium | |
CN112181407B (en) | Service realization processing method, device, system, electronic equipment and storage medium | |
CN112540747A (en) | Platform development method, device and computer readable storage medium | |
CN115480771A (en) | Method for deploying algorithms and related device | |
US11816022B2 (en) | Snapshot simulation of service module responses | |
CN112596781A (en) | Service execution and service configuration method and device | |
JP2015148925A (en) | Program generation device and method | |
CN115543323B (en) | Page development method and device |
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 |