CN115525555A - Test script generation method and device, electronic equipment and storage medium - Google Patents

Test script generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115525555A
CN115525555A CN202211202252.3A CN202211202252A CN115525555A CN 115525555 A CN115525555 A CN 115525555A CN 202211202252 A CN202211202252 A CN 202211202252A CN 115525555 A CN115525555 A CN 115525555A
Authority
CN
China
Prior art keywords
message
configuration file
field
transaction
generating
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
CN202211202252.3A
Other languages
Chinese (zh)
Inventor
谢言华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202211202252.3A priority Critical patent/CN115525555A/en
Publication of CN115525555A publication Critical patent/CN115525555A/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

Landscapes

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

Abstract

The application provides a test script generation method and device, electronic equipment and a storage medium, relates to the technical field of computers, and is applied to the electronic equipment. The method comprises the following steps: acquiring a pre-generated transaction information configuration file; acquiring a target message configuration file corresponding to a target transaction code from a pre-generated message configuration file according to the target transaction code in the transaction information configuration file; and generating a test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file. Therefore, by directly acquiring the pre-generated message configuration file and the target transaction information configuration file, the pre-generated message configuration file and the transaction information configuration file are only required to be called when the test script needs to be generated, and the test script is generated by the pre-generated message configuration file and the pre-set code template file. Therefore, the test script is automatically compiled, so that the efficiency of generating the test script is high, the manual participation is reduced, and the error rate is further reduced.

Description

