CN116204428A - Test case generation method and device - Google Patents

Test case generation method and device Download PDF

Info

Publication number
CN116204428A
CN116204428A CN202310170934.9A CN202310170934A CN116204428A CN 116204428 A CN116204428 A CN 116204428A CN 202310170934 A CN202310170934 A CN 202310170934A CN 116204428 A CN116204428 A CN 116204428A
Authority
CN
China
Prior art keywords
test
data
scene
target input
input interfaces
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
Application number
CN202310170934.9A
Other languages
Chinese (zh)
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.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202310170934.9A priority Critical patent/CN116204428A/en
Publication of CN116204428A publication Critical patent/CN116204428A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a test case generation method and device, and relates to the technical field of computers. One specific implementation mode of the method comprises the steps of receiving a test request, and obtaining a test catalog, a test scene and a plurality of groups of test data which are included in the test request; a preset test model is called, and a plurality of target input interfaces are obtained by screening from a plurality of input interfaces of the test model according to a test catalog; filling each group of test data into a test model through a plurality of target input interfaces to obtain a plurality of test cases; and carrying out parameter configuration on the pre-test program according to the test scene, and pre-testing the plurality of test cases by using the pre-test program after configuration so as to remove the test cases which do not accord with the test scene and obtain the final test case. Therefore, the embodiment of the invention can solve the technical problem of low efficiency of generating the test case according to the specified test scene.

Description

