CN113220595B - Test method and test equipment - Google Patents

Test method and test equipment Download PDF

Info

Publication number
CN113220595B
CN113220595B CN202110657379.3A CN202110657379A CN113220595B CN 113220595 B CN113220595 B CN 113220595B CN 202110657379 A CN202110657379 A CN 202110657379A CN 113220595 B CN113220595 B CN 113220595B
Authority
CN
China
Prior art keywords
test
test case
output data
tested
case
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110657379.3A
Other languages
Chinese (zh)
Other versions
CN113220595A (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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202110657379.3A priority Critical patent/CN113220595B/en
Publication of CN113220595A publication Critical patent/CN113220595A/en
Application granted granted Critical
Publication of CN113220595B publication Critical patent/CN113220595B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • 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

Abstract

The application provides a test method and test equipment, wherein the test method comprises the following steps: receiving a test instruction, wherein the test instruction comprises an identifier to be tested; searching a test case library according to the identification to be tested to obtain the first test case; obtaining input data of the first test case according to the input data label of the first test case; based on the test script of the first test case and the input data of the first test case, executing a test to obtain the output data of the first test case, and obtaining a test result according to the output data. In the scheme, the input data of the interface to be tested can be directly obtained from the database, the interface to be tested is tested, the input data of the interface to be tested is not required to be obtained in a mode of testing the upstream interface, and the testing efficiency is effectively improved.

Description

Test method and test equipment
Technical Field
The application relates to the technical field of automatic testing, in particular to a testing method and testing equipment.
Background
API (Application Programming Interface, application program interface) testing is a test for testing interfaces between components of a system, and is mainly used for testing interfaces between the system and other systems outside and interfaces between various sub-modules inside the system. The interface test is used for verifying the consistency of the function and performance index realized by the interface and the interface document, and simultaneously testing whether the interface can return error codes when abnormal input data is received, so as to shield error information. Generally, after updating the code of an interface, a tester needs to perform a functional test on the updated interface.
When testing interfaces, because some interfaces have a dependency relationship, when testing one of the interfaces, output data of an upstream interface is often required to be acquired, for example, for an interface to be tested, the interface has an upstream interface, and the interface is generally required to be tested according to the output data of the upstream interface of the interface. Therefore, the upstream interface needs to be tested to obtain output data of the upstream interface, so that the interface to be tested is used in testing.
In the above scheme, when the interface to be tested is tested, the upstream interface of the interface to be tested is required to be tested, so that the testing efficiency is low.
Disclosure of Invention
The embodiment of the application provides a testing method and testing equipment, which are used for solving the technical problem of lower testing efficiency when an interface to be tested is tested.
In a first aspect, the present application provides a test method comprising: receiving a test instruction, wherein the test instruction comprises an identifier to be tested; searching a test case library according to the identifier to be tested to obtain the first test case, wherein the test case library comprises a plurality of test cases, and the test cases comprise input data tags, test scripts and output data tags; the input data tag comprises an identifier of a front test case of the test case and a key field extracted from output data of the front test case of the test case, and the output data tag comprises a key field extracted from the output data of the test case and an identifier of the test case; the identification in the output data label of the first test case is consistent with the identification to be tested; obtaining input data of the first test case according to the input data label of the first test case; based on the test script of the first test case and the input data of the first test case, executing a test to obtain the output data of the first test case, and obtaining a test result according to the output data.
Optionally, the method as described above, the method further comprises: sorting API (application program interface) test cases, wherein the API test cases comprise test cases of tested test scripts; analyzing and obtaining a front test script of the tested test script, output data of the front test script of the tested test script and output data of the tested test script according to the API test case; based on the front test script of the tested test script, obtaining an input data tag of a second test case corresponding to the tested test script, wherein the input data tag of the second test case comprises an identifier of the test case corresponding to the front test script of the tested test script and a key field extracted from output data of the front test script of the tested test script; extracting key fields from the output data of the tested test script, using the extracted key fields as key fields in an output data label of a second test case, and distributing unique identifiers for the second test case, and using the unique identifiers as identifiers in the output data label of the second test case so as to complete the establishment of the second test case.
Optionally, the method as described above, after the sorting of the API test cases, further includes: if the tested test script does not have the associated pre-test script, extracting a key field from the output data of the tested test script, and distributing a unique identifier for the third test case; establishing a third test case corresponding to the tested test script, wherein the third test case comprises the tested test script and an output data tag; wherein the output data tag of the third test case includes key fields refined from the output data of the tested test script, and a unique identifier assigned to the third test case.
Optionally, in the method as described above, the obtaining, according to the first input data tag, input data of the first test case includes: according to the input data label of the first test case, determining the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case; searching a database according to the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case, and obtaining the output data of the front test case of the first test case as the input data of the first test case; the database is used for storing output data of each test case, and the output data of the front test case of the first test case comprises the key field.
Optionally, the method as described above, the method further comprises: and if the first test case does not comprise the input data tag, acquiring the input data of the first test case according to a preset rule.
Optionally, the method as described above, the method further comprises: extracting key fields from the output data of the first test case; and storing the extracted key fields as key fields in output data labels of the first test cases.
In a second aspect, an embodiment of the present application provides a test apparatus, including: the receiving module is used for receiving a test instruction, wherein the test instruction comprises a mark to be tested; the searching module is used for searching a test case library according to the identifier to be detected to obtain the first test case, wherein the test case library comprises a plurality of test cases, and the test cases comprise input data tags, test scripts and output data tags; the input data tag comprises an identifier of a front test case of the test case and a key field extracted from output data of the front test case of the test case, and the output data tag comprises a key field extracted from the output data of the test case and an identifier of the test case; the identification in the output data label of the first test case is consistent with the identification to be tested; the acquisition module is used for acquiring the input data of the first test case according to the input data tag of the first test case; the testing module is used for executing testing based on the testing script of the first testing case and the input data of the first testing case, obtaining the output data of the first testing case and obtaining a testing result according to the output data.
In a third aspect, an embodiment of the present application provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the test method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, are configured to implement the test method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the test method according to the first aspect.
According to the testing method and the testing equipment, the first testing case is obtained through receiving the testing instruction and searching according to the to-be-tested identification in the testing instruction, and testing is performed based on the testing script of the first testing case and the input data of the first testing case so as to obtain a testing result. In the scheme, the input data of the interface to be tested can be directly obtained from the database, the interface to be tested is tested, the input data of the interface to be tested is not required to be obtained in a mode of testing the upstream interface, and the testing efficiency is effectively improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flow chart of a testing method according to a first embodiment of the present application;
FIG. 2 is a flow chart of a testing method according to a second embodiment of the present application;
FIG. 3 is a flow chart of a testing method according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a test apparatus according to a fourth embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
First, the terms involved in the present application will be explained:
API: application Programming Interface Chinese is named as application program interface, which is some predefined interfaces (such as function and HTTP interface) or the engagement of different components of software system. To provide a set of routines that applications and developers can access based on certain software or hardware without having to access source code or understand the details of the internal operating mechanisms.
API (Application Programming Interface, application program interface) testing is a test for testing interfaces between components of a system, and is mainly used for testing interfaces between the system and other systems outside and interfaces between various sub-modules inside the system. The interface test is used for verifying the consistency of the function and performance index realized by the interface and the interface document, and simultaneously testing whether the interface can return error codes when abnormal input data is received, so as to shield error information. Generally, after updating the code of an interface, a tester needs to perform a functional test on the updated interface.
At present, the update speed of the interface code is increased, so that the workload of testing is greatly increased. When the interface code is updated each time, the core part of the code is not changed, so most of the work when the core part is tested is repeated, and the efficiency of the test work is reduced. Therefore, those skilled in the art have developed software testing tools to implement software automated testing, which makes the testing work efficient and reliable.
However, in practical applications, some interfaces are interrelated, and test cases corresponding to the interfaces are also interrelated, i.e. have a dependency relationship. Then for this case, it is generally necessary to acquire the test results of the upstream interface of the interface to be tested for automated testing. For example, for the order-pay-refund inquiry this coupling chain, the refund inquiry interface depends on its upstream interface (pre-dependency), i.e. refund interface, and the refund interface depends on its upstream interface, i.e. payment interface, which in turn depends on its upstream interface, i.e. order interface. In one example, when testing the refund interface, the data output by the test script in the test case corresponding to the upstream interface (payment interface) is required to be acquired, and the input data of the test script of the test case corresponding to the refund interface is determined according to the output data, so as to complete the test of the refund interface.
In the above scheme, when the interface to be tested is tested, the upstream interface of the interface to be tested is required to be tested, so that the testing efficiency is low.
The application provides a testing method and testing equipment, and aims to solve the technical problems in the prior art.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Example 1
Fig. 1 is a flow chart of a testing method according to an embodiment of the application. As shown in fig. 1, the method includes:
s101, receiving a test instruction, wherein the test instruction comprises an identifier to be tested.
The test instruction is used for indicating the test equipment to start testing. The sending of the test instruction may include various manners, for example, the test instruction may be sent by a control device of the test device, specifically, the control device of the test device monitors an update state of the interface code, if it is detected that the interface code is updated, it is determined that the interface test may be performed, and then the test instruction is sent to the test device; or, the interface test device can also send a test instruction to the test equipment through the operation of a tester when the interface test is required.
In practical application, the test equipment receives a test instruction to start test work.
S102, searching a test case library according to the identifier to be tested to obtain the first test case, wherein the test case library comprises a plurality of test cases, and the test cases comprise input data tags, test scripts and output data tags; the input data tag comprises an identifier of a front test case of the test case and a key field extracted from output data of the front test case of the test case, and the output data tag comprises a key field extracted from the output data of the test case and an identifier of the test case; the identification in the output data label of the first test case is consistent with the identification to be tested.
The to-be-tested identifier is used for searching the test case corresponding to the to-be-tested interface. The test case library is pre-established for the testers.
For example, in combination with an actual application scenario, the test equipment acquires the identifier to be tested in the received test instruction, compares the identifier to be tested with identifiers carried by test cases in the test case library one by one until a test case with the identifier consistent with the identifier to be tested is found out, and takes the test case as a first test case.
S103, obtaining the input data of the first test case according to the input data label of the first test case.
In practical application, the database can be searched according to the input data label of the first test case, so as to obtain the input data of the first test case. Specifically, in one example, according to an input data tag of the first test case, an identifier of a front test case of the first test case and a key field corresponding to output data of the front test case of the first test case are determined; searching a database according to the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case, and obtaining the output data of the front test case of the first test case as the input data of the first test case; the database is used for storing output data of each test case, and the output data of the front test case of the first test case comprises the key field. In this embodiment, the identifier of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case are obtained from the input data tag of the first test case, and the database is searched according to the identifier and the key field, so that the input data of the first test case is obtained, and the input data of the first test case can be quickly and accurately obtained, thereby improving the test efficiency.
S104, based on the test script of the first test case and the input data of the first test case, executing a test to obtain the output data of the first test case, and obtaining a test result according to the output data.
Each interface corresponds to a test case, each test case corresponds to a test script, and the test script is used for executing the test.
In one example, after the first test case is determined in S102, a test script of the first test case may be obtained from the first test case, then, according to the input data of the first test case obtained in S103, a test is performed to obtain output data of the first test case, and finally, the output data is compared with standard output data to obtain a test result, and output is performed. The standard data refers to correct data which should be output by the first test case.
In an embodiment, on the basis of the foregoing solution, output data of the first test case may be further stored, and specifically, the method further includes: extracting key fields from the output data of the first test case; and storing the extracted key fields as key fields in output data labels of the first test cases. In this embodiment, the key field is extracted from the output data of the first test case and is stored as the key field in the output data tag of the first test case, so that the key field can be conveniently used in the subsequent test of the interface.
In this embodiment, a first test case is obtained by receiving a test instruction and searching according to a to-be-tested identifier in the test instruction, and a test is executed based on a test script of the first test case and input data of the first test case, so as to obtain a test result. In the scheme, the input data of the interface to be tested can be directly obtained from the database, the interface to be tested is tested, the input data of the interface to be tested is not required to be obtained in a mode of testing the upstream interface, and the testing efficiency is effectively improved.
It should be noted that, before the test in the first embodiment, the method further includes a process of creating a test case library, which is described below in connection with a specific embodiment.
Example two
Fig. 2 is a flow chart of a testing method according to a second embodiment of the present application, as shown in fig. 2, where on the basis of the first embodiment, the method further includes:
s201, arranging API (application program interface) test cases, wherein the API test cases comprise test cases of tested test scripts.
S202, analyzing and obtaining the front test script of the tested test script, the output data of the front test script of the tested test script and the output data of the tested test script according to the API test case.
S203, based on the front test script of the tested test script, obtaining an input data tag of a second test case corresponding to the tested test script, wherein the input data tag of the second test case comprises an identifier of the test case corresponding to the front test script of the tested test script and a key field extracted from output data of the front test script of the tested test script.
S204, extracting key fields from the output data of the tested test script, using the extracted key fields as key fields in an output data label of a second test case, and allocating unique identifiers for the second test case, and using the unique identifiers as identifiers in the output data label of the second test case so as to complete establishment of the second test case.
Wherein each interface corresponds to a test case, and each test case corresponds to a test script.
In one example, the coupling chain is for order-payment-refund inquiry, order interface is the pre-dependency of the payment interface, payment interface is the pre-dependency of the refund interface, and so on. Taking refund interface as an example, because of the existence of the dependency relationship, when testing it, the front-end dependency of the payment interface needs to be obtained, namely the result of testing the payment interface, and the payment interface needs to be tested again, namely the test result of the order interface, so, based on the method provided by the prior art, in order to test the refund interface, the order interface, the payment interface and the test of the refund interface need to be sequentially executed for one time, so as to obtain the tested API test case. After the refund interface is tested, the front test script of the tested test script corresponding to the refund interface can be determined to be the tested test script corresponding to the payment interface, and the output data of the payment interface and the output data of the refund interface can be obtained. And then, obtaining the identification of the test case corresponding to the payment interface and the key field of the output data from the output data of the payment interface, and putting the identification and the key field into the input data tag of the test case corresponding to the refund interface to obtain the input data tag of the test case. And extracting key fields of the output data from the output data of the refund interface, putting the key fields into output data labels of the test cases corresponding to the refund interface, distributing unique identifiers for the test cases, and putting the unique identifiers into the output data labels of the test cases, so as to complete the establishment of the test cases corresponding to the refund interface.
The output data of the interface is the output data of the test script corresponding to the interface; the unique identifier may be a transaction code, or may be other identifiers, which is not limited in this embodiment; the key field may be an order number, or may be other fields, which is not limited in the present application.
Before the coupling chain is obtained in the above embodiment, in one embodiment, the dependency relationship between the interfaces is first obtained from the interface document, and the sequence of the interfaces in the coupling chain is determined according to the dependency relationship.
In this embodiment, by pre-establishing the second test case, the input data may be directly obtained from the data bank to execute the test when the test is performed subsequently; and obtaining output data to verify whether the output data obtained through the test is correct or not, and further obtaining a test result.
In another embodiment, on the basis of the above embodiment, there may be cases where there is no associated pre-test script, specifically, for these cases, after the sorting of the API test cases, further includes: if the tested test script does not have the associated pre-test script, extracting a key field from the output data of the tested test script, and distributing a unique identifier for the third test case; establishing a third test case corresponding to the tested test script, wherein the third test case comprises the tested test script and an output data tag; wherein the output data tag of the third test case includes key fields refined from the output data of the tested test script, and a unique identifier assigned to the third test case.
Still referring to the above example, in one example, for the coupling chain of order-payment-refund inquiry, taking the order interface as an example, if there is no associated pre-test script in the tested test script corresponding to the order interface, extracting a key field from the output data of the order interface, allocating a unique identifier to the test case corresponding to the order interface, and placing the key field and the unique identifier into the output data tag of the test case to complete the establishment of the test case corresponding to the order interface.
In this embodiment, by configuring the output data tag for the interface where the upstream interface does not exist, it is possible to easily take the required data from the output data tag when the test is performed later.
In one embodiment, on the basis of the foregoing embodiment, the method further includes: and if the first test case does not comprise the input data tag, acquiring the input data of the first test case according to a preset rule.
In one example, if the first test case does not include an input data tag, random data may be generated using a random function or static data may be read from a static library to obtain input data. In this embodiment, when the test case does not include the input data tag, the input data may be obtained by other means, so that smooth performance of the test may be ensured.
In this embodiment, by pre-establishing the second test case, the input data can be directly obtained from the data bank to execute the test when the test is performed subsequently; and obtaining output data to verify whether the output data obtained through the test is correct or not, and further obtaining a test result.
The foregoing embodiments may be implemented alone or in combination, and examples of the combination will be given below as a specific example.
Example III
Fig. 3 is a flow chart of a test method according to a third embodiment of the present application. As shown in fig. 3, the method includes:
s1, preparing a test case.
S2, analyzing the dependence among test cases.
S3, analyzing the test case data labels.
S4, configuring a test case.
The data tag comprises an input data tag and an output data tag.
For S1-S4, in one example, for the order-payment-refund inquiry, taking the refund interface as an example, because of the existence of the dependency relationship, when testing it, the result of the payment interface test needs to be obtained, and the payment interface test needs to be performed again, so, based on the method provided by the prior art, in order to test the refund interface, the order interface, the payment interface, and the test of the refund interface need to be sequentially performed once. After the test is executed, the output data of each interface can be obtained. Aiming at the payment interface, after obtaining output data of the payment interface, extracting key fields from the output data, and distributing unique identifiers for test cases corresponding to the payment interface, so as to obtain output data labels of the test cases corresponding to the payment interface; the refund interface determines the input data label of the test case corresponding to the refund interface according to the output data label of the test case corresponding to the payment interface, and imports the input data label into the XML configuration file to complete the configuration of the test case.
S5, running the test case.
S6, judging whether the test case needs a pre-case or not.
Before testing, in this step, it is also necessary whether the case to be tested has a pre-case. If not, executing S7; if so, S9 is performed.
S7, generating a data tag.
S8, storing the data into a data bank (database).
Wherein, the data tag refers to an output data tag.
For S7-S8, before generating the data label, acquiring input data by means of random generation or number acquisition from a static library, sending a request message carrying the input data to a system for testing, then receiving a message returned by the system after the testing is finished, and comparing output data in the message with standard output data to obtain a test result. Extracting key fields from the output data in the returned message, and distributing unique identifiers for the test cases in the test to obtain output data labels of the test cases, and storing the data labels in a data bank for use in subsequent test. The standard data refers to correct data which should be output by the first test case.
S9, judging whether the data bank has a front case data label or not.
Wherein the pre-case data tag refers to an output data tag of the pre-case.
In the step, if the pre-case exists in the case to be tested, further judging whether the output data tag of the pre-case exists in the data bank, and if not, executing S10; if so, S13 is performed.
S10, running the front-end cases.
S11, generating a data tag.
S12, storing the data into a data bank.
For S10-S12, a process of outputting a data tag for acquiring a pre-case. Specifically, a test for the pre-case is performed: and sending the request message to the system for testing, then receiving the message returned by the system after the testing is finished, and comparing the output data in the message with the standard output data to obtain a test result. Extracting key fields from the output data in the returned message, and distributing unique identification for the pre-case to obtain an output data tag of the pre-case, and storing the data tag into a data bank for use in subsequent testing.
S13, reading the front case data label.
S14, completing the current test case.
S15, generating a data tag.
S16, storing the data into a data bank.
Wherein the pre-case data label refers to a pre-case output data label.
For S13-S16, a test procedure is performed for the case where the pre-case output data tag is stored in the data bank. Specifically, reading the output data tag of the front case to determine the input data of the case to be tested, sending the request message to the system for testing, receiving the message returned by the system after the testing is finished, and comparing the output data in the message with the standard output data to obtain the test result. Extracting key fields from the output data in the returned message, and distributing unique identification for the pre-case to obtain an output data tag of the pre-case, and storing the data tag into a data bank for use in subsequent testing.
Example IV
Fig. 4 is a schematic structural diagram of a test apparatus according to a fourth embodiment of the present application, as shown in fig. 4, where the test apparatus according to the present embodiment includes: the device comprises a receiving module 41, a searching module 42, an obtaining module 43 and a testing module 44.
The receiving module 41 is configured to receive a test instruction, where the test instruction includes an identifier to be tested. The searching module 42 is configured to search a test case library according to the identifier to be tested, to obtain the first test case, where the test case library includes a plurality of test cases, and the test cases include an input data tag, a test script, and an output data tag; the input data tag comprises an identifier of a front test case of the test case and a key field extracted from output data of the front test case of the test case, and the output data tag comprises a key field extracted from the output data of the test case and an identifier of the test case; the identification in the output data label of the first test case is consistent with the identification to be tested. And the obtaining module 43 is configured to obtain the input data of the first test case according to the input data tag of the first test case. The test module 44 is configured to perform a test based on the test script of the first test case and the input data of the first test case, obtain output data of the first test case, and obtain a test result according to the output data.
Optionally, the test apparatus further comprises: the system comprises a building module, wherein the building module is specifically used for: sorting API (application program interface) test cases, wherein the API test cases comprise test cases of tested test scripts; analyzing and obtaining a front test script of the tested test script, output data of the front test script of the tested test script and output data of the tested test script according to the API test case; based on the front test script of the tested test script, obtaining an input data tag of a second test case corresponding to the tested test script, wherein the input data tag of the second test case comprises an identifier of the test case corresponding to the front test script of the tested test script and a key field extracted from output data of the front test script of the tested test script; extracting key fields from the output data of the tested test script, using the extracted key fields as key fields in an output data label of a second test case, and distributing unique identifiers for the second test case, and using the unique identifiers as identifiers in the output data label of the second test case so as to complete the establishment of the second test case.
Optionally, the establishing module is further specifically configured to: if the tested test script does not have the associated pre-test script, extracting a key field from the output data of the tested test script, and distributing a unique identifier for the third test case; establishing a third test case corresponding to the tested test script, wherein the third test case comprises the tested test script and an output data tag; wherein the output data tag of the third test case includes key fields refined from the output data of the tested test script, and a unique identifier assigned to the third test case.
Optionally, the obtaining module 43 is specifically configured to: according to the input data label of the first test case, determining the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case; searching a database according to the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case, and obtaining the output data of the front test case of the first test case as the input data of the first test case; the database is used for storing output data of each test case, and the output data of the front test case of the first test case comprises the key field.
Optionally, the obtaining module 43 is further specifically configured to: and if the first test case does not comprise the input data tag, acquiring the input data of the first test case according to a preset rule.
Optionally, the test apparatus further comprises: the storage module is specifically used for: extracting key fields from the output data of the first test case; and storing the extracted key fields as key fields in output data labels of the first test cases.
The test device provided in this embodiment may execute the technical solution of the foregoing method embodiment, and its implementation principle and technical effects are similar, and are not described herein again.
Example five
Fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present application. As shown in fig. 5, the electronic device includes: a memory 51 and a processor 52.
The memory 51 is configured to store processor-executable instructions. The memory 51 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The memory 51 and the processor 52 are interconnected by a circuit. In particular, the various components are interconnected using a bus, and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device.
Example six
A sixth embodiment of the present application provides a computer-readable storage medium.
The instructions in the storage medium, when executed by the processor, enable the electronic device to perform the test method described above.
Example seven
A seventh embodiment of the present application provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the above-described test method.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (6)

1. A method of testing, comprising:
receiving a test instruction, wherein the test instruction comprises an identifier to be tested;
searching a test case library according to the identification to be tested to obtain a first test case, wherein the test case library comprises a plurality of test cases, and the test cases comprise input data tags, test scripts and output data tags; the input data tag comprises an identifier of a front test case of the test case and a key field extracted from output data of the front test case of the test case, and the output data tag comprises a key field extracted from the output data of the test case and an identifier of the test case; the identification in the output data label of the first test case is consistent with the identification to be tested;
obtaining input data of the first test case according to the input data label of the first test case;
Based on the test script of the first test case and the input data of the first test case, executing a test to obtain the output data of the first test case, and obtaining a test result according to the output data;
arranging API test cases, wherein the API test cases comprise test cases of tested test scripts;
analyzing and obtaining a front test script of the tested test script, output data of the front test script of the tested test script and output data of the tested test script according to the API test case;
based on the front test script of the tested test script, obtaining an input data tag of a second test case corresponding to the tested test script, wherein the input data tag of the second test case comprises an identifier of the test case corresponding to the front test script of the tested test script and a key field extracted from output data of the front test script of the tested test script;
extracting key fields from the output data of the tested test script, using the extracted key fields as key fields in an output data label of a second test case, and distributing unique identifiers for the second test case, and using the unique identifiers as identifiers in the output data label of the second test case so as to complete the establishment of the second test case;
After the API test cases are arranged, the method further comprises the following steps:
if the tested test script does not have the associated pre-test script, extracting a key field from the output data of the tested test script, and distributing a unique identifier for a third test case;
establishing a third test case corresponding to the tested test script, wherein the third test case comprises the tested test script and an output data tag; the output data label of the third test case comprises a key field extracted from the output data of the tested test script and a unique identifier distributed for the third test case;
the obtaining the input data of the first test case according to the input data tag of the first test case includes:
according to the input data label of the first test case, determining the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case;
searching a database according to the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case, and obtaining the output data of the front test case of the first test case as the input data of the first test case; the database is used for storing output data of each test case, and the output data of the front test case of the first test case comprises the key field.
2. The method according to claim 1, wherein the method further comprises:
and if the first test case does not comprise the input data tag, acquiring the input data of the first test case according to a preset rule.
3. The method according to any one of claims 1-2, wherein the method further comprises:
extracting key fields from the output data of the first test case;
and storing the extracted key fields as key fields in output data labels of the first test cases.
4. A test apparatus comprising:
the receiving module is used for receiving a test instruction, wherein the test instruction comprises a mark to be tested;
the searching module is used for searching a test case library according to the identification to be detected to obtain a first test case, wherein the test case library comprises a plurality of test cases, and the test cases comprise input data tags, test scripts and output data tags; the input data tag comprises an identifier of a front test case of the test case and a key field extracted from output data of the front test case of the test case, and the output data tag comprises a key field extracted from the output data of the test case and an identifier of the test case; the identification in the output data label of the first test case is consistent with the identification to be tested;
The acquisition module is used for acquiring the input data of the first test case according to the input data tag of the first test case;
the test module is used for executing a test based on the test script of the first test case and the input data of the first test case, obtaining the output data of the first test case and obtaining a test result according to the output data;
the system comprises a building module, a testing module and a testing module, wherein the building module is used for sorting API testing cases, and the API testing cases comprise testing cases of tested testing scripts; analyzing and obtaining a front test script of the tested test script, output data of the front test script of the tested test script and output data of the tested test script according to the API test case; based on the front test script of the tested test script, obtaining an input data tag of a second test case corresponding to the tested test script, wherein the input data tag of the second test case comprises an identifier of the test case corresponding to the front test script of the tested test script and a key field extracted from output data of the front test script of the tested test script; extracting key fields from the output data of the tested test script, using the extracted key fields as key fields in an output data label of a second test case, and distributing unique identifiers for the second test case, and using the unique identifiers as identifiers in the output data label of the second test case so as to complete the establishment of the second test case;
The building module is further configured to extract a key field from output data of the tested test script and assign a unique identifier to a third test case if the tested test script does not have an associated pre-test script after the arranging of the API test cases; establishing a third test case corresponding to the tested test script, wherein the third test case comprises the tested test script and an output data tag; the output data label of the third test case comprises a key field extracted from the output data of the tested test script and a unique identifier distributed for the third test case;
the acquisition module is specifically configured to determine, according to the input data tag of the first test case, an identifier of a front test case of the first test case and a key field corresponding to output data of the front test case of the first test case; searching a database according to the identification of the front test case of the first test case and the key field corresponding to the output data of the front test case of the first test case, and obtaining the output data of the front test case of the first test case as the input data of the first test case; the database is used for storing output data of each test case, and the output data of the front test case of the first test case contains the keywords.
5. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the test method of any one of claims 1-3.
6. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the test method of any of claims 1-3.
CN202110657379.3A 2021-06-11 2021-06-11 Test method and test equipment Active CN113220595B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110657379.3A CN113220595B (en) 2021-06-11 2021-06-11 Test method and test equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110657379.3A CN113220595B (en) 2021-06-11 2021-06-11 Test method and test equipment

Publications (2)

Publication Number Publication Date
CN113220595A CN113220595A (en) 2021-08-06
CN113220595B true CN113220595B (en) 2023-10-03

Family

ID=77080272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110657379.3A Active CN113220595B (en) 2021-06-11 2021-06-11 Test method and test equipment

Country Status (1)

Country Link
CN (1) CN113220595B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018014580A1 (en) * 2016-07-20 2018-01-25 平安科技(深圳)有限公司 Data interface test method and apparatus, and server and storage medium
CN107844421A (en) * 2017-10-31 2018-03-27 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN108255702A (en) * 2017-09-21 2018-07-06 平安科技(深圳)有限公司 A kind of test case creation method, apparatus, equipment and storage medium
CN108268348A (en) * 2017-12-08 2018-07-10 广州视源电子科技股份有限公司 Interface test method, device, mobile terminal and storage medium
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN110321283A (en) * 2019-05-24 2019-10-11 平安银行股份有限公司 Interface testing case generation method, device, computer installation and storage medium
CN112148610A (en) * 2020-09-28 2020-12-29 深圳壹账通智能科技有限公司 Test case execution method and device, computer equipment and storage medium
CN112597028A (en) * 2020-12-25 2021-04-02 北京知因智慧科技有限公司 Method and device for displaying case test result and readable storage medium
CN112597016A (en) * 2020-12-17 2021-04-02 平安普惠企业管理有限公司 Recording method, device and equipment of automatic test script and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10261890B2 (en) * 2015-09-14 2019-04-16 Salesforce.Com, Inc. Methods and systems for executing tests using grouped/filtered test classes during testing of an application
US10120788B2 (en) * 2017-01-23 2018-11-06 Accenture Global Solutions Limited Cloud connected automated testing in multiple operating environments using multiple parallel test threads

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018014580A1 (en) * 2016-07-20 2018-01-25 平安科技(深圳)有限公司 Data interface test method and apparatus, and server and storage medium
CN108255702A (en) * 2017-09-21 2018-07-06 平安科技(深圳)有限公司 A kind of test case creation method, apparatus, equipment and storage medium
CN107844421A (en) * 2017-10-31 2018-03-27 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN108268348A (en) * 2017-12-08 2018-07-10 广州视源电子科技股份有限公司 Interface test method, device, mobile terminal and storage medium
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN110321283A (en) * 2019-05-24 2019-10-11 平安银行股份有限公司 Interface testing case generation method, device, computer installation and storage medium
CN112148610A (en) * 2020-09-28 2020-12-29 深圳壹账通智能科技有限公司 Test case execution method and device, computer equipment and storage medium
CN112597016A (en) * 2020-12-17 2021-04-02 平安普惠企业管理有限公司 Recording method, device and equipment of automatic test script and storage medium
CN112597028A (en) * 2020-12-25 2021-04-02 北京知因智慧科技有限公司 Method and device for displaying case test result and readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种自动化测试技术的研究与实现;李国新;罗省贤;;电子测试(08);全文 *

Also Published As

Publication number Publication date
CN113220595A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN112433944A (en) Service testing method, device, computer equipment and storage medium
CN110750434A (en) Interface testing method and device, electronic equipment and computer readable storage medium
CN113220597B (en) Test method, test device, electronic equipment and storage medium
CN107229565B (en) Test method and device
CN113220595B (en) Test method and test equipment
CN109684205B (en) System testing method, device, electronic equipment and storage medium
CN113127331A (en) Fault injection-based test method and device and computer equipment
CN115220731A (en) Index data acquisition method and device, computer equipment and storage medium
CN114721943A (en) Method and device for determining test range
CN113392024A (en) Method, device, equipment and medium for testing storage process
CN116257426A (en) Test association method, device, electronic equipment and storage medium
CN113590496B (en) Automatic test method and device
CN110609790A (en) Analytic program test method, device, medium and computer equipment
CN115470127B (en) Page compatibility processing method, device, computer equipment and storage medium
CN114595159B (en) Test data generation method, device, equipment and storage medium
CN113448849A (en) Page element testing method, device, equipment and storage medium
CN114048127A (en) Test case processing method and device
CN115578081A (en) Code flow visualization display method and device, electronic equipment and storage medium
CN115934118A (en) Program test method and system for program upgrading
CN115167731A (en) Bank transaction page skipping method, device, system and medium
CN116643790A (en) Data processing method, device, electronic equipment and storage medium
CN112306868A (en) Automatic testing method of Google mobile service, terminal equipment and storage medium
CN117215725A (en) Script generation method and device, electronic equipment and storage medium
CN116737535A (en) Interface test method, device, computer equipment and storage medium
CN114817020A (en) Method and device for generating test case data

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