Test script generation method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a test script, an electronic device, and a storage medium.
Background
With the continuous expansion of global financial business, the robustness, reliability and maintainability of the bank system are more and more emphasized. Therefore, the importance of software testing is also becoming more prominent.
Currently, software testing includes not only functional index testing, but also non-functional index (e.g., response time and concurrency) testing. However, the development of the test script at present mainly depends on a tester, i.e. the tester writes the test script manually. Moreover, a large amount of message data is needed for generating the test script, and when the test script of the host computer is manually written, because the required data volume is large and many repeated operation steps exist in the writing of the test script, a long time is consumed when a tester manually writes the test script, so that people are prone to fatigue, and errors are prone to occur because the test script is manually written.
Therefore, the existing test scripts written manually by testers not only need to consume a lot of time and energy of the testers, but also cannot ensure the accuracy of writing the test scripts because of manual writing.
Disclosure of Invention
The application provides a test script generation method and device, electronic equipment and a computer readable storage medium, which are used for solving the problems that in the prior art, test scripts need to be written manually by testers, and a great amount of time and energy of the testers need to be consumed.
In a first aspect, the present application provides a method for generating a test script, which is applied to an electronic device, and includes: acquiring a pre-generated transaction information configuration file; according to a target transaction code in the transaction information configuration file, acquiring a target message configuration file corresponding to the target transaction code from a pre-generated message configuration file; acquiring transaction information in a transaction information configuration file and message information in a target message configuration file; and generating a test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file.
According to the test script generation method provided by the implementation mode, the electronic equipment can directly generate the test script by acquiring the transaction information in the pre-generated transaction information configuration file and the message information in the target message configuration file and splicing the transaction information and the message information with the preset code template file. Therefore, configuration information (such as transaction information and message information) of the test script does not need to be written manually in the process of generating the test script, and only the pre-generated message configuration file and the transaction information configuration file need to be called when the test script needs to be generated, and the test script is generated by the pre-set code template file. Therefore, the test script is automatically compiled, so that the efficiency of generating the test script is high, the manual participation is reduced, and the error rate is further reduced. In addition, in the implementation mode of the application, the transaction information configuration file and the message configuration file are both generated in advance. That is, when the test script is generated, the tester does not need to temporarily write the message information and the transaction information, and only needs to call the message information in the pre-generated message configuration file.
In an implementation manner of the method for generating a test script provided in this application, generating a test script according to transaction information in a transaction information configuration file, message information in a target message configuration file, and a preset code template file includes: generating a message body structure body definition part, a message header splicing function part, a message body splicing function part and a main function part according to the transaction information in the transaction information configuration file and the message information in the target message configuration file; and generating a test script according to the message body structure body definition part, the message header splicing function part, the message body splicing function part, the main function part and a preset code template file.
In the implementation mode of the application, when the test script needs to be generated, the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part are generated according to the transaction information and the message information, and then the message body structure body definition part, the message header splicing function part, the message body splicing function part, the main function part and a preset code template file are spliced to generate the test script. Therefore, when different test scripts are generated, only the corresponding transaction information configuration file and the message information configuration file need to be acquired according to the transaction code of the test script to be generated, a new message body structure body definition part, a message header splicing function part, a message body splicing function part and a main function part are generated according to the transaction information and the message information corresponding to the transaction code, and then the new message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part are spliced with the preset code template file. That is, when different test scripts are generated, all test script codes do not need to be modified, and only the code text related to the transaction code needs to be modified. Therefore, the workload of generating the test scripts by the tester is reduced, and different test scripts can be generated more conveniently and rapidly.
In an implementation manner of the method for generating a test script provided by the present application, the message information includes a field english name, a field length, a code value, a parameterization flag, initialization content, and a field chinese name. The transaction information comprises a transaction code, a message header variable domain mark and the number of message body fields.
In the implementation mode of the application, the test script is generated through the message information, the transaction information and the preset code template file. When the transaction codes are different, only different transaction information and message information need to be acquired, and the preset code template file does not need to be modified.
In an implementation manner of the method for generating a test script provided in this implementation manner, the method for generating a message body structure body definition part, a message header splicing function part, a message body splicing function part, and a main function part according to transaction information in a transaction information configuration file and message information in a target message configuration file includes: generating a message body structure body definition part according to the transaction code, the field English name, the field length and the field Chinese name; generating a message header splicing function part according to the transaction code and the message header variable domain mark; generating a message body splicing function part according to the transaction code, the field English name, the field length and the code value; and generating a main function part according to the transaction code, the initialization content, the number of the body fields of the message, the parameterization mark and the variable domain mark of the message header.
In other words, in the implementation manner of the application, the corresponding message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part are generated according to the transaction information and the message information, and then the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part are spliced with the preset code template file to generate the test script without manual writing.
In an implementation manner of the method for generating a test script provided in this implementation manner, the generating of the test script according to the message body structure definition part, the message header splicing function part, the message body splicing function part, the main function part, and the preset code template file includes: and sequentially splicing the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part to corresponding positions of a corresponding preset code template file to generate a test script.
In an implementation manner of the application, after the electronic device completes the writing of the four parts, namely the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part, the four assembled code files are read in sequence, inserted into corresponding positions in a preset code template file, and written into a formal test script file in sequence. Therefore, the test script can be generated without manual writing.
In an implementation manner of the method for generating a test script provided in the implementation manner of the present application, a pre-generated message configuration file is generated in the following manner: acquiring a message interface file, wherein the message interface file comprises at least one message interface table; acquiring a transaction code from each message interface table; reading the field information of the message body corresponding to the transaction code in each message interface table according to the transaction code; and generating a message configuration file corresponding to each transaction code as a pre-generated message configuration file according to the field information of the message body and each transaction code.
In the implementation mode of the application, the electronic equipment generates a plurality of message configuration files according to different transaction codes and field information of message bodies corresponding to the transaction codes in the message interface file. When the test script is generated, only the target message configuration file is required to be obtained according to the target transaction code, the message configuration file is not required to be written for many times, and only calling is required.
In an implementation manner of the test script generation method provided by the implementation manner of the present application, the field information of the message body includes a field english name, a field length, a code value, and a field chinese name.
In the implementation mode of the application, part of message information in the message configuration file is generated by acquiring the field information of the message body in the message interface file.
In an implementation manner of the method for generating a test script provided in this implementation manner, generating a message configuration file corresponding to a transaction code according to field information of a message body and each transaction code includes: reading a field English name, a field length, a code value and a field Chinese name corresponding to the transaction code to a message configuration file corresponding to the transaction code; obtaining a parameterization mark and initialization content input by a user on a first interface; and generating the message configuration file corresponding to the transaction code according to the English name, the field length, the code value, the Chinese name of the field, the parameterization mark and the initialization content of the field read in the message configuration file corresponding to the transaction code.
In the implementation mode of the application, english names, field lengths, code values and Chinese names of fields in the message configuration file are automatically generated through the message interface file. And finally generating the message configuration file by writing the parameterization mark and the initialization content in the message configuration file by the user. Therefore, automatic writing of the message configuration file can be realized, and the message information can be perfected by manual assistance. The workload of the tester for compiling the message interface information is reduced.
In an implementation manner of the method for generating a test script provided in the implementation manner of the present application, reading a field english name of a message body to a message configuration file includes: acquiring English names of fields of message bodies in each message interface table corresponding to the transaction codes; judging whether the English name of the field of the message body is a group field or not; if the English name of the field of the message body is the group field, reading the repetition times of the English name of the field of the message body, and generating the English name of the field in the message configuration file according to the group field, the repetition times and the English name of the field of the message body; and if the English name of the field of the message body is not the group field, generating the English name of the field in the message configuration file according to the English name of the field of the message body.
In the implementation mode of the method, in the process of generating the field English name of the message configuration file, the generation modes of different field English names are determined by judging whether the field is a group field, so that the situation that the splicing of the message information and the fixed code template is disordered when the test script is generated due to the fact that the field English names are repeated is prevented.
In an implementation manner of the test script generation method provided in the implementation manner of the present application, the method further includes generating a pre-generated transaction information configuration file by: and generating a pre-generated transaction information configuration file according to the transaction information input by the user on the second interface of the electronic equipment.
In the implementation mode of the application, before the test script is generated, the transaction information configuration file generated in advance is generated through the transaction information input by the user, so that only the transaction information configuration file needs to be called in the test script generation process. That is, in the implementation manner of the present application, the transaction information configuration file related to the test script is generated in advance, and the message configuration file is automatically generated in advance based on the message interface file and serves as the pre-generated message configuration file. When the test script needs to be generated, only the transaction information configuration file and the message configuration file need to be directly called, and manual writing is not needed when the test script is generated.
In a second aspect, the present application provides an apparatus for generating a test script, including: the first acquisition module is used for acquiring a pre-generated transaction information configuration file; the first processing module is used for acquiring a target message configuration file corresponding to a target transaction code from a pre-generated message configuration file according to the target transaction code in the transaction information configuration file; the second acquisition module is used for acquiring the transaction information in the transaction information configuration file and the message information in the target message configuration file; and the second processing module is used for generating a test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file.
The test script generation apparatus provided by the present application includes a module for executing the test script generation method provided by the first aspect, and therefore, the beneficial effects (or advantages) of the test script generation method provided by the first aspect can also be achieved.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, and a memory communicatively coupled to the processor; the memory stores computer-executable instructions; the processor executes computer-executable instructions stored by the memory to implement the method of generating a test script as provided by the implementation of the first aspect described above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the method for generating a test script is implemented as provided in the implementation manner of the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program, which when executed by a processor, implements the method for generating a test script as provided in the implementation of the first aspect.
It is understood that the beneficial effects of the second aspect to the fifth aspect can also be referred to the related description of the first aspect, and are not repeated herein.
According to the test script generation method, the electronic equipment firstly arranges the message configuration file corresponding to each transaction code from the message interface file. Therefore, the message interface information is not required to be manually arranged by a user, the generated message configuration file is only required to be perfected by the aid of the user, and the problems that manual writing of the message configuration file is large in labor amount, long in time consumption, large in repeated amount and prone to error are solved. And reading the transaction information in the transaction information configuration file and the message information in the target message configuration file by acquiring a pre-generated transaction information configuration file and a target message configuration file corresponding to a target transaction code of the test script to be executed at this time, and splicing the information with a preset code template file according to the information to form a test script file. Therefore, the message interfaces are arranged and the test scripts are written in an automatic mode, for testers, the workload of manual writing of the testers is reduced, and the test scripts are written by splicing preset code template files instead of manually, so that the generated scripts are more accurate.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a flowchart of a method for generating a test script according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a transaction information profile provided in an embodiment of the present application;
FIG. 3 is a flowchart of another test script generation method provided in the embodiments of the present application;
FIG. 4 is a flowchart of another test script generation method provided in the embodiments of the present application;
FIG. 5 is a flowchart of another test script generation method provided in the embodiments of the present application;
FIG. 6 is a flowchart of another test script generation method provided in the embodiments of the present application;
FIG. 7 is a flowchart of another test script generation method according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a device for generating a test script according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
It should be noted that, in the technical solution of the present application, the acquisition, storage, use, processing, etc. of data all conform to the relevant regulations of the national laws and regulations.
Interpretation of terms:
and (3) performance testing: the performance test is to simulate various normal, peak and abnormal load conditions through an automatic test tool to test various performance indexes of the system.
Testing the script: a set of instructions, formed by a series of instructions referring to a particular test, may be executed by the test tool.
Transaction code: according to the modeling characteristics of the bank system, the transaction executed by each system is uniquely identified by the transaction code, namely each transaction code uniquely corresponds to one transaction behavior.
Host systems, such as bank host systems, carry much of the core business of the bank and therefore require relatively frequent non-functional testing requirements. Compared with other application system tests, the workload for script preparation and information debugging is large in the test process of the host system.
In addition, in the process of writing the non-functional test script by the host system, because the host message format is special, the available message cannot be directly intercepted from the log like other application systems, and the message can be used by simply modifying, and the message tested by the existing host script can only be written by a user manually, and the message splicing operation is executed manually. And the manual work arranges the message fields according to the message interface file, which is time-consuming and labor-consuming. And because many transaction message interfaces may be very complex, some messages may even contain hundreds of fields, and these fields cannot be ignored even if there is no assignment, and must be concatenated in the message. Therefore, the process of splicing the message interfaces has a large amount of repeated work, and once dislocation and omission occur, later troubleshooting is very troublesome.
Furthermore, mismatching may exist between the writing method of the common host message interface file and the actual host message, for example, a field group repeated for tens of times is easy to have an understanding error, a user, that is, a tester, may be tired of a large number of repeated fields, may cause message field omission, and may also decrease the working efficiency. Moreover, the manual writing of the host test script is caused by that a lot of experience is consumed in repeated operation steps, so that people are tired, and the attention degree of key operation is influenced.
Based on the defects that the compiling of the non-functional test script of the host computer is mainly manual compiling and the testing cost is high, a tool capable of automatically generating the host computer script needs to be developed so as to realize the generation of the test script.
Therefore, in order to solve the above problems, the present application provides a method for generating a test script, which is applied to an electronic device and solves the time and labor consuming phenomenon of the traditional manual writing of a host test script. In addition, according to the test script generating method provided by the application implementation mode, the electronic device finishes the arrangement of the message interfaces and the writing of the host script in an automatic mode, so that a tester only has an auxiliary effect on the generation of the test script, the error rate of manual writing is reduced, and the generated test script is more accurate.
Moreover, the implementation mode of the application also provides a generation tool of the test script, wherein the electronic equipment comprises the generation tool of the test script, the message interface arrangement and the host test script compiling are completed in an automatic mode, the manual intervention is reduced, and the script code quality is improved.
The generation tool of the test script provided by the implementation manner of the application is used for executing the generation method of the test script provided by the implementation manner of the application.
The generation tool of the test script comprises a host message interface sorting sub-tool and a host script automatic compiling sub-tool.
The host message interface sorting sub-tool is used for sorting out a message configuration file for the host script automatic compiling sub-tool to compile the test script from the message interface file.
The automatic host script compiling sub-tool is used for splicing the message configuration file, the transaction information configuration file and the preset code template file to generate the test script by acquiring the message configuration file, the transaction information configuration file and the preset code template file.
Next, referring to fig. 1, a detailed description will be given of a specific process of the test tool executing the method for generating the test script in the implementation manner of the present application.
The method for generating the test script provided by the implementation mode of the application executes the following steps:
and S100, acquiring a pre-generated transaction information configuration file.
And S200, acquiring a target message configuration file corresponding to the target transaction code from a pre-generated message configuration file according to the target transaction code in the transaction information configuration file.
S300, acquiring the transaction information in the transaction information configuration file and the message information in the target message configuration file.
S400, generating a test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file.
According to the test script generation method provided by the implementation mode, the electronic equipment directly obtains the message information in the pre-generated message configuration file and the transaction information in the transaction information configuration file, and the pre-generated message configuration file and the transaction information in the transaction information configuration file are spliced to generate the test script. The message information and the test script do not need to be manually written in the process of generating the test script. Therefore, the test script is automatically compiled, so that the efficiency of generating the test script is high, the manual participation is reduced, and the error rate is further reduced.
Next, a method for generating a test script according to an embodiment of the present application will be described in detail.
First, step S100 is performed.
And S100, acquiring a pre-generated transaction information configuration file.
Illustratively, the automatic host script compiling sub-tool obtains a transaction information configuration file which is compiled by a user in advance and needs to generate a test script at this time.
Specifically, as shown in fig. 2, the pre-generated transaction information configuration file is generated by: a transaction information profile is generated based on transaction information entered by a user on a transaction information input interface (as an example of a second interface) of the electronic device.
The transaction information of the transaction information configuration file comprises a transaction code, a message header variable domain mark and the number of message body fields.
Specifically, the transaction code is the transaction code that needs to generate the test script at this time. The message header variable domain mark is used for determining whether the operation of adding variable domain content is needed when the message headers of the host are spliced, wherein 1 is that the message header has a variable domain, and 0 is that the message header has no variable domain. The number of message body fields is also the number of message body fields of the transaction.
For example, as shown in fig. 2, the user input transaction code is a. The variable field flag of the input message header is 0. The number of input fields, i.e. the number of body fields of the message for the transaction, is 8.
Next, step S200 is performed.
And S200, acquiring a target message configuration file corresponding to the target transaction code from a pre-generated message configuration file according to the target transaction code in the transaction information configuration file.
Illustratively, the host script automatic writing sub-tool obtains a target message configuration file matched with a target transaction code from the host message interface sorting sub-tool according to the target transaction code in the transaction information configuration file, that is, the transaction code required to generate the test script at this time.
Specifically, in the implementation manner of the present application, the host message interface sorting sub-tool sorts out a plurality of message configuration files corresponding to transaction codes, that is, pre-generated message configuration files, from the message interface files according to different transaction codes, when the test scripts are spliced, the host script automatic writing sub-tool will obtain the transaction codes to be executed according to the current time, that is, the target transaction codes, and obtain the message configuration files corresponding to the target transaction codes, that is, the target message configuration files, from the pre-generated message configuration files.
As shown in fig. 3, in an implementation manner of the present application, a pre-generated message configuration file is generated in the following manner, and specifically the following steps are performed:
s210, obtaining a message interface file, wherein the message interface file comprises at least one message interface table.
Illustratively, the message interface file includes several message interface tables, such as Excel tables.
S220, acquiring the transaction code from each message interface table.
Illustratively, the host message interface collation sub-tool obtains each transaction code in each message interface table.
And S230, reading the field information of the message body corresponding to the transaction code in each message interface table according to the transaction code.
Illustratively, the host message interface collation sub-tool obtains field information for different message bodies associated with each transaction code based on each transaction code.
And S240, generating a message configuration file corresponding to each transaction code as a pre-generated message configuration file according to the field information of the message body and each transaction code.
Illustratively, the host message interface organizer generates a plurality of message profiles based on the different transaction codes and the field information of the message body corresponding to each transaction code. Each message configuration file takes the transaction code as mark information. That is, one transaction code generates one corresponding message configuration file.
Specifically, in the implementation manner of the present application, the field information of the message body includes a field english name, a field length, a code value, and a field chinese name.
The message information in the message configuration file comprises field English name, field length, code value, parameterization mark, initialization content and field Chinese name.
As shown in fig. 4, in an implementation manner of the present application, a method for generating a message configuration file corresponding to a transaction code according to field information of a message body and each transaction code includes:
s241, reading the English name, the field length, the code value and the Chinese name of the field corresponding to the transaction code to a message configuration file corresponding to the transaction code.
Illustratively, reading the field english name, the field length, the code value and the field chinese name corresponding to each transaction code in the message interface table into a message configuration file, and generating the field english name, the field length, the code value and the field chinese name in the message configuration file.
Specifically, as shown in fig. 5, in an implementation manner of the present application, a method for generating a field english name in a message configuration file according to the field english name in a message interface file includes:
s2411, opening the message interface file.
Illustratively, as described above, the host message interface collation sub-tool needs to open the message interface file before generating the message configuration file.
S2412, reading the message body field information.
That is, the host message interface sorting sub-tool reads the field information of the message body in the message interface file.
Illustratively, the host message interface sorting sub-tool obtains the English name of the field of the message body in each message interface table corresponding to the transaction code.
Specifically, one of the transaction codes is used as a basis to obtain a field English name of a message body corresponding to the transaction code.
S2413, judging whether the field is a group field. If the field is a group field, step S2414 is executed, and if the field is not a group field, step S2416 is executed.
For example, it is determined whether the field of the message body is a group field, that is, whether the english name of the field of the message body is in the group field, and if the english name is in the group field, step S2414 is executed. If not, go to step S2416.
S2414, reading the field group repetition times.
Illustratively, the number of repetitions of the field english name in the field group is read sequentially.
S2415, repeatedly outputting the fields in the field group to the message configuration file according to the repetition times.
For example, if the field english name of the body of the message is a group field, the field english name in the group of fields is repeatedly output to the message configuration file according to the number of repetitions.
Namely, the field name in the message configuration file is generated according to the field group, the repetition times and the field English name of the message body.
Illustratively, the field name, that is, the field english name, in the message configuration file is generated by using the field group name _ repetition number _ field english name. For example, field group name _1_ field english name, field group name _2_ field english name.
And if the field English name of the message body is not the group field, generating the field English name in the message configuration file according to the field English name of the message body, namely directly generating the field English name.
S2416, outputting the message to a message configuration file.
S2417, judging whether the message interface file is finished or not; if the processing is finished, the correlation processing is finished, and if not finished, the process returns to step S2412.
Illustratively, it is determined whether all the field information of the message body related to one of the transaction codes in the message interface file has been read, if so, the reading of the field information of the message body is finished, and if not, the step S2412 is executed again.
It should be noted that, the field english names of the message bodies in the message configuration file and the parameterized value are consistent with the field names of the message bodies in the message interface file, and if the field is a group field, the field english names are changed according to the group field names and the repetition times.
Further, the field length in the message configuration file is the field length of the message body in the message interface file directly read by the host message interface sorting sub-tool. The parameterized value is consistent with the CICS of the field length of the message body in the message interface file, that is, the field length in the message configuration file is consistent with the field length of the message body in a Client Information Control System (CICS) of a product for providing online transaction processing and transaction management for applications in the message interface file. For example, if the field length writing for a field is (15,2), the field length is generally the first length value in parentheses. The method for reading the field length can be realized by writing codes in a host message interface sorting sub-tool or executed by preset conditions.
Further, in the implementation manner of the present application, the Code value in the message configuration file is a basis for determining whether a field of a message body needs to be subjected to ASCII (American Standard Code for Information exchange) Code, that is, an extended binary coded decimal Interchange Code (EBCDIC Code), that is, a decimal number identified by a binary Code, where 1 represents that transcoding is needed and 0 represents that transcoding is not needed. For example, except for the field of the super-long character string, the information such as the remark and the address of the field of the message body does not need to be transcoded, and the rest fields need to be transcoded. And the code value in the message configuration file and the parameterized value are the same as the code value of the message body field in the message interface file. That is, if the message body field in the message interface file needs transcoding, the field in the message configuration file still needs transcoding.
Further, in the implementation manner of the present application, the Chinese name of the field in the message configuration file is used for automatically generating the comment in the test script. The parameterized value is consistent with the Chinese name of the field of the message body in the message interface file.
It should be noted that the field length, code value, and field chinese name do not change because the field of the packet body is a group field.
And S242, acquiring the parameterization mark and the initialization content input on the first interface by the user.
Illustratively, the parameterization flag is a basis for judging whether the field needs parameterization operation in the test script, that is, whether a value needs to be taken from a parameterization file preset in the test tool, and the content is manually filled, wherein 1 represents that parameterization is needed, and 0 represents that parameterization is not needed.
The initialization content is a basis for judging whether the field needs to be initialized and assigned, the content also needs to be filled manually, if the field needs to be filled, the corresponding initialization content is filled, and if the field does not need to be filled, the corresponding initialization content is left empty.
In the implementation mode of the application, if the message information corresponding to the transaction code of the test script is generated at this time does not need to be initialized, the initialization content does not need to be set.
Two columns of empty fields are reserved when the parameterization mark and the initialization content are used for automatically generating the message configuration file, after the host message interface sorting sub-tool generates the message configuration file, the compiling interface (as an example of a first interface) of the initial message configuration file is displayed, a tester responsible for compiling the test script directly edits the message configuration file, and corresponding content is filled according to the actual requirements and requirements of the transaction code.
And S243, generating the message configuration file corresponding to the transaction code according to the English name, the length, the code value, the Chinese name, the parameterization mark and the initialization content of the field read in the message configuration file corresponding to the transaction code.
Illustratively, a transaction code corresponds to a message configuration file, and the host message interface sorting sub-tool generates a complete message configuration file according to the English name of the field, the length of the field, the code value, the Chinese name of the field read from the message interface file, and the parameterized flag and the initialized content input by the tester.
Specifically, the field chinese name of the message configuration file generated by the implementation of the present application may include a customer account number, a start date, an end date, a start detail serial number, a deposit transaction amount, a currency code, a currency collection code, and a detail additional information flag. The value of the client account code is 1, that is, transcoding operation is required, the parameterization flag is 1, that is, parameterization operation is required, and the initialization content part needs to be filled, that is, the initialization content is provided. The starting date, the ending date, the starting detail serial number, the deposit transaction amount and the detail additional information mark code value are all 1, namely transcoding is needed, the parameterization marks are all 0, namely parameterization operation is not needed, and the initialization content part is not needed to be filled. The code values of the currency code and the currency code are both 1, namely transcoding is needed, the parameterization mark is 0, namely parameterization operation is not needed, and initialization content is filled.
Illustratively, the message information of the message configuration file corresponding to the target transaction code a includes eight items. Wherein, the field Chinese name in the generated message configuration file is the client account number, and the field English name is Cst AccNo, the field length is 32 bits, the code value is 1, the parameterization flag is 1, and the initialization content is 32 x.
The English name StDt of the field with the Chinese name of the start date in the generated message configuration file has the field length of 8 bits, the code value of 1, the parameterization mark of 0 and no initialization content.
The English name EdDt of the field with the Chinese name of the ending date in the generated message configuration file has the field length of 8 bits, the code value of 1, the parameterization mark of 0 and no initialization content.
The English name Strt _ Dt1_ SN of the field with the Chinese name of the starting detail sequence number in the generated message configuration file has the field length of 8 bits, the code value of 1, the parameterization mark of 0 and no initialization content.
The field English name Dep _ TxnAmt of the deposit transaction amount in the field of the generated message configuration file has the field length of 15 bits, the code value of 1, the parameterization mark of 0 and no initialization content.
The field english name of the field in the generated message configuration file is the currency code is CcyCd, the field length is 3 bits, the code value is 1, the parameterization flag is 0, and the initialization content is 156.
The English name of the field in the generated message configuration file, which is called money transfer code, is CshOx _ Cd, the field length is 1 bit, the code value is 1, the parameterization flag is 0, and the initialization content is 1.
The field English name Dt1_ Apd _ Inf _ Ind of the field Chinese name detail additional information mark in the generated message configuration file has the field length of 1 bit, the code value of 1, the parameterization mark of 0 and no initialization content.
Next, step S300 is performed.
S300, transaction information in the transaction information configuration file and message information in the target message configuration file are obtained.
For example, the host script automatic writing sub-tool uses corresponding codes to realize the operation of opening the message configuration file and the transaction information configuration file. And acquiring the transaction information in the transaction information configuration file and the message information in the target message configuration file.
Next, step S400 is performed.
S400, generating a test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file.
Illustratively, a message body structure body definition part, a message header splicing function part, a message body splicing function part and a main function part are generated according to transaction information in a transaction information configuration file and message information in a target message configuration file. And generating a test script according to the message body structure body definition part, the message header splicing function part, the message body splicing function part, the main function part and a preset code template file.
Specifically, as shown in fig. 6, the following steps are specifically executed according to the transaction information in the transaction information configuration file, the message information in the target message configuration file, and the preset code template file to generate the test script:
and S410, generating a message body structure body definition part according to the transaction code, the field English name, the field length and the field Chinese name.
Illustratively, the message body structure body definition part is used for storing and operating the structure of the message body in the script, and the contents of different transaction message bodies are different. For example, according to a code template of the message body structure definition part, a target transaction code, a field English name, a field length and a field Chinese name are obtained to generate a corresponding code format. That is, the body structure definition part of the assembled message uses the transaction code in the transaction information configuration file, the English name of the field, the length of the field and the Chinese name of the field in the host message configuration file.
For example, the Chinese name of the field corresponding to the target transaction code includes the customer account number, the start date, the end date, the number of the start detail, the deposit transaction amount, the currency code, and the detail appended information mark. According to the field Chinese name, the field English name and the field length, a word-x-word field English name [ field length +1] is formed at the message body structure body definition part; // field Chinese name "class, where field Chinese name is annotated to field English name.
Specifically, for example, "+ -. Cst _ AccNo [32+1] is formed in the message body structure defining part according to the customer account number, cst _ AccNo, and the field length of 32; code for the client Account class; according to the starting date, the StDt and the field length of 8, forming a mark of StDt [8+1] in the message body structure body defining part; code for the// start date "class; according to the end date, edDt and the field length of 32, forming ". Mark.. Multidot.EdDt [8+1] in the message body structure body defining part; code for the// end date "class; according to the starting detail amount, strt _ Dt1_ SN and the field length of 8, forming "+ -. Strt _ Dt1_ SN [8+1] in the message body structure body defining part; code for the Start detail amount class; forming a mark on a message body structure body definition part according to the deposit transaction amount, the Dep _ TxnAmt and the field length of 15, "+" Dep _ TxnAmt [15+1]; // deposit transaction amount class code; forming a mark x c cd [3+1] on the message body structure body definition part according to the non-duplication code, the cc cd and the field length of 3; code of the// currency code "class; according to the money collection code, the CshEx _ Cd and the field length of 32, forming a mark x CsEx _ Cd [1+1] in the message body structure body definition part; code of the// money exchange code "class; according to the detail additional information mark, dt1_ Apd _ Inf _ Ind and the field length of 32, forming "× Dt1_ Apd _ Inf _ Ind [1+1] on the message body structure body defining part; // details additional information flags "code of class.
And S420, generating a message header splicing function part according to the transaction code and the message header variable domain mark.
Illustratively, the host message header is divided into a fixed field and a variable field, the fixed field is a field which is used for all transactions, and the variable field is a field which is used for part of special transactions, so the splicing function part of the message header is a code template file written in a code template of the splicing function part of the message header, and the host script automatic compiling sub-tool needs to judge whether the variable field part needs to be spliced or not according to the value of a message header variable field mark in the transaction information configuration file, if so, splicing is needed, otherwise, the step is skipped.
And S430, generating a message body splicing function part according to the transaction code, the field English name, the field length and the code value.
Illustratively, the main content of the message body splicing function part is that each field is sequentially spliced into a complete message body according to a specified format, and a code template corresponding to the message body splicing function part selects a corresponding transcoding splicing code for splicing by using a transaction code in a transaction information configuration file and a field English name, a field length and a code value in the message configuration file.
S440, generating a main function part according to the transaction code, the initialization content, the number of the message body fields, the parameterization mark and the message header variable domain mark.
Illustratively, the main function part is a main function of the test script, and the transaction differentiation part, that is, the different parts of the message information corresponding to each transaction code are mainly an initialization content and a parameterized flag message header variable field flag part, so assembling the main function part requires that the transaction code, the number of message body fields, and the parameterized flag and the initialization content in the message header variable field flag and the message configuration file in the user transaction information configuration file are enabled.
S450, generating a test script according to the message body structure body definition part, the message header splicing function part, the message body splicing function part, the main function part and a preset code template file.
Illustratively, the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part are spliced to corresponding positions of a corresponding preset code template file in sequence to generate a test script.
Specifically, a host test script has a plurality of codes which are universal, and all transactions share the codes, so that a preset code template file is generated and is assembled with the four parts to output a complete test script.
The preset code template file is a universal code template file or a fixed code template file for various test scripts and different transaction codes.
The preset code template file is composed of a plurality of files, after the host script automatic compiling sub-tool completes the compiling of the four parts of the message body structure body defining part, the message header splicing function part, the message body splicing function part and the main function part, the four spliced code files are read in sequence, inserted into corresponding positions in the preset code template file and written into a formal test script file in sequence.
According to the test script generating method provided by the implementation mode, firstly, the message configuration file corresponding to each transaction code is arranged from the message interface file through the host message interface arranging sub-tool. Therefore, the message interface information is not required to be manually arranged by a user, the generated message configuration file is only required to be perfected by the aid of the user, and the problems that manual writing of the message information configuration file is large in labor amount, long in time consumption, good in repeatability and prone to error are solved. And then, a pre-compiled transaction information configuration file and a target message configuration file corresponding to a target transaction code of the test script which needs to be executed at this time are obtained through the automatic host script compiling sub-tool, transaction information in the transaction information configuration file and message information in the target message configuration file are read, and the information is spliced with a preset code template file to form a test script file. Therefore, by arranging the complete message interfaces and compiling the test scripts in an automatic mode, for testers, the workload of manual compiling of the testers is reduced, and the generated scripts are more accurate by splicing the fixed code templates, namely the preset code template files, instead of manual compiling by themselves.
It should be noted that, in the implementation manner of the present application, the file names of the message configuration file and the transaction information configuration file do not change with the transaction code, but the transaction information and the message information may differ with the transaction code. And when different test scripts are generated each time, the generation of the transaction information configuration file and the matching of the target message configuration file need to be carried out again.
It should be further noted that, in the method for generating a test script provided in the implementation manner of the present application, the test tool may be a Load Runner performance test tool, and the non-functional index of the software system to be tested may be obtained by simulating an operation behavior of an actual user and implementing a concurrent Load and performance monitoring manner. Other test tools for testing the host system are also possible.
Further, referring to fig. 7, the method for generating a test script according to the implementation manner of the present application further performs the following steps:
s510, opening a host message configuration file and a transaction information configuration file.
Illustratively, the host script auto-authoring sub-tool opens a pre-authored transaction information configuration file and organizes the pre-organized message configuration file by the sub-tool through the host message interface.
S520, reading the message body field information.
For example, the host script auto-write sub-tool reads the transaction information in the transaction information configuration file and the message information in the message configuration file.
S530, compiling a message body structure body definition part according to the transaction code, the field name, the field length and the field Chinese name.
Illustratively, the message body structure body definition part is used for storing and operating the structure of the message body in the script, and the contents of different transaction message bodies are different. For example, according to a code template of the message body structure definition part, a target transaction code and a field name, namely a field English name, a field length and a field Chinese name are obtained to generate a corresponding code format. That is, the assembled message body structure defining part uses the transaction code in the transaction information configuration file, the English name of the field, the length of the field, and the Chinese name of the field in the host message configuration file.
And S540, compiling a message header splicing function part according to the transaction code and the variable message header marker.
Illustratively, the host message header is divided into a fixed field and a variable field, the fixed field is a field which is used for all transactions, and the variable field is a field which is used for part of special transactions, so that the message header splicing function part is written in a code template of the message header splicing function part assembled by the code template file, and the host script automatic compiling sub-tool needs to judge whether the variable field part needs to be spliced or not according to the variable message header flag in the transaction information configuration file, namely the value of the message header variable field flag, if so, splicing is needed, otherwise, the step is skipped.
And S550, writing a message body splicing function part according to the transaction code, the field name, the field length and the code value.
Illustratively, the main content of the message body splicing function part is that each field is sequentially spliced into a complete message body according to a specified format, a code template corresponding to the message body splicing function part can be used for a transaction code in a transaction information configuration file, and the field name in the message configuration file, namely, the field English name, the message body field length and the code value, selects a corresponding transcoding splicing code for splicing.
And S560, compiling a main function part according to the transaction code, the field initialization value, the field number, the parameterization mark and the variable message header mark.
Illustratively, a main function part, i.e., an Action function, is a main function of a LoadRunner test script, and transaction differentiation parts are mainly initialization of a message body structure, i.e., initialization content, parameterization field assignment, i.e., parameterization flags, and variable message header flags, i.e., message header variable domain flag parts, which are spliced into a complete message, i.e., different parts of message information corresponding to each transaction code are mainly the initialization content, the parameterization flags and the message header variable domain flag parts, so that assembling the main function part requires that transaction codes, the number of message body fields, the message header variable domain flags and the parameterization flags and the initialization content in a message configuration file in a user transaction information configuration file.
And S570, sequentially splicing the parts with the code template and outputting the spliced parts to a script file.
Illustratively, the preset code template file is composed of a plurality of files, and after the automatic script writing sub-tool writes the four parts of the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part, the four assembled code files are read in sequence, inserted into corresponding positions in the preset code template file and written into a formal test script file in sequence.
Further, referring to fig. 8, fig. 8 is a schematic structural diagram of a device for generating a test script according to an embodiment of the present application. As shown in fig. 8, the test script generating apparatus includes: a first obtaining module 701, a first processing module 702, a second obtaining module 703 and a second processing module 704.
The first obtaining module 701 is configured to obtain a pre-generated transaction information configuration file.
The first processing module 702 is configured to obtain, according to the target transaction code in the transaction information configuration file, a target message configuration file corresponding to the target transaction code from a pre-generated message configuration file.
The second obtaining module 703 is configured to obtain the transaction information in the transaction information configuration file and the message information in the target message configuration file.
The second processing module 704 is configured to generate a test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file, and a preset code template file.
The device for generating the test script provided in the embodiment of the present application may be used to execute the method for generating the test script described in the above embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
It should be noted that the division of the modules of the above apparatus is only a logical division, and the actual implementation may be wholly or partially integrated into one physical entity, or may be physically separated. And these modules can be realized in the form of software called by processing element; or may be implemented entirely in hardware; and part of the modules can be realized in the form of calling software by the processing element, and part of the modules can be realized in the form of hardware. For example, the processing module may be a processing element separately set up, or may be implemented by being integrated in a chip of the apparatus, or may be stored in a memory of the apparatus in the form of program code, and a function of the processing module may be called and executed by a processing element of the apparatus. Other modules are implemented similarly. In addition, all or part of the modules can be integrated together or can be independently realized. The processing element here may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
In addition, the method for generating the host message interface sorting sub-tool and the host script automatic writing sub-tool to execute the test script can be implemented by matching components such as a processor and a memory of the electronic device.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 9, the electronic device may include: transceiver 121, processor 122, memory 123.
The processor 122 executes computer-executable instructions stored in the memory, causing the processor 122 to perform the aspects of the embodiments described above. The processor 122 may be a general-purpose processor including a central processing unit CPU, a Network Processor (NP), and the like; but also a digital signal processor DSP, an application specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
Memory 123 is coupled to processor 122 via a system bus and communicates with each other, and memory 123 is used for storing computer program instructions.
By way of example, and not limitation, memory 123 may include a Hard Disk Drive (HDD), a floppy disk drive, flash memory, an optical disk, a magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive or a combination of two or more of these. Memory 123 may include removable or non-removable (or fixed) media, where appropriate. Memory 123 may be internal or external to the integrated gateway device, where appropriate. In a particular embodiment, the memory 123 is a non-volatile solid-state memory. In a particular embodiment, the memory 123 includes Read Only Memory (ROM). Where appropriate, the ROM may be mask-programmed ROM, programmable ROM (PROM), erasable PROM (EPROM), electrically Erasable PROM (EEPROM), electrically Alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
The transceiver 121 may be used to acquire the task to be executed and the configuration information of the task to be executed.
The system bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The system bus may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus. The transceiver is used to enable communication between the database access device and other computers (e.g., clients, read-write libraries, and read-only libraries). The memory may include Random Access Memory (RAM) and may also include non-volatile memory (non-volatile memory).
The electronic device provided by the embodiment of the present application may be the terminal device of the foregoing embodiment.
The embodiment of the application further provides a chip for running the instructions, and the chip is used for executing the technical scheme of the test script generation method in the embodiment.
The embodiment of the present application further provides a computer-readable storage medium, where a computer instruction is stored in the computer-readable storage medium, and when the computer instruction runs on a computer, the computer is enabled to execute the technical solution of the method for generating a test script according to the above embodiment.
In some possible embodiments, various aspects of the methods provided by the present application may also be implemented in the form of a program product including program code for causing a computer device to perform the steps of the methods according to various exemplary embodiments of the present application described above in this specification when the program product runs on the computer device, for example, the computer device may perform the method for generating the test script described in the embodiments of the present application.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but is not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The implementation manner of the present application further provides a computer program product, where the computer program product includes a computer program, which is stored in a computer-readable storage medium, and the computer program can be read by at least one processor from the computer-readable storage medium, and when the computer program is executed by the at least one processor, the technical solution of the method for generating a test script in the above embodiments can be implemented.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable information processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable information processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable information processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof.