Test case generation method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating test cases.
Background
At present, the application range of the automatic test is very wide, high-efficiency data analysis service is provided for users, and the time cost, the labor cost and the hardware cost of the data test are greatly saved.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
the problem of long preparation period of automated test data is common when users enjoy convenient and efficient automated test functions, because the existing test case generation method is mostly strongly coupled with a specific test scene, and thus when the test scene is changed, the test variables needing to be integrated and processed are more, including but not limited to: modification of test data attributes, modification of buried monitoring mechanisms, and the like. In summary, because the automatic burial scheme which can be flexibly configured is lacking in the prior art, when the test scene is replaced, the efficiency of generating the test case is low, and the iteration period of the corresponding automatic test is long.
Disclosure of Invention
In view of the above, the embodiment of the invention provides a test case generation method and device, which can solve the technical problem of low efficiency of generating test cases according to a specified test scene.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a test case generating method, including receiving a test request, and acquiring a test catalog, a test scenario, and a plurality of sets of test data included in the test request; a preset test model is called, and a plurality of target input interfaces are obtained by screening from a plurality of input interfaces of the test model according to a test catalog; filling each group of test data into a test model through a plurality of target input interfaces to obtain a plurality of test cases; and carrying out parameter configuration on the pre-test program according to the test scene, and pre-testing the plurality of test cases by using the pre-test program after configuration so as to remove the test cases which do not accord with the test scene and obtain the final test case.
Optionally, before retrieving the preset test model, the method includes:
and constructing a test model with a plurality of input interfaces, wherein each input interface has a corresponding field identifier and a data effective range so as to be respectively matched with different test catalogues through the plurality of field identifiers to obtain a plurality of target input interfaces respectively corresponding to the plurality of field identifiers.
Optionally, populating each set of test data to the test model through a plurality of target input interfaces, including:
for each target input interface: reading the filled data, carrying out validity check on the filled data according to the corresponding data valid range, if the check is passed, reserving the filled data, and if the check is not passed, executing the following steps in a circulating way until the validity check is passed: updating the filled data according to the corresponding test data, reading the updated filled data, and carrying out validity check on the updated filled data according to the corresponding data valid range; and responding to the determination that each filled data in each test model passes the validity check, and obtaining a corresponding test case.
Optionally, the method comprises:
for each target input interface: and counting the updating times of the filling data, stopping filling in response to the fact that the counting result is larger than a preset threshold value, so as to generate error reporting information at the target input interface, and taking the error reporting information as filled data passing the validity check.
Optionally, performing parameter configuration on the pre-test program according to the test scene includes:
and extracting keywords from the test scene, and analyzing the extracted keywords to obtain a plurality of corresponding standard parameters so as to update the corresponding parameters of the pre-test program according to the standard parameters.
Optionally, after removing the test cases that do not conform to the test scenario, the method includes:
for each test case that does not fit the test scenario: determining a corresponding test data set, matching in a test request to obtain a corresponding data interface, acquiring system time to update the data deadline of the data interface, acquiring test data again to update the test data set, filling the updated test data set into a test model through a plurality of target input interfaces to obtain an updated test case, pre-testing the updated test case, and taking the updated test case as a final test case in response to determining that the pre-test passes.
Optionally, after removing the test cases that do not conform to the test scenario, the method includes:
for each test case that does not fit the test scenario: labeling each test data which does not accord with the test scene, merging all labeled test data to generate a corresponding pre-test report and outputting the pre-test report.
In addition, the invention also provides a test case generating device, which comprises an acquisition module, a test program, a test scene and a plurality of groups of test data, wherein the acquisition module is used for receiving a test request and acquiring a test catalog, a test scene and a plurality of groups of test data which are included in the test request; the processing module is used for calling a preset test model, and screening a plurality of input interfaces of the test model according to the test catalog to obtain a plurality of target input interfaces; the method is also used for filling each group of test data into the test model through a plurality of target input interfaces to obtain a plurality of test cases; and the screening module is used for carrying out parameter configuration on the pre-test program according to the test scene, and carrying out pre-test on the plurality of test cases by using the configured pre-test program so as to remove the test cases which do not accord with the test scene and obtain the final test cases.
Optionally, the method further comprises: the processing module is used for constructing a test model with a plurality of input interfaces before a preset test model is called, wherein each input interface has a corresponding field identifier and a data effective range so as to be respectively matched with different test catalogues through the plurality of field identifiers and obtain a plurality of target input interfaces respectively corresponding to the plurality of field identifiers.
Optionally, the method further comprises: the processing module is used for filling each group of test data into the test model through a plurality of target input interfaces, and for each target input interface: reading the filled data, carrying out validity check on the filled data according to the corresponding data valid range, if the check is passed, reserving the filled data, and if the check is not passed, executing the following steps in a circulating way until the validity check is passed: updating the filled data according to the corresponding test data, reading the updated filled data, and carrying out validity check on the updated filled data according to the corresponding data valid range; and responding to the determination that each filled data in each test model passes the validity check, and obtaining a corresponding test case.
Optionally, the method further comprises: a processing module for, for each target input interface: and counting the updating times of the filling data, stopping filling in response to the fact that the counting result is larger than a preset threshold value, so as to generate error reporting information at the target input interface, and taking the error reporting information as filled data passing the validity check.
Optionally, the method further comprises: and the screening module is used for extracting keywords from the test scene when the parameter configuration is carried out on the pre-test program according to the test scene, analyzing a plurality of extracted keywords to obtain a plurality of corresponding standard parameters, and updating the corresponding parameters of the pre-test program according to the plurality of standard parameters.
Optionally, the method further comprises: the screening module is used for removing the test cases which do not accord with the test scene, and then, carrying out screening on each test case which does not accord with the test scene: determining a corresponding test data set, matching in a test request to obtain a corresponding data interface, acquiring system time to update the data deadline of the data interface, acquiring test data again to update the test data set, filling the updated test data set into a test model through a plurality of target input interfaces to obtain an updated test case, pre-testing the updated test case, and taking the updated test case as a final test case in response to determining that the pre-test passes.
Optionally, the method further comprises: the screening module is used for removing the test cases which do not accord with the test scene, and then, carrying out the screening on each test case which does not accord with the test scene: labeling each test data which does not accord with the test scene, merging all labeled test data to generate a corresponding pre-test report and outputting the pre-test report.
One embodiment of the above invention has the following advantages or benefits: according to the invention, by receiving the test request, the test catalog, the test scene and the plurality of groups of test data which are included in the test request are obtained, the process of automatic analysis processing of the received test request is realized, and the effect of correspondingly configuring the automatic test according to the test requirement is achieved; in addition, the invention obtains a plurality of target input interfaces by selecting the preset test model from a plurality of input interfaces of the test model according to the test catalog, realizes the adjustment of the preset standard test model to adapt to the corresponding test requirement process, can avoid the condition of incomplete acquisition of test data caused by the setting error of the input interfaces, and determines the one-to-one correspondence between each test data and each target input interface in each group of test data; in addition, each group of test data is filled into the test model through a plurality of target input interfaces to obtain a plurality of test cases, so that the buried number processing process is realized, and the error rate of the buried number processing is effectively reduced by screening the target input interfaces in advance; finally, the invention performs the pre-test on each test case to remove the test cases which do not accord with the test scene, and realizes the process of screening and filtering the test cases according to the test requirements, thereby effectively saving the calculation resources required by the subsequent automatic test processing.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a test case generation method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a test case generation method according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram of the main flow of a test case generating method according to a third embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of a test case generating device according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of the main flow of a test case generating method according to a first embodiment of the present invention, as shown in FIG. 1, the test case generating method includes:
step S101, a test request is received, and a test catalog, a test scene and a plurality of groups of test data which are included in the test request are obtained.
In an embodiment, the test catalog may be determined according to a test scenario, for example, if the test scenario is that a certain type of test is performed on the credit reporting, it may be determined that the corresponding test catalog is a data catalog corresponding to the enterprise credit reporting or a data catalog corresponding to the personal credit reporting; in other embodiments, the test catalog may also be custom designed according to business requirements. By acquiring the test catalogue, the test scene and the test data, the automatic analysis processing of the corresponding test request is completed, and the processing efficiency of the test request is improved.
Step S102, a preset test model is called, and a plurality of target input interfaces are obtained by screening from a plurality of input interfaces of the test model according to a test catalog.
In the embodiment, the effect of adjusting the standard test model according to the test requirement is achieved by selecting the target input interface, so that the input expectation corresponding to the multiple input interfaces of the test model is determined, only the input interface for inputting the test data is processed in the embedding process of the test data, and the processing of other input interfaces is omitted, thereby further improving the working efficiency of the embedding system.
Step S103, filling each group of test data into the test model through a plurality of target input interfaces to obtain a plurality of test cases.
In the embodiment, the efficiency of data filling can be effectively improved by distinguishing the marks of the input interfaces in the step processing.
In some embodiments, in order to improve the practical value of the test model, a test model with a plurality of input interfaces may be constructed before a preset test model is called, where each input interface has a corresponding field identifier and a data valid range, so that the plurality of field identifiers are respectively matched with different test directories to obtain a plurality of target input interfaces respectively corresponding to each other. The field identification is the data type field identification to be input by the corresponding input interface, so that the field identification is conveniently and clearly compared with the field identification included in the test catalog, and meanwhile, the field identification is also conveniently arranged to be matched to obtain the corresponding test data, thereby being beneficial to orderly carrying out buried number processing. The data valid range is an expected value of data to be input by a corresponding input interface, and for example, if a certain input interface corresponds to gender parameter data, the corresponding data valid range should be [ male, female ] or [01, 00] (a corresponding lookup table needs to be configured to pre-establish a mapping relationship between 01, 00 and male, female). Through the processing of the step, a test model comprising specific input item identifiers and input item expected values is constructed, so that when different test data are subjected to buried number processing, only a corresponding test model processing range is selected, and the test model is not required to be built again, thereby greatly saving the preprocessing period of automatic test and further improving the response efficiency to test requirements.
In some embodiments, to perform real-time validity checking on input test data to identify and remove invalid test data as early as possible, each set of test data may be populated into the test model through a plurality of target input interfaces, for each target input interface: reading the filled data, carrying out validity check on the filled data according to the corresponding data valid range, if the check is passed, reserving the filled data, and if the check is not passed, executing the following steps in a circulating way until the validity check is passed: updating the filled data according to the corresponding test data, reading the updated filled data, and carrying out validity check on the updated filled data according to the corresponding data valid range; and responding to the determination that each filled data in each test model passes the validity check, and obtaining a corresponding test case. In the processing of the step, by reserving the effective filling data and updating the ineffective filling data, the data transmission errors caused by network abnormality or other abnormality reasons in the buried number processing can be avoided, so that the situation that an effective test data set is generated as an ineffective test case is avoided, and the processing accuracy of the buried number system is improved.
In some embodiments, to avoid unlimited updates to the corresponding padding data due to erroneous raw data, to block the progress of the buried processing, and to waste operating resources, an interface may be entered for each target: and counting the updating times of the filling data, stopping filling in response to the fact that the counting result is larger than a preset threshold value, so as to generate error reporting information at the target input interface, and taking the error reporting information as filled data passing the validity check. In the processing of the step, the corresponding filling data is replaced by the preset error reporting information, so that the original data marked with errors can be distinguished, the processing of the data is skipped, the situation of blocking during the buried number processing can be avoided, the progress of the buried number processing is promoted, and the influence of the original data marked with errors on the rest data is reduced to the greatest extent.
Step S104, carrying out parameter configuration on the pre-test program according to the test scene, and pre-testing the plurality of test cases by using the configured pre-test program to remove the test cases which do not accord with the test scene, so as to obtain the final test case.
In the embodiment, the test cases are pre-tested, so that the effect of primarily screening out the test cases which do not meet the expected test scene can be achieved, the final test cases which are transmitted without errors and are matched with the test requirements can be ensured, the reserved final test cases can be directly put into the subsequent data test links, and the use value of the buried number system is ensured.
In some embodiments, in order to improve accuracy of parameter configuration of the pre-test program and achieve index conversion of the test scene, keyword extraction may be performed on the test scene, and a plurality of corresponding standard parameters may be obtained by parsing a plurality of extracted keywords, so as to update corresponding parameters of the pre-test program according to the plurality of standard parameters.
In some embodiments, in order to obtain more test cases, the screening rate of the test cases is reduced, and after the test cases which do not conform to the test scene can be removed, for each test case which does not conform to the test scene: determining a corresponding test data set, matching in a test request to obtain a corresponding data interface, acquiring system time to update the data deadline of the data interface, acquiring test data again to update the test data set, filling the updated test data set into a test model through a plurality of target input interfaces to obtain an updated test case, pre-testing the updated test case, and taking the updated test case as a final test case in response to determining that the pre-test passes. In actual processing, the initial data deadline is often set early and is not updated, so that the timeliness of test data is often difficult to guarantee. For example, if a certain data test scenario corresponds to enterprise family data in the age range of 30-40 years, and the age parameter corresponding to an individual test case is slightly less than 30 years, so that the data test scenario is not met, and therefore, by updating the data deadline of the test data, an invalid test case can be updated into an effective test case with a high probability, and the acquisition rate of the test case is improved.
In some embodiments, in order to analyze a test case with errors in time, so as to determine that a problem is located as early as possible, thereby improving the generating efficiency of the test case, and after the test case which does not conform to the test scene can be removed, each test case which does not conform to the test scene is processed: labeling each test data which does not accord with the test scene, merging all labeled test data to generate a corresponding pre-test report and outputting the pre-test report.
FIG. 2 is a schematic diagram of the main flow of a test case generation method according to a second embodiment of the present invention, the test case generation method including:
step S201, a test request is received, and a test catalog, a test scene and a plurality of groups of test data which are included in the test request are obtained.
Step S202, a test model with a plurality of input interfaces is constructed, and each input interface has a corresponding data valid range.
Step S203, screening a plurality of target input interfaces from a plurality of input interfaces of the test model according to the test catalog.
Step S204, filling each group of test data into the test model through a plurality of target input interfaces.
Step S205, judging whether the corresponding filling data is valid or not through the data valid range associated with each target input interface, if not, executing step S206, and if yes, executing step S209.
Step S206, updating the filling data according to the corresponding test data, and calculating the corresponding updating times.
Step S207, judging whether the update times are greater than a preset threshold, if not, executing step S205, and if yes, executing step S208.
Step S208, generating error reporting information at the target input interface, and regarding the error reporting information as filling data passing the validity check.
Step S209, reserving the padding data.
Step S210, in response to determining that each filling data in each test model passes the validity check, a corresponding test case is obtained.
Step S211, obtaining a plurality of test cases.
Step S212, extracting keywords from the test scene, and analyzing to obtain a plurality of standard parameters so as to configure the pre-test program.
Step S213, pre-testing the test cases by using the configured pre-test program.
Step S214, selecting a plurality of test cases which do not pass the pre-test, determining problem test data in the test cases, generating a corresponding pre-test report and outputting the report.
Step S215, selecting a plurality of test cases passing the pre-test as the final test case.
FIG. 3 is a schematic diagram of the main flow of a test case generating method according to a third embodiment of the present invention, the test case generating method including:
step 301, a test request is received, and a test catalog, a test scene and a plurality of groups of test data included in the test request are obtained.
Step S302, a test model with a plurality of input interfaces is constructed, and each input interface has a corresponding field identification and a data valid range.
Step S303, comparing the test catalog with a plurality of field identifiers of the test model to determine a plurality of corresponding target input interfaces.
Step S304, filling each group of test data into the test model through a plurality of target input interfaces.
Step S305, judging whether the corresponding filling data is valid or not through the data valid range associated with each target input interface, if not, executing step S306, and if yes, executing step S309.
Step S306, updating the filling data according to the corresponding test data, and calculating corresponding updating times.
Step S307, determining whether the update times is greater than a preset threshold, if not, executing step S305, and if yes, executing step S308.
Step S308, generating error reporting information at the target input interface, and regarding the error reporting information as filling data passing the validity check.
Step S309, reserving the filling data.
And step S310, responding to the determination that each filling data in each test model passes the validity check, and obtaining the corresponding test case.
Step S311, a plurality of test cases are obtained.
Step S312, extracting keywords from the test scene, and analyzing to obtain a plurality of standard parameters to configure the pre-test program.
Step S313, pre-testing the test cases by using the configured pre-test program.
Step S314, selecting a plurality of test cases which do not pass the pre-test, and determining a data interface corresponding to each test case.
Step S315, the data deadline of each data interface is updated to be standard time so as to reacquire the corresponding test data and regenerate the corresponding test case.
Step S316, pre-testing the regenerated test case by using the configured pre-test program.
Step S317, selecting all test cases passing the pre-test as the final test cases.
Fig. 4 is a schematic diagram of main modules of a test case generating device according to an embodiment of the present invention, and as shown in fig. 4, the test case generating device 400 includes an obtaining module 401, a processing module 402, and a screening module 403. The acquiring module 401 is configured to receive a test request, and acquire a test catalog, a test scene, and multiple sets of test data included in the test request; the processing module 402 is configured to retrieve a preset test model, and screen a plurality of target input interfaces from a plurality of input interfaces of the test model according to a test catalog; the processing module 402 is further configured to fill each set of test data into the test model through a plurality of target input interfaces, so as to obtain a plurality of test cases; the filtering module 403 is configured to perform parameter configuration on the pre-test program according to the test scenario, and perform pre-test on the plurality of test cases by using the configured pre-test program, so as to remove the test cases that do not conform to the test scenario, and obtain the final test case.
In some embodiments, the processing module 402 is further configured to: before a preset test model is called, a test model with a plurality of input interfaces is built, wherein each input interface has a corresponding field identifier and a data effective range, so that the corresponding plurality of target input interfaces are obtained through matching of the field identifiers with different test catalogues respectively.
In some embodiments, the processing module 402 is further configured to: when each group of test data is filled into the test model through a plurality of target input interfaces, for each target input interface: reading the filled data, carrying out validity check on the filled data according to the corresponding data valid range, if the check is passed, reserving the filled data, and if the check is not passed, executing the following steps in a circulating way until the validity check is passed: updating the filled data according to the corresponding test data, reading the updated filled data, and carrying out validity check on the updated filled data according to the corresponding data valid range; and responding to the determination that each filled data in each test model passes the validity check, and obtaining a corresponding test case.
In some embodiments, the processing module 402 is further configured to, for each target input interface: and counting the updating times of the filling data, stopping filling in response to the fact that the counting result is larger than a preset threshold value, so as to generate error reporting information at the target input interface, and taking the error reporting information as filled data passing the validity check.
In some embodiments, the screening module 403 is further configured to: when the parameter configuration is carried out on the pre-test program according to the test scene, keyword extraction is carried out on the test scene, a plurality of corresponding standard parameters are obtained by analyzing a plurality of extracted keywords, and corresponding parameters of the pre-test program are updated according to the standard parameters.
In some embodiments, the screening module 403 is further configured to: after the test cases which do not conform to the test scene are removed, for each test case which does not conform to the test scene: determining a corresponding test data set, matching in a test request to obtain a corresponding data interface, acquiring system time to update the data deadline of the data interface, acquiring test data again to update the test data set, filling the updated test data set into a test model through a plurality of target input interfaces to obtain an updated test case, pre-testing the updated test case, and taking the updated test case as a final test case in response to determining that the pre-test passes.
In some embodiments, the screening module 403 is further configured to: after the test cases which do not accord with the test scene are removed, for each test case which does not accord with the test scene: labeling each test data which does not accord with the test scene, merging all labeled test data to generate a corresponding pre-test report and outputting the pre-test report.
In the test case generating method and the test case generating apparatus according to the present invention, the specific implementation contents have a corresponding relationship, and therefore, the repetitive contents will not be described.
FIG. 5 illustrates an exemplary system architecture 500 to which the test case generation method or test case generation apparatus of embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various communication client applications can be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be various electronic devices having a page display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (by way of example only) providing support for users with the terminal devices 501, 502, 503. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the test case generating method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the computing device is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data required for the operation of the computer system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a liquid crystal page display processor (LCD), and the like, and a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes an acquisition module, a processing module, and a screening module. The names of these modules do not constitute a limitation on the module itself in some cases.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to include receiving a test request, acquiring a test catalog, a test scenario, and a plurality of sets of test data included in the test request; a preset test model is called, and a plurality of target input interfaces are obtained by screening from a plurality of input interfaces of the test model according to a test catalog; filling each group of test data into a test model through a plurality of target input interfaces to obtain a plurality of test cases; and carrying out parameter configuration on the pre-test program according to the test scene, and pre-testing the plurality of test cases by using the pre-test program after configuration so as to remove the test cases which do not accord with the test scene and obtain the final test case.
According to the technical scheme provided by the embodiment of the invention, the technical problem of low efficiency of generating the test case according to the specified test scene can be solved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (17)

