CN114780419A - Batch measuring range sequence testing method and device and electronic equipment - Google Patents

Batch measuring range sequence testing method and device and electronic equipment Download PDF

Info

Publication number
CN114780419A
CN114780419A CN202210460014.6A CN202210460014A CN114780419A CN 114780419 A CN114780419 A CN 114780419A CN 202210460014 A CN202210460014 A CN 202210460014A CN 114780419 A CN114780419 A CN 114780419A
Authority
CN
China
Prior art keywords
batch
tested
execution
parameter file
nodes
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
CN202210460014.6A
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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210460014.6A priority Critical patent/CN114780419A/en
Publication of CN114780419A publication Critical patent/CN114780419A/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
    • 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/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a batch measuring sequence testing method, a device and electronic equipment, which utilize preset parameter files and user parameters configured in advance to sequentially execute initialization SQL and embedded quantity SQL on each batch node to be tested involved in the running of a batch program to be tested, and execute output verification SQL on each batch node to be tested under the condition of finishing execution, thereby realizing the check of a test execution result and a corresponding expected value and further realizing the automatic testing of the batch program to be tested. According to the invention, the universal test case format which can be acquired and executed by a machine is designed for different batch programs, wherein the test cases comprise the preset parameter files and the user parameters, so that the accuracy and the test efficiency of the batch program test are improved, and the application range of the batch program test method is expanded. In addition, by designing an interactive interface for users to upload data files, the configurability of data required by the test is enhanced, and the applicability of the batch program test method is further improved.

Description