Claims (15)

1. A method for generating a test script, which is applied to an electronic device, the method comprising:
acquiring a pre-generated transaction information configuration file;
according to a target transaction code in the transaction information configuration file, acquiring a target message configuration file corresponding to the target transaction code from a pre-generated message configuration file;
acquiring transaction information in the transaction information configuration file and message information in the target message configuration file;
and generating the test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file.
2. The method for generating a test script according to claim 1, wherein generating the test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file, and a preset code template file comprises:
generating a message body structure body definition part, a message header splicing function part, a message body splicing function part and a main function part according to the transaction information in the transaction information configuration file and the message information in the target message configuration file;
and generating the test script according to the message body structure body definition part, the message header splicing function part, the message body splicing function part, the main function part and the preset code template file.
3. The method according to claim 2, wherein the message information includes a field english name, a field length, a code value, a parameterization flag, initialization content, and a field chinese name.
4. The method according to claim 3, wherein the transaction information includes a transaction code, a header variable field flag, and a number of packet body fields.
5. The method for generating a test script according to claim 4, wherein generating a message body structure body definition part, a message header splicing function part, a message body splicing function part, and a main function part according to the transaction information in the transaction information configuration file and the message information in the target message configuration file comprises:
generating the message body structure body definition part according to the transaction code, the field English name, the field length and the field Chinese name;
generating the message header splicing function part according to the transaction code and the message header variable domain mark;
generating the message body splicing function part according to the transaction code, the field English name, the field length and the code value;
and generating the main function part according to the transaction code, the initialization content, the number of the message body fields, the parameterization mark and the message header variable domain mark.
6. The method for generating a test script according to claim 5, wherein generating the test script according to the message body structure body definition part, the message header splicing function part, the message body splicing function part, the main function part, and the preset code template file comprises:
and sequentially splicing the message body structure body definition part, the message header splicing function part, the message body splicing function part and the main function part to corresponding positions of the preset code template file to generate the test script.
7. The method according to any one of claims 3 to 6, wherein the pre-generated message configuration file is generated by:
acquiring a message interface file, wherein the message interface file comprises at least one message interface table;
acquiring a transaction code from each message interface table;
reading field information of a message body corresponding to the transaction code in each message interface table according to each transaction code;
and generating a message configuration file corresponding to each transaction code according to the field information of the message body and each transaction code, wherein the message configuration file is used as the pre-generated message configuration file.
8. The method for generating a test script according to claim 7, wherein the field information of the message body includes a field english name, a field length, a code value, and a field chinese name.
9. The method for generating a test script according to claim 8, wherein generating the message configuration file corresponding to the transaction code according to the field information of the message body and each transaction code comprises:
reading the English name of the field, the length of the field, the code value and the Chinese name of the field corresponding to the transaction code to the message configuration file corresponding to the transaction code;
acquiring the parameterization mark and the initialization content input by a user on a first interface;
and generating the message configuration file corresponding to the transaction code according to the English name of the field, the length of the field, the code value, the Chinese name of the field, the parameterization mark and the initialization content read in the message configuration file corresponding to the transaction code.
10. The method for generating a test script according to claim 9, wherein reading the field english name of the message body to the message configuration file corresponding to the transaction code comprises:
acquiring English names of fields of the message bodies in each message interface table corresponding to the transaction codes;
judging whether the English name of the field of the message body is a group field or not;
if the field English name of the message body is a group field, reading the number of times of repetition of the field English name of the message body, and generating the field English name in the message configuration file according to the group field, the number of times of repetition and the field English name of the message body;
and if the field English name of the message body is not the group field, generating the field English name in the message configuration file according to the field English name of the message body.
11. The method for generating a test script according to any one of claims 1 to 10, wherein the method further comprises generating the pre-generated transaction information profile by:
and generating the pre-generated transaction information configuration file according to the transaction information input by the user on the second interface of the electronic equipment.
12. An apparatus for generating a test script, comprising:
the first acquisition module is used for acquiring a pre-generated transaction information configuration file;
the first processing module is used for acquiring a target message configuration file corresponding to a target transaction code from a pre-generated message configuration file according to the target transaction code in the transaction information configuration file;
the second acquisition module is used for acquiring the transaction information in the transaction information configuration file and the message information in the target message configuration file;
and the second processing module is used for generating the test script according to the transaction information in the transaction information configuration file, the message information in the target message configuration file and a preset code template file.
13. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored by the memory to implement the method of generating a test script according to any one of claims 1-11.
14. A computer-readable storage medium having stored thereon computer-executable instructions for implementing the method of generating a test script according to any one of claims 1-11 when executed by a processor.
15. A computer program product, comprising a computer program which, when executed by a processor, carries out a method of generating a test script according to any one of claims 1 to 11.
CN202211202252.3A 2022-09-29 2022-09-29 Test script generation method and device, electronic equipment and storage medium Pending CN115525555A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211202252.3A CN115525555A (en) 2022-09-29 2022-09-29 Test script generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211202252.3A CN115525555A (en) 2022-09-29 2022-09-29 Test script generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115525555A true CN115525555A (en) 2022-12-27