1. A test case generation method, comprising:
receiving a test request, and acquiring a test catalog, a test scene and a plurality of groups of test data which are included in the test request;
a preset test model is called, and a plurality of target input interfaces are obtained by screening from a plurality of input interfaces of the test model according to a test catalog;
filling each group of test data into a test model through a plurality of target input interfaces to obtain a plurality of test cases;
and carrying out parameter configuration on the pre-test program according to the test scene, and pre-testing the plurality of test cases by using the pre-test program after configuration so as to remove the test cases which do not accord with the test scene and obtain the final test case.
2. The method of claim 1, comprising, prior to invoking the predetermined test model:
and constructing a test model with a plurality of input interfaces, wherein each input interface has a corresponding field identifier and a data effective range so as to be respectively matched with different test catalogues through the plurality of field identifiers to obtain a plurality of target input interfaces respectively corresponding to the plurality of field identifiers.
3. The method of claim 2, wherein populating each set of test data to the test model through a plurality of target input interfaces, comprising:
for each target input interface: reading the filled data, carrying out validity check on the filled data according to the corresponding data valid range,
if the verification passes, the filled data is preserved,
if the verification is not passed, the following steps are circularly executed until the validity verification is passed: updating the filled data according to the corresponding test data, reading the updated filled data, and carrying out validity check on the updated filled data according to the corresponding data valid range;
and responding to the determination that each filled data in each test model passes the validity check, and obtaining a corresponding test case.
4. A method according to claim 3, comprising:
for each target input interface: and counting the updating times of the filling data, stopping filling in response to the fact that the counting result is larger than a preset threshold value, so as to generate error reporting information at the target input interface, and taking the error reporting information as filled data passing the validity check.
5. The method of claim 1, wherein configuring parameters of the pre-test program according to the test scenario comprises:
and extracting keywords from the test scene, and analyzing the extracted keywords to obtain a plurality of corresponding standard parameters so as to update the corresponding parameters of the pre-test program according to the standard parameters.
6. The method of claim 1, wherein after removing test cases that do not conform to the test scenario, comprising:
for each test case that does not fit the test scenario: determining corresponding test data groups, matching in the test request to obtain corresponding data interfaces,
acquiring a system time to update a data deadline of the data interface and acquiring test data again to update the test data set,
filling the updated test data set into a test model through a plurality of target input interfaces to obtain an updated test case,
and pre-testing the updated test case, and taking the updated test case as a final test case in response to determining that the pre-test is passed.
7. The method of claim 1, wherein after removing test cases that do not conform to the test scenario, comprising:
for each test case that does not fit the test scenario: labeling each test data which does not accord with the test scene, merging all labeled test data to generate a corresponding pre-test report and outputting the pre-test report.
8. A test case generating apparatus, comprising:
the acquisition module is used for receiving a test request and acquiring a test catalog, a test scene and a plurality of groups of test data which are included in the test request;
the processing module is used for calling a preset test model, and screening a plurality of input interfaces of the test model according to the test catalog to obtain a plurality of target input interfaces; the method is also used for filling each group of test data into the test model through a plurality of target input interfaces to obtain a plurality of test cases;
and the screening module is used for carrying out parameter configuration on the pre-test program according to the test scene, and carrying out pre-test on the plurality of test cases by using the configured pre-test program so as to remove the test cases which do not accord with the test scene and obtain the final test cases.
9. The apparatus as recited in claim 8, further comprising:
the processing module is used for constructing a test model with a plurality of input interfaces before a preset test model is called, wherein each input interface has a corresponding field identifier and a data effective range so as to be respectively matched with different test catalogues through the plurality of field identifiers and obtain a plurality of target input interfaces respectively corresponding to the plurality of field identifiers.
10. The apparatus as recited in claim 9, further comprising:
the processing module is used for filling each group of test data into the test model through a plurality of target input interfaces, and for each target input interface: reading the filled data, carrying out validity check on the filled data according to the corresponding data valid range, if the check is passed, reserving the filled data, and if the check is not passed, executing the following steps in a circulating way until the validity check is passed: updating the filled data according to the corresponding test data, reading the updated filled data, and carrying out validity check on the updated filled data according to the corresponding data valid range; and responding to the determination that each filled data in each test model passes the validity check, and obtaining a corresponding test case.
11. The apparatus as recited in claim 10, further comprising:
a processing module for, for each target input interface: and counting the updating times of the filling data, stopping filling in response to the fact that the counting result is larger than a preset threshold value, so as to generate error reporting information at the target input interface, and taking the error reporting information as filled data passing the validity check.
12. The apparatus as recited in claim 8, further comprising:
and the screening module is used for extracting keywords from the test scene when the parameter configuration is carried out on the pre-test program according to the test scene, analyzing a plurality of extracted keywords to obtain a plurality of corresponding standard parameters, and updating the corresponding parameters of the pre-test program according to the plurality of standard parameters.
13. The apparatus as recited in claim 8, further comprising:
the screening module is used for removing the test cases which do not accord with the test scene, and then, carrying out screening on each test case which does not accord with the test scene: determining a corresponding test data set, matching in a test request to obtain a corresponding data interface, acquiring system time to update the data deadline of the data interface, acquiring test data again to update the test data set, filling the updated test data set into a test model through a plurality of target input interfaces to obtain an updated test case, pre-testing the updated test case, and taking the updated test case as a final test case in response to determining that the pre-test passes.
14. The apparatus as recited in claim 8, further comprising:
the screening module is used for removing the test cases which do not accord with the test scene, and then, carrying out the screening on each test case which does not accord with the test scene: labeling each test data which does not accord with the test scene, merging all labeled test data to generate a corresponding pre-test report and outputting the pre-test report.
15. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
16. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
17. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
CN202310170934.9A 2023-02-27 2023-02-27 Test case generation method and device Pending CN116204428A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310170934.9A CN116204428A (en) 2023-02-27 2023-02-27 Test case generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310170934.9A CN116204428A (en) 2023-02-27 2023-02-27 Test case generation method and device

