CN116483723A - Automatic test method and device, storage medium and electronic equipment - Google Patents

Automatic test method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116483723A
CN116483723A CN202310465971.2A CN202310465971A CN116483723A CN 116483723 A CN116483723 A CN 116483723A CN 202310465971 A CN202310465971 A CN 202310465971A CN 116483723 A CN116483723 A CN 116483723A
Authority
CN
China
Prior art keywords
test
data
target
service
cases
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
CN202310465971.2A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310465971.2A priority Critical patent/CN116483723A/en
Publication of CN116483723A publication Critical patent/CN116483723A/en
Pending legal-status Critical Current

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/3688Test management for test execution, e.g. scheduling of test suites
    • 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 an automatic testing method, an automatic testing device, a storage medium and electronic equipment, and relates to the field of financial science and technology. Wherein the method comprises the following steps: responding to a test instruction, and calling a data preparation service to acquire a plurality of test data, wherein the test instruction at least comprises an acquisition rule of the plurality of test data; generating a test case corresponding to each test data according to the plurality of test data to obtain a plurality of test cases; and determining a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, and concurrently executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively. The invention solves the technical problem of low automatic test efficiency caused by long time consumption of manually preparing test data in the prior art.

Description

Automatic test method and device, storage medium and electronic equipment
Technical Field
The invention relates to the field of financial science and technology, in particular to an automatic testing method, an automatic testing device, a storage medium and electronic equipment.
Background
With the continuous iteration of the automated daemon, the task of writing and maintaining automated test scripts by testers becomes more difficult and inefficient, and the main pain points are difficult data preparation and long case execution time. At present, in the process of writing an automatic test script, most of the work of writing codes can be quickly realized through a mature framework, but the time and labor consumption problems existing in the process of manually preparing test data cannot be solved, the workload of preparing the data is far beyond the workload of writing the codes, and the automatic test efficiency is low. In addition, in the existing automation test script, each corresponding test case in a single script is usually executed in series, so that the test case execution time is too long, and because data are mutually independent, data preparation between the test cases may have a cross or multiplexing condition, so that the test cases cannot be executed in parallel, and the problem of low automation test efficiency exists.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides an automatic test method, an automatic test device, a storage medium and electronic equipment, which at least solve the technical problem of low automatic test efficiency caused by long time consumption of manually preparing test data in the prior art.
According to an aspect of an embodiment of the present invention, there is provided an automated test method including: responding to a test instruction, and calling a data preparation service to acquire a plurality of test data, wherein the test instruction at least comprises an acquisition rule of the plurality of test data; generating a test case corresponding to each test data according to the plurality of test data to obtain a plurality of test cases; and determining a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, and concurrently executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively.
Further, the automated test method further comprises: responding to the test instruction, calling a service interface of the data preparation service, and sending an acquisition rule to the service interface; and the data preparation service performs data extraction from the target database according to the acquisition rule to obtain a plurality of test data.
Further, the acquisition rule includes at least one of: the target acquisition address and the target data identification, and the automatic test method further comprises the following steps: the data preparation service determines a target database according to the target acquisition address; and according to the identification of the target data, data extraction is carried out from the target database to obtain a plurality of test data, wherein the data primary keys corresponding to each test data are different, and the time stamps associated with each data primary key are different.
Further, the automated test method further comprises: before the data preparation service is called to acquire a plurality of test data in response to the test instruction, a plurality of service functions of the data preparation service are configured, and a service interface is generated, wherein the plurality of service functions at least comprise a data extraction function.
Further, the automated test method further comprises: acquiring target resource data, wherein the target resource data characterizes the running capability of the thread running environment; and determining a plurality of target threads required for executing the plurality of test cases according to the target resource data and the execution times of the plurality of test cases.
Further, the automated test method further comprises: according to the target resource data, carrying out equipartition on the numerical values corresponding to the execution times of the plurality of test cases to obtain a first numerical value; a plurality of target threads required to execute the plurality of test cases is determined based on the first value.
Further, the automated test method further comprises: after each test case is executed through a plurality of target threads concurrently, calling a data clearing service to carry out data clearing processing under the condition that the execution of each test case is finished, and releasing the plurality of target threads after the completion of the data clearing processing is detected.
According to another aspect of the embodiment of the present invention, there is also provided an automated testing apparatus, including: the acquisition module is used for responding to the test instruction and calling the data preparation service to acquire a plurality of test data, wherein the test instruction at least comprises an acquisition rule of the plurality of test data; the processing module is used for generating a test case corresponding to each test data according to the plurality of test data to obtain a plurality of test cases; the determining module is used for determining a plurality of target threads required by executing the plurality of test cases according to the execution times of the plurality of test cases, and executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively.
According to another aspect of embodiments of the present invention, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the automated test method described above at run-time.
According to another aspect of an embodiment of the present invention, there is also provided an electronic device including one or more processors; and a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running the program, wherein the program is configured to perform the automated test method described above when run.
In the embodiment of the invention, a mode of completing data preparation work through a data preparation service and executing test cases through multiple threads concurrently is adopted to realize automatic test, firstly, a test instruction is responded, the data preparation service is called to obtain multiple test data, then, according to the multiple test data, a test case corresponding to each test data is generated, multiple test cases are obtained, then, multiple target threads required by executing the multiple test cases are determined according to the execution times of the multiple test cases, and each test case is executed through the multiple target threads concurrently. The test instruction at least comprises a plurality of acquisition rules of test data, and each target thread executes at least one test case respectively.
In the process, according to the acquisition rule of the test data and the data preparation service, the preparation work of the test data can be completed, the quick number making is realized, and compared with the prior art that repeated data preparation program sentences are manually written by a tester, the efficiency of data preparation is greatly improved, so that the efficiency of automatic test is improved, moreover, the tester does not need to write lengthy data preparation program sentences, and the simplicity of an automatic test script can be improved. In addition, the data are mutually independent by calling the data preparation service, so that on the premise of ensuring that the data between the test cases are mutually independent, a plurality of target threads required by executing the plurality of test cases are determined according to the execution times of the plurality of test cases, and the test cases in the script are executed in parallel through the plurality of threads, the execution efficiency of the test cases is improved, and the efficiency of automatic test is improved.
Therefore, the technical scheme of the invention achieves the purposes of reducing the workload of preparing test data and saving time cost and labor cost, thereby realizing the technical effect of improving the automatic test efficiency and further solving the technical problem of low automatic test efficiency caused by longer time consumption of manually preparing test data in the prior art.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a flow chart of an alternative automated test method according to an embodiment of the present invention;
FIG. 2 is a flow chart of an alternative acquisition of test data according to an embodiment of the invention;
FIG. 3 is a schematic diagram of an alternative automated test equipment according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the related information (including, but not limited to, user equipment information, user personal information, etc.) and data (including, but not limited to, data for presentation, analyzed data, etc.) related to the present invention are information and data authorized by the user or sufficiently authorized by each party. For example, an interface is provided between the system and the relevant user or institution, before acquiring the relevant information, the system needs to send an acquisition request to the user or institution through the interface, and acquire the relevant information after receiving the consent information fed back by the user or institution.
Example 1
In accordance with an embodiment of the present invention, an embodiment of an automated test method is provided, it being noted that the steps illustrated in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
FIG. 1 is a flow chart of an alternative automated test method according to an embodiment of the invention, as shown in FIG. 1, comprising the steps of:
in step S101, a data preparation service is invoked to obtain a plurality of test data in response to a test instruction, where the test instruction at least includes a rule for obtaining the plurality of test data.
In the above steps, the test instruction may be responded by an application system, a processor, an electronic device, or the like. Optionally, the data preparation service is invoked to obtain a plurality of test data by the automated test system in response to the test instruction. The acquisition rule may be a count condition, may include a data acquisition address, a data identifier, etc., and the test instruction may be dataGet ("http:// ABC: 1234/taas/school/findstumentnum=9 & teachername=a"), for example, and the acquisition rule may be to acquire data of 9 students under the name of a teacher from the address ABC: 1234.
In an alternative embodiment, a plurality of service functions of the data preparation service are configured and a service interface is generated before invoking the data preparation service to obtain the plurality of test data in response to the test instruction, wherein the plurality of service functions includes at least a data extraction function.
Alternatively, the data preparation service may be implemented by a service-as-test (TaaS), specifically, a service interface of a plurality of service functions with limited and high reusability is configured through the TaaS service, and a number-making service is provided through the service interface.
In the process, according to the acquisition rule of the test data and the data preparation service, the preparation work of the test data can be completed, and the quick count is realized.
Step S102, according to the plurality of test data, generating a test case corresponding to each test data, and obtaining a plurality of test cases.
In the above step, a test case corresponding to each test data may be generated according to the plurality of test data, so as to obtain a plurality of test cases. Alternatively, after the data preparation service is invoked to acquire a plurality of test data, the plurality of test data may be used as required, for example, a data query operation or the like may be performed from the prepared test data.
Step S103, determining a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, and executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively.
In the above step, according to the execution times of the plurality of test cases, a plurality of target threads required for executing the plurality of test cases may be determined, and then each test case is executed concurrently through the plurality of target threads. Alternatively, each target thread executes at least one test case separately, for example, a script has 10 test cases (i.e., executing the script 10 times), and TaaS data preparation has 10, and the number of threads is set in combination with the existing supportable resources (i.e., the running capability of the thread running environment), for example, 2 child threads are set, and the method is read into the map by 10 tass, and the parent thread is cycled by setting a global variable, i.e., 5 cases are executed by 2 child threads, respectively.
In the above process, the data preparation service is invoked to realize mutual independence of the data, so that on the premise of ensuring that the data between the test cases are mutually independent, a plurality of target threads required by executing the test cases are determined according to the execution times of the test cases, and the test cases in the script are executed in parallel through the threads, so that the execution efficiency of the test cases is improved, and the efficiency of automatic test is improved.
Based on the scheme defined in the steps S101 to S103, it can be known that in the embodiment of the present invention, a manner of completing data preparation work through a data preparation service and concurrently executing test cases through a plurality of threads is adopted to implement automatic test, first, a data preparation service is called to obtain a plurality of test data in response to a test instruction, then, a test case corresponding to each test data is generated according to the plurality of test data, a plurality of test cases are obtained, then, a plurality of target threads required for executing the plurality of test cases are determined according to the execution times of the plurality of test cases, and each test case is concurrently executed through the plurality of target threads. The test instruction at least comprises a plurality of acquisition rules of test data, and each target thread executes at least one test case respectively.
It is easy to notice that in the above process, according to the acquisition rule of the test data and the call of the data preparation service, the preparation work of the test data can be completed, the rapid creation is realized, and compared with the prior art that the repeated data preparation program statement is manually written by the tester, the efficiency of the data preparation is greatly improved, thereby improving the efficiency of the automatic test, and the tester does not need to write the lengthy data preparation program statement, and the simplification of the automatic test script can also be improved. In addition, the data are mutually independent by calling the data preparation service, so that on the premise of ensuring that the data between the test cases are mutually independent, a plurality of target threads required by executing the plurality of test cases are determined according to the execution times of the plurality of test cases, and the test cases in the script are executed in parallel through the plurality of threads, the execution efficiency of the test cases is improved, and the efficiency of automatic test is improved.
Therefore, the technical scheme of the invention achieves the purposes of reducing the workload of preparing test data and saving time cost and labor cost, thereby realizing the technical effect of improving the automatic test efficiency and further solving the technical problem of low automatic test efficiency caused by longer time consumption of manually preparing test data in the prior art.
In an alternative embodiment, in the process of calling the data preparation service to acquire a plurality of test data in response to the test instruction, firstly, a service interface of the data preparation service is called in response to the test instruction, an acquisition rule is sent to the service interface, and then the data preparation service performs data extraction from a target database according to the acquisition rule to acquire the plurality of test data.
FIG. 2 is a flowchart of an alternative method for acquiring test data, as shown in FIG. 2, according to an embodiment of the present invention, including the steps of:
step S201, responding to the test instruction, calling a service interface of the data preparation service, and sending an acquisition rule to the service interface;
in step S202, the data preparation service performs data extraction from the target database according to the acquisition rule, so as to obtain a plurality of test data.
Optionally, in the foregoing process, the data preparation process may be implemented by calling a service interface of the data preparation service and sending an acquisition rule to the service interface, and specifically, the data preparation service performs data extraction from a target database according to the acquisition rule to obtain a plurality of test data, where the target database may be a database corresponding to a specific service scenario, for example, the current service scenario may be data information of 10 students s1 to s10 under the name of a teacher, and the target database may be a database storing data of the teacher and the students.
Optionally, the data preparation is first required, and then the data query function can be implemented, that is, a plurality of test data are first required to be acquired, and then the query can be performed from the test data. In the prior art, a tester is usually required to manually write a considerable and repeated SQL sentence, for example, 10-bit student data needs to be prepared, and the script logic of the prior art is exemplified as follows:
data preparation: all students below delete A;
insert student s1 through a teacher;
insert student s2 to a teacher name;
insert student s3 to a teacher name;
insert student s4 to a teacher name;
insert student s5 to a teacher name;
insert student s6 to a teacher name;
insert student s7 to a teacher name;
insert student s8 to a teacher name;
insert student s9 to a teacher name;
insert student s10 to a teacher name; data preparation end
Alternatively, in this embodiment, the data preparation process may be implemented by calling a service interface of the data preparation service and sending an acquisition rule to the service interface, for example, data of 10 students need to be prepared, and the script logic of the present invention is exemplified as follows:
data preparation:
tassGet dp=new TassGet();
dp.dataGet("http://ABC:1234/taas/school/findStudentnum=10&teacherName=A”);
data preparation end
In this embodiment, according to the acquisition rule of the test data and the data preparation service, the preparation work of the test data can be completed, and the quick count is realized.
In an alternative embodiment, the acquisition rules include at least one of: the method comprises the steps of acquiring an address and an identification of target data by a target, wherein in the process that a data preparation service extracts data from a target database according to an acquisition rule to obtain a plurality of test data, the data preparation service determines the target database according to the target acquisition address, and then extracts data from the target database according to the identification of the target data to obtain the plurality of test data, wherein data main keys corresponding to each test data are different, and time stamps associated with each data main key are different.
Alternatively, the acquisition rule may include an address of target acquisition, an identification of target data, for example, the test instruction may be dataGet ("http:// ABC: 1234/taas/school/findstuentnum=9 & teathername=a"), the acquisition rule may be to acquire data of 9 students under the name of teacher a from address ABC:1234, where the address of target acquisition may be address ABC:1234, and the identification of target data may be teacher a.
Alternatively, the data preparation service may determine a target database based on the target acquisition address, e.g., the target database corresponding to address ABC:1234 is a database storing teacher and student data. Further, according to the identification of the target data, data extraction is performed from the target database, so that a plurality of test data can be obtained, for example, the identification of the target data can be teacher a, and data extraction is performed from student data under the name of teacher a in the database, so that a plurality of test data can be obtained.
Alternatively, to ensure that the data acquired by each call of the TaaS service is completely different data, a random string may be added to the data primary key, for example, using a randomMap association timestamp, so that each data primary key is associated with a different timestamp.
Optionally, since the data types are limited for each service line, after writing the code for calling the TaaS service, the code can be reused, that is, the data preparation of the TaaS service can be multiplexed as data assets, thereby improving the test efficiency.
In addition, data preparation is completely different for different service lines, and thus, a call to TaaS service needs to be provided with a configurable function, i.e., support parameter configurability. Optionally, in this embodiment, a json object with a configurable number of conditions is transferred to a program script corresponding to a service call by a Post method, so as to implement parameter configurability, and the related program script is exemplified as follows:
String test=
dp.dataPost("http://ABC:1234/taas/school/findStudentnum=11&teacherName=A",
"{ \" version ": \"2 ", \" parameter 1 ": \" "+value 1+" \ ", \" parameter 2 ":" +value 2+ ", \" parameter 3 ": \" value 3 "}";
System.out.println(test)
in an alternative embodiment, in determining a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, target resource data is first obtained, and then a plurality of target threads required for executing the plurality of test cases are determined according to the target resource data and the execution times of the plurality of test cases. Wherein the target resource data characterizes the running capability of the thread running environment.
In an alternative embodiment, in determining a plurality of target threads required for executing a plurality of test cases according to the target resource data and the execution times of the plurality of test cases, first, dividing the values corresponding to the execution times of the plurality of test cases according to the target resource data to obtain a first value, and then determining a plurality of target threads required for executing the plurality of test cases according to the first value.
Optionally, the target resource data at least includes memory running data, thread pool resource data, and the like. Specifically, the number of threads is set in combination with the existing supportable resources (i.e., the running capability of the thread running environment), for example, 10 test cases are executed, and assuming that the thread pool resource data indicates that 3 sub-threads can be executed, the 10 test cases can be equally divided, for example, the 10 test cases are divided into 2 and 5 times, so as to obtain a first value of 2, and it can be determined that 2 sub-threads are required to execute the 10 test cases, namely, 5 cases are executed through the 2 sub-threads respectively.
It should be noted that in the above process, the concurrency policy of the test case is not felt by the tester, the data is ready to be written in the table (e.g. excel) of the database, the data is obtained by reading the file, and only the field assignment and the service call need to be written in the java file, so that the time cost and the labor cost are saved, and the efficiency of the automatic test is further improved.
In an alternative embodiment, after each test case is executed concurrently by a plurality of target threads, in the event that each test case is completed, the data cleaning service is invoked to perform a data cleaning process, and after the completion of the data cleaning process is detected, the plurality of target threads are released.
Optionally, since each test case needs to be separately counted, the situation that test data increases suddenly after the test case is executed may be caused, so that in the case that the execution of each test case is finished, that is, before the thread is destroyed, the data clearing service is invoked to perform the data clearing process, and then after the completion of the data clearing process is detected, a plurality of sub-threads for executing the test case, that is, the thread is automatically destroyed, are released.
In the above process, the data clearing service is invoked to perform data clearing processing, so that timely recovery of data can be ensured, and occupation of database resources can be reduced.
Therefore, the technical scheme of the invention achieves the purposes of reducing the workload of preparing test data and saving time cost and labor cost, thereby realizing the technical effect of improving the automatic test efficiency and further solving the technical problem of low automatic test efficiency caused by longer time consumption of manually preparing test data in the prior art.
Example 2
According to an embodiment of the present invention, there is provided an embodiment of an automated testing apparatus, wherein fig. 3 is a schematic diagram of an alternative automated testing apparatus according to an embodiment of the present invention, as shown in fig. 3, the apparatus comprising: an obtaining module 301, configured to respond to a test instruction, invoke a data preparation service to obtain a plurality of test data, where the test instruction at least includes an obtaining rule of the plurality of test data; the processing module 302 is configured to generate a test case corresponding to each test data according to the plurality of test data, so as to obtain a plurality of test cases; the determining module 303 is configured to determine a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, and execute each test case concurrently through the plurality of target threads, where each target thread executes at least one test case respectively.
It should be noted that the above-mentioned obtaining module 301, processing module 302, and determining module 303 correspond to steps S101 to S103 in the above-mentioned embodiment, and the three modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in the above-mentioned embodiment 1.
Optionally, the acquiring module includes: the first acquisition module is used for responding to the test instruction, calling a service interface of the data preparation service and sending an acquisition rule to the service interface; and the second acquisition module is used for extracting data from the target database by the data preparation service according to the acquisition rule to obtain a plurality of test data.
Optionally, the acquisition rule includes at least one of: the second acquisition module comprises: the first determining module is used for determining a target database according to the target acquisition address by the data preparation service; and the third acquisition module is used for extracting data from the target database according to the identification of the target data to obtain a plurality of test data, wherein the data primary keys corresponding to each test data are different, and the time stamps associated with the data primary keys are different.
Optionally, the automated testing apparatus further comprises: and the configuration module is used for configuring a plurality of service functions of the data preparation service and generating a service interface, wherein the plurality of service functions at least comprise a data extraction function.
Optionally, the determining module includes: a fourth obtaining module, configured to obtain target resource data, where the target resource data characterizes an operation capability of the thread operation environment; and the second determining module is used for determining a plurality of target threads required by executing the plurality of test cases according to the target resource data and the execution times of the plurality of test cases.
Optionally, the second determining module includes: the calculation module is used for equally dividing the numerical values corresponding to the execution times of the plurality of test cases according to the target resource data to obtain a first numerical value; and the third determining module is used for determining a plurality of target threads required for executing a plurality of test cases according to the first numerical value.
Optionally, the automated testing apparatus further comprises: and the first processing module is used for calling the data clearing service to carry out data clearing processing under the condition that the execution of each test case is finished, and releasing a plurality of target threads after the completion of the data clearing processing is detected.
Example 3
According to another aspect of the embodiments of the present invention, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described automated test method at runtime.
Example 4
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, wherein fig. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the present invention, as shown in fig. 4, the electronic device including one or more processors; and a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running the program, wherein the program is configured to perform the automated test method described above when run. The processor when executing the program implements the following steps: responding to a test instruction, and calling a data preparation service to acquire a plurality of test data, wherein the test instruction at least comprises an acquisition rule of the plurality of test data; generating a test case corresponding to each test data according to the plurality of test data to obtain a plurality of test cases; and determining a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, and concurrently executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively.
Optionally, the processor further implements the following steps when executing the program: responding to the test instruction, calling a service interface of the data preparation service, and sending an acquisition rule to the service interface; and the data preparation service performs data extraction from the target database according to the acquisition rule to obtain a plurality of test data.
Optionally, the acquisition rule includes at least one of: the target obtains the address, label of the target data, the processor realizes the following steps when executing the program: the data preparation service determines a target database according to the target acquisition address; and according to the identification of the target data, data extraction is carried out from the target database to obtain a plurality of test data, wherein the data primary keys corresponding to each test data are different, and the time stamps associated with each data primary key are different.
Optionally, the processor further implements the following steps when executing the program: before the data preparation service is called to acquire a plurality of test data in response to the test instruction, a plurality of service functions of the data preparation service are configured, and a service interface is generated, wherein the plurality of service functions at least comprise a data extraction function.
Optionally, the processor further implements the following steps when executing the program: acquiring target resource data, wherein the target resource data characterizes the running capability of the thread running environment; and determining a plurality of target threads required for executing the plurality of test cases according to the target resource data and the execution times of the plurality of test cases.
Optionally, the processor further implements the following steps when executing the program: according to the target resource data, carrying out equipartition on the numerical values corresponding to the execution times of the plurality of test cases to obtain a first numerical value; a plurality of target threads required to execute the plurality of test cases is determined based on the first value.
Optionally, the processor further implements the following steps when executing the program: after each test case is executed through a plurality of target threads concurrently, calling a data clearing service to carry out data clearing processing under the condition that the execution of each test case is finished, and releasing the plurality of target threads after the completion of the data clearing processing is detected.
The device herein may be a server, PC, PAD, cell phone, etc.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. An automated testing method, comprising:
responding to a test instruction, and calling a data preparation service to acquire a plurality of test data, wherein the test instruction at least comprises an acquisition rule of the plurality of test data;
generating a test case corresponding to each test data according to the plurality of test data to obtain a plurality of test cases;
and determining a plurality of target threads required for executing the plurality of test cases according to the execution times of the plurality of test cases, and executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively.
2. The method of claim 1, wherein invoking the data preparation service to obtain the plurality of test data in response to the test instruction comprises:
responding to the test instruction, calling a service interface of the data preparation service, and sending the acquisition rule to the service interface;
and the data preparation service performs data extraction from the target database according to the acquisition rule to obtain the plurality of test data.
3. The method of claim 2, wherein the acquisition rules comprise at least one of: the target obtains the address, label of the target data, wherein, the said data prepares the service and carries on the data extraction from the target database according to the said acquisition rule, get the said multiple test data, including:
the data preparation service determines the target database according to the target acquisition address;
and extracting data from the target database according to the identification of the target data to obtain the plurality of test data, wherein the data primary keys corresponding to each test data are different, and the time stamps associated with each data primary key are different.
4. The method of claim 2, wherein before invoking the data preparation service to obtain the plurality of test data in response to the test instruction, the method further comprises:
and configuring a plurality of service functions of the data preparation service and generating the service interface, wherein the plurality of service functions at least comprise a data extraction function.
5. The method of claim 1, wherein determining a plurality of target threads needed to execute the plurality of test cases based on the number of executions of the plurality of test cases comprises:
obtaining target resource data, wherein the target resource data characterizes the running capability of a thread running environment;
and determining a plurality of target threads required for executing the plurality of test cases according to the target resource data and the execution times of the plurality of test cases.
6. The method of claim 5, wherein determining a plurality of target threads needed to execute the plurality of test cases based on the target resource data and the number of executions of the plurality of test cases comprises:
dividing the numerical value corresponding to the execution times of the plurality of test cases equally according to the target resource data to obtain a first numerical value;
and determining a plurality of target threads required for executing the plurality of test cases according to the first numerical value.
7. The method of claim 1, wherein after concurrently executing each test case by the plurality of target threads, the method further comprises:
and under the condition that the execution of each test case is finished, calling a data clearing service to carry out data clearing processing, and releasing the plurality of target threads after the completion of the data clearing processing is detected.
8. An automated test equipment, comprising:
the acquisition module is used for responding to a test instruction and calling a data preparation service to acquire a plurality of test data, wherein the test instruction at least comprises an acquisition rule of the plurality of test data;
the processing module is used for generating a test case corresponding to each test data according to the plurality of test data to obtain a plurality of test cases;
and the determining module is used for determining a plurality of target threads required by executing the plurality of test cases according to the execution times of the plurality of test cases, and executing each test case through the plurality of target threads, wherein each target thread executes at least one test case respectively.
9. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program is arranged to execute the automated test method according to any of the claims 1 to 7 at run-time.
10. An electronic device, the electronic device comprising one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is configured to perform the automated test method of any of claims 1 to 7 when run.
CN202310465971.2A 2023-04-26 2023-04-26 Automatic test method and device, storage medium and electronic equipment Pending CN116483723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310465971.2A CN116483723A (en) 2023-04-26 2023-04-26 Automatic test method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310465971.2A CN116483723A (en) 2023-04-26 2023-04-26 Automatic test method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116483723A true CN116483723A (en) 2023-07-25

Family

ID=87219178

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310465971.2A Pending CN116483723A (en) 2023-04-26 2023-04-26 Automatic test method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116483723A (en)

Similar Documents

Publication Publication Date Title
CN107665171B (en) Automatic regression testing method and device
CN106960143B (en) User account identification method and device, storage medium and electronic equipment
CN109815252A (en) Test data generating method, device, computer equipment and readable storage medium storing program for executing
CN108111364B (en) Service system testing method and device
CN110955409B (en) Method and device for creating resources on cloud platform
CN110795697A (en) Logic expression obtaining method and device, storage medium and electronic device
CN111310232A (en) Data desensitization method and device, electronic equipment and storage medium
CN112711398A (en) Method, device and equipment for generating buried point file and storage medium
CN115794641A (en) Method, device and equipment for making number based on business process and storage medium
CN114861218A (en) Data desensitization method and device
CN110782169A (en) Method and device for updating business process
CN112181485A (en) Script execution method and device, electronic equipment and storage medium
CN116795377A (en) Code data processing method and device
CN116737535A (en) Interface test method, device, computer equipment and storage medium
CN116483723A (en) Automatic test method and device, storage medium and electronic equipment
CN113051178A (en) Test data construction method, device, equipment and medium
CN115080401A (en) Automatic testing method and related device
CN113448985A (en) API (application program interface) interface generation method, calling method and device and electronic equipment
CN113641628A (en) Data quality detection method, device, equipment and storage medium
CN112925523A (en) Object comparison method, device, equipment and computer readable medium
CN113342647A (en) Test data generation method and device
CN111859985A (en) AI customer service model testing method, device, electronic equipment and storage medium
CN115686676B (en) Dynamic calling method and device for object and electronic equipment
CN113254328B (en) White box testing method, system, mobile terminal and storage medium
CN113342795B (en) Data checking method and device in application program, electronic equipment and storage medium

Legal Events

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