Family

ID=84699342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211202252.3A Pending CN115525555A (en) 2022-09-29 2022-09-29 Test script generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115525555A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115987863A (en) * 2023-01-05 2023-04-18 中国联合网络通信集团有限公司 Testing method and device for optical modem and server

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115987863A (en) * 2023-01-05 2023-04-18 中国联合网络通信集团有限公司 Testing method and device for optical modem and server

Similar Documents

Publication Publication Date Title
CN101135989A (en) Automatization test method and device for Web applied system
CN109189479B (en) Parallel automatic verification method for processor instruction set
CN105279090A (en) Test script generating method and test script generating device applied in financial field
US5715373A (en) Method and apparatus for preparing a suite of test scripts for testing a proposed network management application
CN110705717A (en) Training method, device and equipment of machine learning model executed by computer
CN104268073A (en) Method for generating test cases in batch mode
CN111324526B (en) Interface test system, method and server
CN108984393A (en) A kind of unit testing code automatic generation method and device
CN100375057C (en) Automatic test auxiliary system and corresponding software automatic test method
CN116661756B (en) Object analysis method and device based on low-code DSL
CN114048129A (en) Automatic testing method, device, equipment and system for software function change
CN109783565A (en) A kind of method and system that excel data quickly introduce
CN109446065A (en) User tag test method, device, computer equipment and storage medium
CN115525555A (en) Test script generation method and device, electronic equipment and storage medium
CN116049014A (en) AMBA bus verification platform generation method and device
CN117370217A (en) Automatic interface test result generation method based on python
CN116090380B (en) Automatic method and device for verifying digital integrated circuit, storage medium and terminal
JP2000216854A (en) Method, verification module, server, control module and storage means for verifying configuration data for communication system
CN115794639B (en) Visual test based on flow and visual simulation test system and method
CN112685316A (en) Code execution path acquisition method and device, computer equipment and storage medium
CN116467219A (en) Test processing method and device
CN108334313A (en) Continuous integrating method, apparatus and code management system for large-scale SOC research and development
CN103678054B (en) Test method and device used for BACnet equipment
CN111813665A (en) Big data platform interface data testing method and system based on python
CN117573140B (en) Method, system and device for generating document by scanning codes

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