Batch measuring range sequence testing method and device and electronic equipment
Technical Field
The invention relates to the field of testing, in particular to a batch sequencing test method and device and electronic equipment.
Background
The batch business is generally a business processed uniformly in a large batch by a bank system, and has the characteristics of large data volume to be processed, similar processing logic of similar businesses and the like, and different batch businesses often have relatively independent functions. In order to implement different business functions, banks often process such batch businesses by developing corresponding batch programs, so as to implement the functions of running a batch program once and processing a large number of businesses at one time. When a batch program is operated, a large amount of batch processing is carried out on database table data, the processed data volume is large, the function of the batch program is mainly embodied in the data change of the database table, so that more resources are generally consumed, longer time is occupied, and in order not to influence the processing of foreground online business, the batch program is often operated in the background and is a part of bank background programs. Before a batch program is put into use, the function of the batch program needs to be tested.
Current batch program testing is primarily a test that is performed manually by a tester. Because the manual processing capability is limited, and batch programs generally have the characteristics of large data processing amount, complex data processing logic and the like, the process of manually preparing test data and verifying test results needs to consume a large amount of time to prepare a large amount of data and check a large amount of data table field values, the manual execution pressure is large, in addition, the check of the test results is difficult, and the efficiency and the accuracy of the test are seriously influenced.
Disclosure of Invention
In view of this, the invention provides a batch program testing method, a batch program testing device and an electronic device, which are used for solving the problem of low testing efficiency and accuracy caused by manual batch program testing. The specific scheme is as follows:
a batch sequencing test method, comprising:
acquiring user parameters and an initial preset parameter file, wherein the user parameters comprise batch node information to be detected and data table configuration information, and the initial preset parameter file comprises an initialization SQL parameter file, a buried SQL parameter file and an output verification SQL parameter file;
respectively configuring the initial preset parameter files according to the data table configuration information to generate configured preset parameter files;
for each batch node to be tested, sequentially analyzing the initialized SQL parameter file and the embedded SQL parameter file in the preset parameter file after configuration, if the analysis operation of any parameter file fails to be executed, setting the execution state of the batch node to be tested to be completed and the batch node to be tested fails to be executed, and if the analysis operations of the two parameter files are both successfully executed, setting the execution state of the batch node to be tested to be completed and the batch node to be tested to be successfully executed;
obtaining the execution state of the nodes in batches to be tested;
and under the condition that the execution states of the batch nodes to be tested are all completed, acquiring the execution results of the batch nodes to be tested, respectively executing the operation of analyzing the output verification SQL parameter file in the preset parameter file after configuration on the execution results of each batch node to be tested, verifying the execution results of the batch nodes to be tested, and determining the test results according to the execution results and the verification results of the batch nodes to be tested.
Optionally, the generating the configured preset parameter file includes:
acquiring an accounting date under the condition that the data table configuration information is a use data table, acquiring a corresponding data table according to the accounting date, sequentially acquiring the line number of the preset parameter file for each initial preset parameter file, and replacing corresponding data in the preset parameter file by using data in the data table line by line according to the line number;
and setting the initial preset parameter file as the configured preset parameter file under the condition that the data table configuration information does not use the data table.
Optionally, the method for obtaining the execution state of the batch of nodes to be tested includes:
and calling a batch scheduling system to query the execution state of the nodes to be tested, and when the query result shows that the execution state of any node to be tested is incomplete, the batch scheduling system repeatedly queries the execution state of the nodes to be tested by taking a preset interval as a period.
Optionally, in the foregoing method, the user parameter further includes a batch execution state interval;
the preset interval is the refresh batch execution state interval specified by the user to the batch scheduling system.
Optionally, the method includes, as an execution result of the batch of nodes to be tested:
and the start-stop time, the information of whether the execution fails or not and the execution result of each operation instruction of the nodes in the batch to be tested.
Optionally, in the method, the executing the operation of analyzing the output verification SQL parameter file in the configured preset parameter file includes:
and acquiring a field name to be checked and an actual value corresponding to the field name in the execution result of the batch of nodes to be tested, and checking whether the actual value is consistent with a corresponding expected value to determine the checking result of the field name.
Optionally, in the method described above, the obtaining user parameters includes receiving user parameters input by a user through an interactive interface of the foreground;
the acquiring of the initial preset parameter file comprises receiving the initial preset parameter file uploaded by a user through an interactive interface of a foreground.
A batch sequencing test device, comprising:
the system comprises a data acquisition unit, a data processing unit and a data processing unit, wherein the data acquisition unit is used for acquiring user parameters and an initial preset parameter file, the user parameters comprise batch node information to be detected and data table configuration information, the initial preset parameter file comprises an initialization SQL parameter file, a buried SQL parameter file and an output verification SQL parameter file, and the initial preset parameter file is respectively configured according to the data table configuration information so as to generate a configured preset parameter file;
the test execution unit is used for sequentially executing the operation of analyzing the initialized SQL parameter file and the embedded SQL parameter file in the configured preset parameter file for each batch node to be tested, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested to be failed if the analysis operation execution of any parameter file fails, and setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested to be successful if the analysis operations of the two parameter files are both successfully executed;
the state acquisition unit is used for acquiring the execution state of the nodes in the batch to be tested;
and the result determining unit is used for acquiring the execution results of the to-be-tested batch nodes under the condition that the execution states of the to-be-tested batch nodes are all completed, respectively executing the operation of analyzing the output verification SQL parameter file in the configured preset parameter file for the execution results of the to-be-tested batch nodes so as to verify the execution results of the to-be-tested batch nodes, and determining the test result according to the execution results and the verification results of the to-be-tested batch nodes.
An electronic device, comprising:
the processor is used for executing instructions to realize the batch program test method;
a memory for storing instructions executable by the processor and callable data;
and the interactive interface is used for a user to input data and upload files, receive the data and the files and store the data and the files in the memory for the processor to call, and output the test result determined by the processor.
Compared with the prior art, the invention has the following advantages:
the test cases of the batch program can be automatically executed by writing the initialization SQL parameter file, the embedded number SQL parameter file, the output verification SQL parameter file and the necessary user parameters input by a user in advance, which can be acquired and analyzed by terminals such as a processor and the like, and generating a test result after the test execution is finished, so that the automatic test of the batch program is realized, and the test efficiency is improved compared with that of a manual test; meanwhile, the processor undertakes the task of checking and verifying the test result, so that the possibility of manual misjudgment is avoided, and the test accuracy is improved.
In addition, by designing the interactive interface, the user can realize the custom configuration of the preset parameter file and the user parameter, and the applicability of the test method to different batches of programs is improved. Specifically, a user can compile and upload parameter files and input corresponding user parameters through an interactive interface according to the batch program to be tested, so that different batch programs, including but not limited to the test of the batch program to be tested with a feasible batch program basis, can be tested.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of an initialized SQL parameter file disclosed in the embodiment of the present invention;
FIG. 2 is a schematic diagram of a buried SQL parameter file according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an output verification SQL parameter file according to the embodiment of the present invention;
fig. 4 is a schematic diagram of a foreground page for uploading a parameter file according to an embodiment of the present invention;
FIG. 5 is a diagram of a foreground page for inputting user parameters disclosed in an embodiment of the present invention;
FIG. 6 is a flowchart of a batch sequencing test method according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a test result verification report according to an embodiment of the present invention;
FIG. 8 is a block diagram of a batch sequencing test apparatus according to an embodiment of the present disclosure;
fig. 9 is a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
The current testing process includes preparing test data, performing tests, and verifying test results, and furthermore, requires multiple testing runs for each version of the batch program, and requires regression testing for various testing requirements. The inventor finds that a large number of repeated operations exist in each test process, and the possibility is provided for realizing batch program automatic test. Based on the idea of batch program automatic test, a reference batch program test template and a batch program test template to be tested can be developed for individual specific batch programs to be tested, and by operating the two test templates and comparing the two operation results, a tester can analyze whether the batch programs to be tested meet the use requirements or not through the comparison result. The method improves the testing efficiency of individual specific batch programs to a certain extent, but the obtaining of the testing result still depends on the judgment of testing personnel, and the automation degree is not high. In addition, the test of the batch program to be tested depends on the reference batch program, so the method is mainly suitable for testing the batch program obtained by modifying the existing batch program, and has a small application range. Furthermore, since the running test template is a template that can be automatically obtained and automatically executed by a machine, and at least one corresponding test template needs to be re-developed for different batch programs to be tested, the repeated development pressure is large and the test cost is high.
In order to solve the above problems, an embodiment of the present invention discloses a batch sequencing test method, in which a relatively universal test case format is designed for different types of batch programs, and the format is applicable to testing of a large number of background batch programs of banks, and certainly can also be used for batch program testing in other application scenarios.
The batch program testing method disclosed by the embodiment of the invention can be realized by depending on different program languages in different testing environments. Illustratively, this can be accomplished by invoking the execution of JMeter script. JMeter is a Java-based open source testing tool that can perform a function/regression test on an application to verify whether the application returns the desired result by creating a script with an assertion.
The embodiment of the invention discloses a batch measuring order testing method, which provides a relatively universal test case format for different types of batch programs, wherein the test case consists of an initial preset parameter file and an input user parameter, the initial preset parameter file comprises an initial initialization SQL parameter file, a buried SQL parameter file and an output verification SQL parameter file, and the three parameter files are all parameter files which can be acquired and analyzed by a processor and the like so as to realize corresponding functions. The parameter file may be in comma-separated value file format, i.e. the extension of the file is csv. The initial preset parameter file specifically comprises the following components:
and initializing the SQL parameter file, and executing the initialization SQL under the condition of being analyzed so as to return the test data to the initial state. The initialized SQL parameter file can comprise a plurality of SQL sentences, each SQL sentence uses an English semicolon, adjacent SQL sentences use carriage return and line change, and the SQL sentences at least comprise one of update, delete or truncate sentences. Illustratively, an initialization SQL parameter file is shown in FIG. 1.
And the embedded SQL parameter file executes the embedded SQL under the condition of being analyzed to finish the data embedding test. The embedded SQL can use at least one of the equivalent class division, boundary value analysis, error speculation and other test case design methods. The embedded SQL parameter file can comprise a plurality of SQL sentences, each SQL sentence is followed by an English semicolon, and the adjacent SQL sentences are lined by carriage return, wherein the SQL sentences are insert sentences. Illustratively, a buried SQL parameter file is shown in FIG. 2.
And outputting the verification SQL parameter file, and executing the output verification SQL under the analyzed condition to finish the comparison and judgment of the actual value and the expected value of each field to be checked. The output verification SQL parameter file comprises at least one SQL statement, return line changing is used between adjacent SQL statements, each SQL statement comprises three parameters which are respectively: the output _ SQL parameter is used for writing output verification SQL, the output verification SQL statement is a select statement, and a select statement obtains a query return record, namely a query result, and the output verification SQL statement uses English semicolons; an output _ con parameter, configured to write a field name of a field to be checked in the query result, for example, COLUMN _1, or an SQL function name, for example, CONUT (—), where a corresponding field value is a calculation result of the function, the output _ con parameter may include at least one field name, adjacent field names are followed by an english comma, and a last field name is followed by an english semicolon; the output _ res parameter is used to write a field value of a field to be checked in the query result, where the field value is an actual value, the output _ res parameter may include at least one field value, an english comma is used after adjacent field values, and the field values are sequentially arranged in a one-to-one correspondence with the field names in the output _ con parameter. Illustratively, an output validation SQL parameter file is shown in FIG. 3.
In an exemplary application scenario of a bank background, the user parameters at least include a JMeter root directory, a JMeter script name, an operation plan number, a node number, an application database URL, an application database JDBC driver class, an application database user name, an application database user password, a batch scheduling system database URL, a batch scheduling system database JDBC driver class, a batch scheduling system database user name, a batch scheduling system database user password, whether an AB list is involved, an operation mode, a batch execution refresh status interval, and the like.
The initial preset parameter file written by the tester and the input necessary user parameters can be associated with the device for executing the test through an interactive interface. Illustratively, in an application scenario where a bank background realizes a test by relying on a JMeter script, the interactive interface may be a foreground page, and the specific association conditions are as follows: uploading the programmed preset parameter file to a server where the device is located through an uploading parameter file foreground page of the foreground page as shown in fig. 4, and inputting the necessary user parameter through an inputting user parameter foreground page of the foreground page as shown in fig. 5 and transmitting the necessary user parameter to a corresponding variable value in the JMeter script.
For example, in an application scenario where testing is implemented by relying on a JMeter script, the function of the interactive interface is not only embodied in the stage of acquiring test data, but also embodied in: the batch program test can be started by a user through the interactive interface, for example, the user clicks a 'start building' button on the interactive interface to start the test; the foreground page can output the execution log of the JMeter script, display the running condition of the script and facilitate debugging and troubleshooting of problems occurring in script execution.
In order to better explain the batch program testing method disclosed by the present invention, the execution flow of the batch program testing method implemented by means of the JMeter script is described in detail below, and the flow is shown in fig. 6 and includes the following steps:
s601: acquiring user parameters and an initial preset parameter file, wherein the user parameters comprise batch node information to be detected and data table configuration information, and the initial preset parameter file comprises an initialization SQL parameter file, a buried SQL parameter file and an output verification SQL parameter file; respectively configuring the initial preset parameter files according to the data table configuration information to generate configured preset parameter files;
the user parameters and the initial preset parameter file are stored in a memory which can be called before the test is executed, and the user parameters can be obtained from a user through an interactive interface or can be stored in a memory space which can be called in advance; the node information of the batch to be tested comprises at least one node number of the batch to be tested, and the number of the nodes of the batch to be tested is required to be obtained in a data obtaining stage and determines the number of times of subsequent test operation; the data table configuration information may be information on whether the running program needs to be related to a data table, and the data table may be data that needs to be utilized in a test data preparation stage, data that needs to be utilized in a test result verification stage, or the like.
In this step, obtaining the user parameters includes: receiving and storing user parameters input by a user through an interactive interface;
the acquiring of the initial preset parameter file includes: and receiving and storing an initial preset parameter file uploaded by a user through an interactive interface.
The interactive interface is a component of equipment for realizing the batch program testing method, and at least undertakes the tasks of providing a data input interface for a user, receiving and storing data from the user, and enabling the user to start testing and output a testing result under the condition that the user parameters and the initial preset parameter file are input by the user through the interactive interface.
Under the condition that data do not need to be acquired through an interactive interface, the interactive interface can exist and at least undertakes the tasks of starting the test and outputting the test result for the user; the interactive interface can also be absent, so that an instruction source for starting the test is provided through the input equipment, and the function of outputting the test result is realized through the output equipment.
In a possible implementation manner, the generating the initial preset parameter file includes:
acquiring an accounting date under the condition that the data table configuration information is a use data table, acquiring a corresponding data table according to the accounting date, sequentially acquiring the line number of the preset parameter file for each initial preset parameter file, and replacing corresponding data in the preset parameter file by using data in the data table line by line according to the line number;
and setting the initial preset parameter file as the configured preset parameter file under the condition that the data table configuration information does not use a data table.
The accounting date is obtained because the data table required by the test is a partial data table corresponding to the required accounting date in a complete data table; in the subsequent operations, whenever any preset parameter file is required, the configured preset parameter file is called, and although the configured preset parameter file may be the same as the corresponding initial preset parameter file in content, the configured preset parameter file is not the initial preset parameter file.
In one possible implementation, the process of acquiring an accounting date and acquiring a data table corresponding to the accounting date includes:
sending an HTTP request to a specific microservice address; and receiving a response message of the HTTP request, wherein the response message comprises the required internal parameters. For example, in an application scenario of a bank background, the data table may be an AB table, and the internal parameters include an accounting date and the AB table; and acquiring an AB table of a corresponding date according to the accounting date, namely the AB table is a required data table.
Wherein, the acquiring the line number of the preset parameter file comprises: analyzing the preset parameter file to obtain a corresponding line number, determining by the line number, and under the condition that the configuration information of the data table is a use data table, using the data table to replace the times of the preset parameter file, wherein the times are represented by the cycle times of replacing related instructions on program codes.
In general, S601 is to obtain data required for testing, and it should be noted that the testing cannot be performed correctly in the absence of any of the required data. Therefore, in S601, if any data fails to be acquired, the test fails, and the script is executed.
Any data acquisition failure described in this embodiment may be: and judging that any user parameter is empty, failing to send the HTTP request, failing to receive a response message of the request or incomplete information of the response message, failing to analyze any initial preset parameter file, and the like.
S602: for each batch node to be tested, sequentially analyzing the operation of initializing the SQL parameter files and embedding the SQL parameter files in the preset parameter files after configuration, if the analysis operation of any parameter file fails to be executed, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested fails, and if the analysis operations of the two parameter files are both successfully executed, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested to be successful;
for any batch node to be tested, the starting point of the execution time can be the time for starting the test of the batch program to be tested; under the condition that the test data acquisition is performed uniformly, that is, for different batch nodes to be tested, S601 is performed simultaneously, after S601 is completed, each batch node to be tested starts to execute various operations of the node, and the starting time of the execution may also be the time of completion of S601.
For any one of the nodes in the batch to be detected, the executed time endpoint is the time when the execution of the node in the batch to be detected is finished, and the execution completion may correspond to a situation that all operations on the node in the batch to be detected are executed completely, or a situation that the execution of any operation on the node in the batch to be detected fails, that is, the execution state of the node is set to be completed, so the executed time endpoint may also be expressed as the time when the execution of the node in the batch to be detected is completed.
In S602, a step of deleting an unnecessary execution operation result may be further included. The deletion operation is to realize repeated tests of batch programs without human intervention, thereby improving the automation degree of the tests. Whether the deletion operation is executed or not in the execution process of one test has no influence on the correct obtaining of the test result.
In a possible implementation manner, the specific steps of the deletion operation are:
and executing operation of deleting unnecessary execution results for each batch node to be tested, wherein the unnecessary execution results comprise execution results before the batch node to be tested on the test day.
In another possible implementation manner, the specific steps of the deletion operation are as follows:
and deleting unnecessary execution result operation under the condition that the execution states of all the batch nodes to be tested are finished, wherein the unnecessary execution result comprises the execution result before all the batch nodes to be tested on the test day.
The two modes trigger different time points for execution, and a corresponding deleting mode can be selected according to specific test requirements.
If the deleting operation fails to be executed, at least a warning signal indicating that the operation is failed to be executed is output, and the next test is not performed even if the warning signal is not eliminated.
S603: obtaining the execution state of the nodes in batches to be tested;
the execution state is information of whether the execution of the batch node to be tested is completed or not, and there are two cases of completion and incomplete execution.
Optionally, the obtaining the execution state of the batch of nodes to be tested includes:
and calling a batch scheduling system to query the execution state of the nodes to be tested, and when the query result shows that the execution state of any node to be tested is incomplete, the batch scheduling system repeatedly queries the execution state of the nodes to be tested by taking a preset interval as a period.
The specific state query is realized by circularly executing an SQL statement on each to-be-tested batch node, wherein the SQL statement is a select statement.
Of course, the query of the execution state of each batch node to be tested may also be directly performed without calling the batch scheduling system, for example, a script.
In addition, the execution state of the batch of nodes to be tested can be obtained by the following steps: when the execution of all the nodes in the batch to be tested is finished, a finishing signal is output, and the script determines whether the nodes in the batch to be tested are completely executed or not by counting the number of the finishing signal and comparing the number with the number of the nodes in the batch to be tested.
In a possible implementation manner, the user parameter further includes a refresh batch execution state interval; the preset interval is the refresh batch execution state interval specified by the user to the batch scheduling system.
The refresh batch execution state interval is the minimum value of the preset interval; if the preset interval is smaller than the interval of the batch execution state refreshing, repeated query of two identical execution states can occur during query, and the subsequent query is meaningless. Of course, the preset time may be a value slightly larger than the refresh batch execution state interval, but is not too large as much as possible because the too large preset interval prolongs the state query time, which may cause unnecessary test time prolongation and adversely affect the test efficiency.
S604: and under the condition that the execution states of the nodes in the batches to be tested are all completed, acquiring the execution results of the nodes in the batches to be tested, respectively executing the operation of analyzing the output verification SQL parameter file in the preset parameter file after configuration on the execution results of the nodes in the batches to be tested, verifying the execution results of the nodes in the batches to be tested, and determining the test results according to the execution results and the verification results of the nodes in the batches to be tested.
In a possible implementation manner, the execution result of the batch of nodes to be tested includes:
and the start-stop time, the information of whether the execution fails or not and the execution result of each operation instruction of the nodes in the batch to be tested.
The purpose of obtaining the batch nodes to be tested is mainly two, namely output display and subsequent calling and query, for example: the start-stop time of the nodes of the batch to be tested is mainly acquired for output display, the information about whether the execution fails or not is acquired for output display and subsequent call query under the condition of requirement, and the execution result of each operation instruction is mainly acquired for subsequent call query.
In one possible implementation manner, S604 further includes:
and for each batch of nodes to be detected, acquiring error reporting information of the batch of nodes to be detected under the condition of acquiring the information of failed execution of the batch of nodes to be detected.
Wherein, this step specifically includes: judging whether the execution of the nodes in the batch to be detected fails, and acquiring error reporting information of the nodes in the batch to be detected under the condition that the judgment result is yes; and if the judgment result is 'no', not performing the operation.
The error reporting information is obtained to display the step of the test execution of the batch nodes to be tested, wherein the step is a step in which an error occurs, and further represent the problems of batch programs and test scripts.
In a possible implementation manner, the verifying the execution result of the batch of nodes to be tested includes:
and for each field needing to be checked in the nodes of the batch to be tested, acquiring a field name needing to be checked in the execution result of one node of the batch to be tested and an actual value corresponding to the field name, and checking whether the actual value is consistent with a corresponding expected value or not to determine the checking result of the field name.
The method comprises the steps that a batch of nodes to be tested are connected with a network, wherein the nodes to be tested in a batch have at least one field needing to be checked, one field comprises at least one field value needing to be checked, and the field value corresponds to the field name.
In one possible implementation manner, S604 further includes:
and summarizing test information and outputting a test report of the batch program to be tested.
Specifically, the method may include, in a case where a user inputs a test report output request, summarizing test information, where the test information includes, but is not limited to, data information required for a test, an execution result of each node to be tested, and a check result of the field value, and the execution result of the node to be tested includes, but is not limited to, an execution result of each SQL statement; the test report may be a test result reconciliation report in HTML format. An exemplary one of the test result reconciliation reports is shown in FIG. 7.
For any operation in S601 to S604, including but not limited to a judgment operation, a parsing operation, and a query operation, the implementation may be implemented by writing the benshell code.
The batch program testing method provided by the invention can realize the test of a large number of different types of batch programs by designing a relatively universal test case format, including an initialization SQL parameter file, a buried SQL parameter file, an output verification SQL parameter file and an input user parameter, and has wider application range, including the test of the modified batch programs to be tested with the existing feasible batch program foundation and the newly developed batch programs to be tested. The content to be developed by the tester is reduced from the existing complete test template into three preset parameter files, different tests use the same test logic, repeated development is avoided to a certain extent, development pressure is reduced, and development cost is reduced. In addition, by dividing different modules for realizing the test function according to the functions, in practical application, the situation that although the batch programs of the test are different, at least one same parameter file can be used may be encountered, the requirement of repeated development is further reduced, and the development cost is reduced.
In addition, a test case format is designed for testing, so that the data independence of the test case is ensured, that is, the test case can be repeatedly executed in an available test environment, and the test case can be applied to test one batch program to be tested for multiple times or test multiple batch programs to be tested. The added operation of deleting unnecessary execution results can realize the 'clearing' of the test on operations such as data modification, and the like, so that the test can be carried out for many times without manual participation, and the automation degree of the test is improved.
Next, a batch program testing apparatus provided in the present application is introduced, and the batch program testing apparatus described below and the batch program testing method described above may be referred to correspondingly.
As shown in fig. 8, the batch program testing apparatus may include:
a data obtaining unit 801, configured to obtain user parameters and an initial preset parameter file, where the user parameters include batch node information to be detected and data table configuration information, the initial preset parameter file includes an initialization SQL parameter file, a buried SQL parameter file, and an output verification SQL parameter file, and the initial preset parameter file is configured respectively according to the data table configuration information to generate a configured preset parameter file;
a test execution unit 802, configured to sequentially execute, for each to-be-tested batch node, an operation of analyzing the initialized SQL parameter file and the embedded SQL parameter file in the configured preset parameter file, if the analysis operation of any parameter file fails to be executed, setting the execution state of the to-be-tested batch node to be complete and the execution of the to-be-tested batch node to be failed, and if the analysis operations of the two parameter files are both successfully executed, setting the execution state of the to-be-tested batch node to be complete and the execution of the to-be-tested batch node to be successful;
a state obtaining unit 803, configured to obtain an execution state of the batch of nodes to be tested;
a result determining unit 804, configured to obtain the execution results of the to-be-tested batch nodes when the execution states of the to-be-tested batch nodes are all completed, perform, to the execution results of the to-be-tested batch nodes, an operation of analyzing the output verification SQL parameter file in the configured preset parameter file, so as to verify the execution results of the to-be-tested batch nodes, and determine the test result according to the execution results and the verification results of the to-be-tested batch nodes.
In a possible implementation manner, the data obtaining unit further includes:
and the data receiving unit is used for receiving and storing the user parameters input by the user through the interactive interface and receiving and storing the initial preset parameter file uploaded by the user through the interactive interface.
In a possible implementation manner, the data obtaining unit includes:
a parameter file configuration unit, configured to, in a case that the data table configuration information is a usage data table, obtain an accounting date, obtain a corresponding data table according to the accounting date, sequentially perform, for each initial preset parameter file, obtaining a line number of the preset parameter file, and replace, according to the line number, corresponding data in the preset parameter file with data in the data table line by line;
and setting the initial preset parameter file as the configured preset parameter file under the condition that the data table configuration information does not use the data table.
Optionally, the test execution unit further includes:
and the result deleting unit is used for executing the operation of deleting unnecessary execution results for each batch node to be tested, wherein the unnecessary execution results comprise the execution results before the batch node to be tested on the test day.
Optionally, the test execution unit further includes:
and the result deleting unit is used for deleting unnecessary execution result operation under the condition that the execution states of all the batch nodes to be tested are finished, wherein the unnecessary execution result comprises an execution result before all the batch nodes to be tested on the test day.
Optionally, the state obtaining unit may be specifically configured to perform:
and calling a batch scheduling system to query the execution state of the nodes to be tested, and when the query result shows that the execution state of any node to be tested is incomplete, the batch scheduling system repeatedly queries the execution state of the nodes to be tested by taking a preset interval as a period.
Optionally, the result determining unit may include:
the result acquisition unit is configured to execute the information of acquiring the start-stop time and the execution failure of the nodes of the batch to be tested and the execution result of each operation instruction;
and the field checking unit is configured to execute the operation of analyzing the output verification SQL parameter file in the configured preset parameter file for the execution result of each batch node to be checked, execute and acquire a field name to be checked and an actual value corresponding to the field name in the execution result of one batch node to be checked for each field to be checked in the batch node to be checked, and check whether the actual value is consistent with a corresponding expected value to determine the checking result of the field name.
Optionally, the result obtaining unit may further include:
and the error reporting information acquisition unit is configured to execute the operation of acquiring the error reporting information of the nodes in the batch to be tested under the condition that the information that the operation of the nodes in the batch to be tested fails is acquired.
Optionally, the batch program testing apparatus may further include:
and the result output unit is configured to execute the summarized test information and output a test report of the batch program to be tested.
The batch program testing device provided by the embodiment of the invention can complete the tasks of preparing test data and checking a test result by a machine by acquiring the preset parameter file and necessary user parameters which are configured in advance, thereby realizing the automatic test of the batch program and improving the efficiency and the accuracy of the test. In addition, in order to realize the test of different batch programs to be tested, only corresponding preset parameter files and user parameters are needed to be configured, and test templates do not need to be developed for the batch programs to be tested, so that the test development cost is reduced, and the application range of the device to test objects is expanded.
FIG. 9 is a block diagram of an electronic device shown in accordance with an example embodiment. As shown, the electronic device may include:
a processor 901, configured to execute instructions to implement any batch program testing method provided in the embodiment of the present invention;
a memory 902 for storing processor-executable instructions and callable data;
and the interactive interface 903 is used for a user to input data and upload files, receive the data and the files and store the data and the files in the memory for the processor to call, and output the test result determined by the processor.
The interactive interface can be designed based on Jenkins, which is a Java-based open-source continuous integration tool for monitoring continuous and repeated work. The Jenkins provides an open and easy-to-use software platform, so that the software project can be continuously integrated. The interactive interface may also be designed in other ways to implement the functionality. Through designing the interactive interface, convenience is provided for configuring preset parameter files and user parameters which can be called by the processor, and the usability of the electronic equipment is improved.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and reference may be made to the partial description of the method embodiment for relevant points.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more pieces of software and/or hardware in the practice of the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus a necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The batch range order testing method, device and electronic device provided by the application are introduced in detail, specific examples are applied in the description to explain the principle and implementation of the application, and the description of the above embodiments is only used to help understand the method and core idea of the application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A batch sequencing test method, comprising:
acquiring user parameters and an initial preset parameter file, wherein the user parameters comprise batch node information to be detected and data table configuration information, and the initial preset parameter file comprises an initialization SQL parameter file, a buried SQL parameter file and an output verification SQL parameter file;
respectively configuring the initial preset parameter files according to the data table configuration information to generate configured preset parameter files;
for each batch node to be tested, sequentially analyzing the operation of initializing the SQL parameter files and embedding the SQL parameter files in the preset parameter files after configuration, if the analysis operation of any parameter file fails to be executed, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested fails, and if the analysis operations of the two parameter files are both successfully executed, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested to be successful;
obtaining the execution state of the nodes in batches to be tested;
and under the condition that the execution states of the nodes in the batches to be tested are all completed, acquiring the execution results of the nodes in the batches to be tested, respectively executing the operation of analyzing the output verification SQL parameter file in the preset parameter file after configuration on the execution results of the nodes in the batches to be tested, verifying the execution results of the nodes in the batches to be tested, and determining the test results according to the execution results and the verification results of the nodes in the batches to be tested.
2. The method according to claim 1, wherein the generating the configured preset parameter file comprises:
acquiring an accounting date under the condition that the data table configuration information is a use data table, acquiring a corresponding data table according to the accounting date, sequentially acquiring the line number of the preset parameter file for each initial preset parameter file, and replacing corresponding data in the preset parameter file by using data in the data table line by line according to the line number;
and setting the initial preset parameter file as the configured preset parameter file under the condition that the data table configuration information does not use the data table.
3. The method of claim 1, wherein the obtaining the execution state of the batch of nodes to be tested comprises:
and calling a batch scheduling system to query the execution state of the nodes to be tested, and when the query result shows that the execution state of any node to be tested is incomplete, the batch scheduling system repeatedly queries the execution state of the nodes to be tested by taking a preset interval as a period.
4. The method of claim 3, wherein the user parameters further comprise a refresh batch execution state interval;
the preset interval is the refresh batch execution state interval specified by the user to the batch scheduling system.
5. The method of claim 1, wherein the execution result of the batch of nodes to be tested comprises:
and the start-stop time, the information of whether the execution fails or not and the execution result of each operation instruction of the nodes in the batch to be tested.
6. The method according to claim 5, wherein for each node to be tested in batch, in case of obtaining information that the execution of the node to be tested in batch fails, further comprising obtaining error reporting information of the node to be tested in batch.
7. The method of claim 1, wherein verifying the results of the execution of the batch of nodes to be tested comprises:
and for each field needing to be checked in the nodes in batches to be tested, acquiring a field name needing to be checked in the execution result of the nodes in batches to be tested and an actual value corresponding to the field name, and checking whether the actual value is consistent with a corresponding expected value or not so as to determine the checking result of the field.
8. The method of claim 1, wherein the obtaining user parameters comprises receiving user parameters input by a user through an interactive interface of a foreground;
the acquiring of the initial preset parameter file comprises receiving the initial preset parameter file uploaded by a user through an interactive interface of a foreground.
9. A batch sequencing test apparatus, comprising:
the system comprises a data acquisition unit, a data processing unit and a data processing unit, wherein the data acquisition unit is used for acquiring user parameters and an initial preset parameter file, the user parameters comprise batch node information to be detected and data table configuration information, the initial preset parameter file comprises an initialization SQL parameter file, a buried SQL parameter file and an output verification SQL parameter file, and the initial preset parameter file is respectively configured according to the data table configuration information so as to generate a configured preset parameter file;
the test execution unit is used for sequentially executing the operation of analyzing the initialized SQL parameter file and the embedded SQL parameter file in the preset parameter file after configuration on each batch node to be tested, if the analysis operation of any parameter file fails to be executed, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested fails, and if the analysis operations of the two parameter files are both successfully executed, setting the execution state of the batch node to be tested to be completed and the execution of the batch node to be tested to be successful;
the state acquisition unit is used for acquiring the execution state of the nodes in the batch to be tested;
and the result determining unit is used for acquiring the execution results of the nodes in the batches to be tested under the condition that the execution states of the nodes in the batches to be tested are all completed, respectively executing the operation of analyzing the output verification SQL parameter file in the configured preset parameter file for the execution results of the nodes in the batches to be tested so as to verify the execution results of the nodes in the batches to be tested, and determining the test result according to the execution results and the verification results of the nodes in the batches to be tested.
10. An electronic device, comprising:
a processor for executing instructions to implement the batch program test method of any one of claims 1 to 8;
a memory for storing instructions executable by the processor and callable data;
and the interactive interface is used for a user to input data and upload files, receive the data and the files and store the data and the files in the memory for the processor to call, and output the test result determined by the processor.
CN202210460014.6A 2022-04-28 2022-04-28 Batch measuring range sequence testing method and device and electronic equipment Pending CN114780419A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210460014.6A CN114780419A (en) 2022-04-28 2022-04-28 Batch measuring range sequence testing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210460014.6A CN114780419A (en) 2022-04-28 2022-04-28 Batch measuring range sequence testing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114780419A true CN114780419A (en) 2022-07-22