Publications (1)

Publication Number Publication Date
CN116204428A true CN116204428A (en) 2023-06-02

Family

ID=86509123

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310170934.9A Pending CN116204428A (en) 2023-02-27 2023-02-27 Test case generation method and device

Country Status (1)

Country Link
CN (1) CN116204428A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117130945A (en) * 2023-10-26 2023-11-28 中国证券登记结算有限责任公司 Test method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117130945A (en) * 2023-10-26 2023-11-28 中国证券登记结算有限责任公司 Test method and device
CN117130945B (en) * 2023-10-26 2024-02-09 中国证券登记结算有限责任公司 Test method and device

Similar Documents

Publication Publication Date Title
CN112527649A (en) Test case generation method and device
CN111371858B (en) Group control equipment identification method, device, medium and electronic equipment
CN111038906B (en) Order sorting method and device
CN109614327B (en) Method and apparatus for outputting information
CN111339743B (en) Account number generation method and device
CN110019263B (en) Information storage method and device
CN108933695B (en) Method and apparatus for processing information
CN112346775B (en) Index data general processing method, electronic device and storage medium
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN113626223A (en) Interface calling method and device
CN115423030A (en) Equipment identification method and device
CN116204428A (en) Test case generation method and device
CN113094415B (en) Data extraction method, data extraction device, computer readable medium and electronic equipment
CN113157911A (en) Service verification method and device
CN112860538A (en) Method and device for performing interface regression test based on online log
CN109214846B (en) Information storage method and device
CN112148705A (en) Data migration method and device
CN115658127A (en) Data processing method and device, electronic equipment and storage medium
CN111079185B (en) Database information processing method and device, storage medium and electronic equipment
CN109656519B (en) Method and device for automatically accessing service data
CN109087097B (en) Method and device for updating same identifier of chain code
CN113779018A (en) Data processing method and device
CN113326253A (en) Data cleaning method, device, equipment and storage medium based on full-text database
CN111274115A (en) Verification method and device for system reconfiguration
CN114115833B (en) Automatic protocol audit code generation 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