Disclosure of Invention
The embodiment of the specification aims to provide a batch automatic testing method and platform, which can realize automatic batch testing and improve the simplicity and efficiency of batch testing.
The specification provides a batch automatic test method and platform, which are realized in the following modes:
A batch automatic test method is applied to a test platform, wherein a test configuration table is stored in the test platform and at least comprises at least one test execution statement associated with a job identifier and test environment information corresponding to the test execution statement in execution, the job identifier is information for identifying a test job, the batch automatic test method comprises the steps of receiving a batch test request at least comprising a designated job identifier, the designated job identifier is information for identifying at least one test job related to the batch test request, reading the at least one test execution statement associated with the designated job identifier and the test environment information corresponding to the test execution statement in execution from the test configuration table, and executing test operation on the test job identified by the designated job identifier by utilizing the read at least one test execution statement and the read test environment information corresponding to the test execution statement in execution.
In other embodiments of the method provided in the present disclosure, in a case where the test execution statement associated with the job identifier includes two or more test execution statements, an execution order is set between the two or more test execution statements, so that the two or more test execution statements are sequentially executed based on the corresponding execution order during testing.
In other embodiments of the method provided by the specification, the test configuration table comprises a statement configuration table and an environment configuration table, wherein at least one test execution statement associated with the job identifier is stored in the statement configuration table, and test environment information corresponding to the execution statement in execution is stored in the environment configuration table.
In other embodiments of the method provided by the specification, the test environment information stored in the environment configuration table is identified by using a test environment identifier, and the test execution statement includes the test environment identifier of the test environment information corresponding to the execution.
In other embodiments of the method provided in the present disclosure, the test environment information includes at least an environment type, so as to connect, when executing a test execution statement, a test environment corresponding to the test environment information based on an environment connection program corresponding to the environment type.
In other embodiments of the methods provided herein, the test configuration table further includes an assertion statement associated with the job identifier, the assertion statement being configured to verify an execution result of the corresponding test execution statement after execution of the test execution statement is completed.
In other embodiments of the method provided herein, the test configuration table further includes a storage address and a transfer address for the test data file associated with the job identification to copy the test data file required for testing from the storage address to the transfer address at the time of testing.
On the other hand, the specification also provides a batch automatic testing device which is applied to a testing platform, wherein a testing configuration table is stored in the testing platform, the testing configuration table at least comprises at least one testing execution statement and testing environment information corresponding to the testing execution statement in an operation identification mode, the operation identification mode is information for identifying testing operation, the device comprises a receiving module and a reading module, the receiving module is used for receiving batch testing requests, the batch testing requests at least comprise designated operation identification, the designated operation identification mode is information for identifying at least one testing operation related to the batch testing requests, the reading module is used for reading the at least one testing execution statement and the testing environment information corresponding to the testing execution statement in the operation identification mode from the testing configuration table, and the executing module is used for executing testing operation on the testing operation identified by the designated operation identification mode by means of the at least one testing execution statement and the testing environment information corresponding to the testing execution statement in the operation identification mode.
In other embodiments of the device provided by the specification, the test configuration table comprises a statement configuration table and an environment configuration table, wherein at least one test execution statement associated with the job identifier is stored in the statement configuration table, and test environment information corresponding to the execution statement in execution is stored in the environment configuration table.
In another aspect, the present disclosure also provides a test platform, the platform including at least one processor and a memory for storing processor-executable instructions that, when executed by the processor, implement the steps of the method in any one or more of the embodiments described above.
According to the batch automatic test method and the batch automatic test platform provided by one or more embodiments of the present disclosure, by configuring test execution statements, test environment information and the like into the test configuration table in advance, in the test process, the test platform can automatically execute batch test operations based on the test configuration table, so that the simplicity and the execution efficiency of batch test are improved. Based on the form of the test configuration table, maintenance and modification of test execution sentences, test environment information and the like can be performed more intuitively, and the convenience of test personnel in executing test operation is greatly improved.
Detailed Description
In order that those skilled in the art will better understand the technical solutions in this specification, a clear and complete description of the technical solutions in one or more embodiments of this specification will be provided below with reference to the accompanying drawings in one or more embodiments of this specification, and it is apparent that the described embodiments are only some embodiments of the specification and not all embodiments. All other embodiments, which may be made by one or more embodiments of the disclosure without undue effort by one of ordinary skill in the art, are intended to be within the scope of the embodiments of the disclosure.
In the scenario examples provided in the present specification, the batch automated testing method may be applied to a testing platform, where the testing platform may include a server, a database, and the like. When a test requirement exists, a tester can fill in the test requirement information in the terminal equipment. The tester can select or input the job identification, the test execution time and the like of the test job of the current batch test. The terminal equipment can initiate batch test requests according to the test requirement information input by the testers and send the batch test requests to the test platform. The test platform may perform an automated batch test based on the batch test request. Of course, the test trigger mechanism may be configured on the test platform or other platforms that interact with the test platform, and after the test trigger mechanism is satisfied, a batch test request may be generated, and the test platform may perform batch tests based on the batch test request. Alternatively, other test initiation methods may be used, which are not limited herein.
The test platform may have a test configuration table stored therein. The test configuration table may include at least one test execution statement associated with the job identifier and test environment information corresponding to the test execution statement when executed.
For example, the table specification of the test configuration table may be designed in advance as needed. Such as the table type of the test configuration table, the fields contained in the table, the information format of the field information under each field, etc., may be designed. The test configuration table may include, for example, at least a job identification field, a test execution statement field, an environment information field, an assertion statement field, and so forth. Of course, the tester may also call up the test configuration table used before, multiplex the table specification of the test configuration table, or make appropriate adjustments to the table specification of the test configuration table.
The tester can input test execution sentences corresponding to the test jobs and corresponding test environment information when the test execution sentences are executed in the test configuration table according to the test requirements, and input job identifications of the corresponding test jobs in a correlated mode. The test environment information may include a database environment, a server environment, etc. Such as server IP address, port, username, password, etc.
In the case that the test execution statement associated with the job identifier includes more than two test execution statements, an execution sequence may be further set between the more than two test execution statements, so that the test execution statements are sequentially executed based on the corresponding execution sequences during testing, and the corresponding test job is efficiently and accurately completed. Correspondingly, if the test configuration table can be accessed by a pre-constructed test analysis program, the test execution statement under each job identifier and the corresponding test environment information when the test execution statement is executed are read, and the test is completed. If the test analysis statement can be configured to read and analyze the test execution statement under a certain job identifier in sequence, batch test is automatically completed.
Or in the case that the test execution statement associated with the job identification includes more than two test execution statements, each test execution statement may be configured with a test execution statement identification. Correspondingly, the execution mode of each test execution statement mark can be configured in the test analysis program, and the execution mode can comprise the execution sequence of each test execution statement mark and the like, so that the test analysis program orderly reads and analyzes the test execution statement from the test configuration table, and batch test is automatically completed
The test execution statement and the test environment information corresponding to the test execution statement during execution can be respectively configured through two tables. Accordingly, the test configuration table may include a statement configuration table and an environment configuration table. At least one test execution statement associated with a job identification may be stored in the statement configuration table. The environment configuration table may store test environment information corresponding to the execution of the test execution statement. The test environment information stored in the environment configuration table can be identified by using a test environment identifier, and the test execution statement can correspondingly comprise the test environment identifier of the corresponding test environment information during execution.
The batch operation sometimes involves a plurality of databases and servers, and the test environment information corresponding to the test execution statement is directly configured into the test execution statement, so that the writing of the test execution statement is complicated, and the test execution statement is difficult to check and modify in case of errors. Meanwhile, if the test environment information is configured into the configuration file in the test analysis program, if the actual environment is changed, the configuration file of the program is also required to be modified one by one, so that the execution efficiency of batch operation is indirectly affected. In the scene example, the test environment information is configured into a table independently, and the test environment information corresponding to the test execution statement and the associated test execution statement is identified by using the test environment, so that the simplicity of writing the test execution statement and modifying the test environment information can be greatly improved, and the accuracy of connecting the test execution statement and the test environment information corresponding to the test execution statement is improved.
The test environment information at least can comprise an environment type, so that when a test execution statement is executed, the test environment corresponding to the test environment information is connected based on an environment connection program corresponding to the environment type. The environment connection modes corresponding to different test environments may have larger differences, and the simplicity and the accuracy of the test connection can be greatly improved by configuring different connection programs for different test environments. Table 1 is an example table of test environment information. Table 2 is an example table of test execution statements.
TABLE 1
TABLE 2
The test configuration table may further include an assertion statement associated with the job identifier, which may be used to verify an execution result of the corresponding test execution statement after execution of the test execution statement is completed. By further configuring the assertion statement, after the execution of the test execution statement is completed, whether the test execution statement is normally executed or not is judged, and therefore each link of the whole execution process can be effectively monitored from the code layer, and the test execution statement with errors can be conveniently and rapidly positioned accurately when the test execution is in error. And the test execution statement is configured in the test configuration table, so that a tester can conveniently modify and perfect the error test execution statement after positioning the error test execution statement, the checking and adjustment of the execution program in the batch test process are greatly improved, and the efficient operation of the batch test is effectively and simply realized.
For example, the execution modes of the test execution statement and the assertion statement may be configured in the test parsing statement. The execution manner may include, for example, testing whether the execution statement is executed after the execution of the execution statement is completed, which assertion statements are executed, when to execute the assertion statement, and so on. By configuring the assertion statement also to the test configuration table, the ease of automatic test execution can be further improved. Alternatively, a test execution statement flag of the test execution statement may be configured in the assertion statement to determine an association relationship between the assertion statement and the test execution statement based on the test execution statement flag. By configuring the association relation between the assertion statement and the test execution statement in the test configuration table, a tester can more intuitively check and modify the association relation between the test execution statement and the assertion statement, and the test maintenance simplicity is improved.
Preferably, the statement configuration table can be designed by using the table specification as shown in fig. 1, and the test execution statement configuration and the later maintenance simplicity can be improved by the way of separately configuring the test execution statement at different stages in the execution process.
The tester can upload the test data files related in the test process to the appointed position of the test platform for storage in advance. And the storage address and the transfer address of the test data file are input into the test configuration table. The transfer address refers to the location to which the test data file is transferred when the test is executed. Before configuring the information, a tester can also clean the records affecting the judgment of the batch execution result, so as to ensure the influence of other irrelevant data on the test.
After the tester configures the test configuration table according to the above embodiment, the terminal device may send the configured test configuration table to the database of the test platform for storage. The tester can also input test requirement information and trigger test starting operation in the terminal equipment, and the terminal equipment can generate batch test requests according to the trigger and send the batch test requests to the test platform. The test request may include, for example, a specified job identifier corresponding to the current test job.
The test platform may invoke the test parsing program according to the test request, so that the test parsing program reads and parses the test execution statement corresponding to the specified job identifier from the test configuration table, as shown in fig. 2. FIG. 2 is a flow chart of the reading and parsing of test execution statements. The test resolution program may also read test environment information based on the test environment identification in the test execution statement. The test analysis program may also call a corresponding environment connection program based on the environment type in the test environment information, so as to connect the environment corresponding to the test environment information based on the called environment connection program. Such as a data table to which a database may be connected or a connection server, etc. FIG. 3 is a flow chart showing the reading of test environment information and the connection of test environment. In the test execution process, the test analysis program can also read and analyze the assertion statement, and judge whether the test execution is correct or not by utilizing the assertion statement, so as to complete the execution of the whole automatic test case.
According to the scene example, the test execution statement, the test environment information, the assertion statement and the like are configured into the test configuration table in advance, and in the test process, the test platform can automatically execute batch test operation based on the test configuration table, so that the convenience and the execution efficiency of batch test are improved. Based on the form of the test configuration table, maintenance and modification of test execution sentences, test environment information, assertion sentences and the like can be performed more intuitively, and the convenience of test personnel in executing test operation is greatly improved.
An application of batch testing using an SQL+SHELL statement is described below.
Before execution, testers can modify batch existing date records in the database to finish operation dependence. And cleaning the past batch logs and preparing the data files.
When the method is executed, batch job execution can be performed by using the test analysis program. The shell script can be directly called for testing in the test.
After execution, judging the loading log of the data file. And judging batch records of the database.
The above process can be automated and simplified to:
Database operations (add, delete, change), server operations (delete files, add files) before execution.
During execution, the server operates (executes shell script).
After execution, the statement (database query, log query is executed in the server) is asserted.
The test execution statement is the addition, deletion, modification and check of the database, and the shell script and command line of the server. Accordingly, the test execution statements of database and server statements may generally be of the types of add, INSERT, DELETE, modify, UPDATE, query, SELECT, SHELL script file, sh$dir/filename. Sh, command line statement, rm, cp, and the like. For example, executing an UPDATE statement in an OS1 environment writes OS1: UPDATE. Executing the rm command in the LS1 environment, LS1: rm..
The test execution statement may be configured in the statement configuration table based on the statement type described above. The test environment identifier in the statement configuration table is consistent with the test environment identifier corresponding to each test environment in the environment configuration table, so that the corresponding test execution statement is executed in the environment corresponding to the test environment identifier. The database and server statement execution flow is shown in fig. 4.
The assertion statement may include an assertion execution statement, a target result acquisition statement, a comparison judgment statement, and the like. The assertion execution statement corresponding to the database is mainly a query of results by SELECT, and then the query results are compared with preset target results. The corresponding assertion execution statement of the server mainly screens out the error reporting information of the corresponding batch execution log, and then compares the screened error reporting information with a preset target result. If the database results are queried, the results queried by the query (OS 1: select..= VALUE) are true. If the execution log is judged that the value queried by the ASSERT (LS 1: cat/DIR/LOGFILE |grep., |=, RESULT) is true. The execution flow of the assertion statement is shown in fig. 5.
Compared with the mode of directly writing test case codes, the framework for batch automatic testing provided by the embodiment is easier to write and maintain test cases, can be frequently used after being written once, is operated by one key, and reduces the workload of testers. And the test execution statement and the test environment configuration are simpler and more visual, the modification and the variation are convenient, and the influence of the environment variation on the test program execution is reduced. And the method is easy to develop, and for batch types with other operations, only the corresponding code specifications are expanded and added into the table.
Based on the above scenario examples, the present embodiment of the present disclosure provides a batch automated testing method, as shown in fig. 6. FIG. 6 is a flow diagram of one embodiment of a batch automated testing method provided herein. The method can be applied to a test platform, a test configuration table is stored in the test platform, the test configuration table at least comprises at least one test execution statement associated with a job identifier and test environment information corresponding to the execution of the test execution statement, and the job identifier is information for identifying a test job. The method may comprise the following steps.
S602, receiving a batch test request, wherein the batch test request at least comprises a designated job identifier, and the designated job identifier refers to information for identifying at least one test job related to the batch test request.
S604, reading at least one test execution statement associated with the specified job identification from the test configuration table, and testing environment information corresponding to the execution of the test execution statement.
S606, executing test operation on the test job identified by the designated job identification by using the read at least one test execution statement and the test environment information corresponding to the execution of the test execution statement.
In other embodiments, in the case that the test execution statement associated with the job identifier includes more than two test execution statements, an execution order is set between the more than two test execution statements, so that the test execution statements are sequentially executed based on the corresponding execution order during testing.
In other embodiments, the test configuration table includes an execution statement configuration table and an environment configuration table, wherein at least one test execution statement associated with the job identifier is stored in the execution statement configuration table, and test environment information corresponding to the execution of the test execution statement is stored in the environment configuration table.
In other embodiments, the test environment information stored in the environment configuration table is identified by a test environment identifier, and the test execution statement includes the test environment identifier of the test environment information corresponding to the execution.
In other embodiments, the test environment information includes at least an environment type, so that when executing the test execution statement, the test environment corresponding to the test environment information is connected based on the environment connection program corresponding to the environment type.
In other embodiments, the test configuration table further includes an assertion statement associated with the job identifier, where the assertion statement is configured to verify an execution result of the corresponding test execution statement after execution of the test execution statement is completed.
In other embodiments, the test configuration table further includes a storage address and a transfer address of the test data file associated with the job identification to copy the test data file required for the test from the storage address to the transfer address at the time of the test.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. Specific reference may be made to the foregoing description of related embodiments of the related process, which is not described herein in detail.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Based on the method provided by the embodiment, the embodiment of the specification also provides a batch automatic testing device which is applied to a testing platform, wherein a testing configuration table is stored in the testing platform, the testing configuration table at least comprises at least one testing execution statement associated with a job identifier and testing environment information corresponding to the execution of the testing execution statement, and the job identifier is information for identifying a testing job. As shown in FIG. 7, the apparatus may include a receiving module 702 configured to receive a batch test request, where the batch test request includes at least a specified job identifier, where the specified job identifier is information for identifying at least one test job related to the batch test request, a reading module 704 configured to read, from the test configuration table, at least one test execution statement associated with the specified job identifier and test environment information corresponding to the test execution statement when the test execution statement is executed, and an executing module 706 configured to execute a test operation on the test job identified by the specified job identifier using the read at least one test execution statement and the test environment information corresponding to the test execution statement when the test execution statement is executed.
It should be noted that the above-mentioned device according to the above-mentioned embodiment may also include other embodiments. Specific implementation may refer to descriptions of related method embodiments, which are not described herein in detail.
The present specification also provides a test platform which may include at least one processor and a memory for storing processor-executable instructions which, when executed by the processor, implement steps comprising the method of any one or more of the embodiments described above. The memory may include physical means for storing information, typically by digitizing the information before storing it in an electrical, magnetic or optical medium. The storage medium may include devices for storing information using electric energy such as various memories, e.g., RAM, ROM, etc., devices for storing information using magnetic energy such as hard disk, floppy disk, magnetic tape, magnetic core memory, bubble memory, usb disk, and devices for storing information using optical means such as CD or DVD. Of course, there are other ways of readable storage medium, such as quantum memory, graphene memory, etc.
It should be noted that the embodiments of the present specification are not limited to the case where the standard data model/template is met or described in the embodiments of the present specification. Some industry standards or embodiments modified slightly based on the implementation described by the custom manner or examples can also realize the same, equivalent or similar or predictable implementation effect after modification of the above examples. Examples of data acquisition, storage, judgment, processing, etc., using these modifications or variations are still within the scope of alternative embodiments of the present description.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments. In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present specification. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.