Family

ID=82434847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210460014.6A Pending CN114780419A (en) 2022-04-28 2022-04-28 Batch measuring range sequence testing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114780419A (en)

Similar Documents

Publication Publication Date Title
CN111832236B (en) Chip regression testing method and system, electronic equipment and storage medium
CN109189479B (en) Parallel automatic verification method for processor instruction set
CN113127347B (en) Interface testing method, device, equipment and readable storage medium
US7895575B2 (en) Apparatus and method for generating test driver
CN112463586B (en) Method and medium for automatically generating application program interface test case
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN113434395B (en) Automatic generation method, device, equipment and medium for test cases
CN112540924A (en) Interface automation test method, device, equipment and storage medium
CN117009243A (en) Chip performance automatic test method, device, computer equipment and storage medium
CN111723009A (en) Framework system of python automated testing series products
CN114996127A (en) Intelligent test method and system for solid state disk firmware module
CN117370217B (en) Automatic interface test result generation method based on python
CN111767218B (en) Automatic test method, equipment and storage medium for continuous integration
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN111552648A (en) Automatic verification method and system for application
KR100777103B1 (en) Apparatus and method for generation of test driver
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN114780419A (en) Batch measuring range sequence testing method and device and electronic equipment
CN115934559A (en) Testing method of intelligent form testing system
CN111813665A (en) Big data platform interface data testing method and system based on python
CN111625459A (en) Application program testing method and device, computer equipment and storage medium
CN111078193A (en) Software development method and system for data analysis system
CN117234946B (en) Automatic test method and related equipment for project library system
RU2817186C1 (en) System for confirming tests and testing embedded software of electronic devices
CN113094281B (en) Test method and device for hybrid App

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