CN109857735B - Data construction method and system for rule description through excel - Google Patents

Data construction method and system for rule description through excel Download PDF

Info

Publication number
CN109857735B
CN109857735B CN201811636432.6A CN201811636432A CN109857735B CN 109857735 B CN109857735 B CN 109857735B CN 201811636432 A CN201811636432 A CN 201811636432A CN 109857735 B CN109857735 B CN 109857735B
Authority
CN
China
Prior art keywords
information
key
operation step
executed
excel
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.)
Active
Application number
CN201811636432.6A
Other languages
Chinese (zh)
Other versions
CN109857735A (en
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.)
Shanghai Ruijia Information Technology Co ltd
Original Assignee
Shanghai Ruijia Information Technology 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 Shanghai Ruijia Information Technology Co ltd filed Critical Shanghai Ruijia Information Technology Co ltd
Priority to CN201811636432.6A priority Critical patent/CN109857735B/en
Publication of CN109857735A publication Critical patent/CN109857735A/en
Application granted granted Critical
Publication of CN109857735B publication Critical patent/CN109857735B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application provides a data construction method and system for rule description through an excel table. The method comprises the following steps: analyzing basic information and form information which are regularly described through an excel form to generate a form page; analyzing the operation steps described by the rule through the excel table, and selecting corresponding operation targets according to the keywords described in the operation steps to execute the operation steps; when the operation step is executed, replacing a specific character string in the rule description of the executed operation step based on the key information input in the form page and the result of the previous operation step; and outputting debugging information of each operation step to complete data construction. Therefore, rule description can be carried out through excel, operation steps and forms are combined, automatic data construction is realized by correspondingly combining with operation targets, and the rule template is simple to manage and maintain, high in data construction efficiency and convenient to share.

Description

Data construction method and system for rule description through excel
Technical Field
The present application relates to the field of computer testing, and in particular, to a method and system for constructing data through excel rule description
Background
When testing based on a test environment, data construction is usually required to generate test data meeting specific conditions. Data construction is carried out, and two modes of manual construction and automatic construction are common. Manual construction, usually by combining the testers' experience (such as communicating with research and development, or reading codes, etc.), performs data construction by some combination of the following ways: 1) calling an http interface of the test environment; 2) the data is added, deleted and modified aiming at a test environment database (including but not limited to a relational database such as mysql, and possibly a document database similar to mongoDB). The automatic construction is usually based on experience, a front-end page is developed, a user fills in some necessary prerequisite fields through a form and submits the prerequisite fields to a background, and the background achieves the purpose of constructing data in a mode of calling an interface or updating a database through codes. For the common data construction requirements, it is desirable to provide an automatic construction mode as much as possible for development and testing personnel to use, but the existing automatic construction needs to redevelop a set of front-end and back-end codes each time, which is time-consuming and inefficient.
Disclosure of Invention
The present description is proposed in order to provide a data construction method and system for rule description by excel that overcomes or at least partially solves the above mentioned problems.
In a first aspect, the present application provides a data construction method for rule description through an excel table, including: analyzing basic information and form information which are regularly described through an excel form to generate a form page; analyzing the operation steps described by the rule through the excel table, and selecting corresponding operation targets according to the keywords described in the operation steps to execute the operation steps; when the operation step is executed, replacing a specific character string in the rule description of the executed operation step based on the key information input in the form page and the result of the previous operation step; and outputting debugging information of each operation step to complete data construction.
Wherein, the rule description through excel includes: and establishing the excel form and describing rules, wherein the excel form comprises basic information, form information and operation steps.
Wherein the basic information comprises the role and maintainer described by the rule; the form information comprises key information required when the operation steps which need to be manually filled by the user are executed; the operation steps include: each operation step corresponds to an independent operation, each independent operation has a corresponding operation target, and each operation step is provided with a corresponding parameter; and associating the operation steps with the form information according to the specific character strings, and associating the operation steps with the operation steps according to the specific character strings.
Wherein the operational objective includes at least: invoking one or more interface targets of a test environment; and/or, data modification is performed in the storage system.
Wherein, generating the form page comprises: and generating a webpage form page based on the form information so as to fill in key information in the form information.
Wherein, still include: and receiving key information submitted by the form page.
Analyzing operation steps which are described by rules through an excel table, selecting corresponding operation targets according to keywords in the operation steps, and executing each operation step, wherein the operation steps comprise: and executing each operation step of the excel table step by step, and operating the corresponding database storage system target or interface target.
When the operation step is executed, based on the key information input in the form page and the result of the previous operation step, value substitution is performed on a specific character string in the rule description of the executed operation step, which specifically includes: the specific character string in the rule description of the operation step includes: indicating a character string $ { form: key } of key information key input in a form page so as to associate the operation step with the form information; a character string $ { step number N: key } indicating an output result key of the operation step whose step number is N before the operation step is performed, to associate the operation step with the operation step; when the operation step is executed, replacing the character string $ { form: key } appearing in the executed operation step with the actual value of the key information key input in the form page; and when the operation step is executed, replacing the character string $ { step serial number N: key } appearing in the executed operation step with the value of the output result key of the operation step N.
Wherein outputting the debug information of each step to complete the data construction, comprises: after each operation step is executed, debugging information is output to complete data construction; wherein the debug information includes at least: description of operation steps, actual operation step parameters after replacement and operation results.
In a second aspect, the present application provides a data structuring system for rule description through an excel table, including: the analysis generating unit is used for analyzing the basic information and the form information which are regularly described through the excel form so as to generate a form page; the analysis execution unit is used for analyzing the operation steps described by the rule through the excel table so as to select corresponding operation targets according to the keywords described in the operation steps to execute the operation steps; a replacing unit, configured to, when the operating step is executed, replace a specific character string in a rule description of the executed operating step based on key information input in the form page and a result of a previous operating step; and the output unit is used for outputting the debugging information of each operation step to complete data construction.
Wherein, the rule description through excel further includes: and establishing the excel form and describing rules, wherein the excel form comprises basic information, form information and operation steps.
Wherein the basic information comprises the role and maintainer described by the rule; and/or the form information comprises key information required when the operation steps manually filled by the user are executed; the operation steps include: each operation step corresponds to an independent operation, each independent operation has a corresponding operation target, and each operation step is provided with a corresponding parameter; and associating the operation steps with the form information according to the specific character strings, and associating the operation steps with the operation steps according to the specific character strings.
Wherein the operational objective includes at least: invoking one or more interface targets of a test environment; and/or, data modification is performed in the storage system.
Wherein, the analysis generation unit further comprises: and the webpage is used for generating a webpage form page based on the form information so as to fill out key information in the form information.
Wherein, still include: and the receiving unit is used for receiving the key information submitted by the form page.
Wherein, the analysis execution unit further comprises: and each operation step for executing the excel table step by step is used for operating the corresponding database storage system target or interface target.
Wherein, the replacement unit further comprises: the specific character string in the rule description of the operation step includes: indicating a character string $ { form: key } of key information key input in a form page so as to associate the operation step with the form information; a character string $ { step number N: key } indicating an output result key of the operation step whose step number is N before the operation step is performed, to associate the operation step with the operation step; when the operation step is executed, replacing the character string $ { form: key } appearing in the executed operation step with the actual value of the key information key input in the form page; and when the operation step is executed, replacing the character string $ { step serial number N: key } appearing in the executed operation step with the value of the output result key of the operation step N.
Wherein, output unit still includes: the debugging device is used for outputting debugging information after each operation step is executed so as to complete data construction; wherein the debug information includes at least: description of operation steps, actual operation step parameters after replacement and operation results.
In a third aspect, the present application provides a server comprising a processor and a memory: the memory is used for storing a program for executing the method; the processor is configured to execute programs stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the steps of the method as claimed above.
According to the scheme of the application, rule description is carried out through an excel table, operation steps and forms are combined, association is carried out among the operation steps and between the operation steps and the forms, and the operation steps and the forms are correspondingly combined with operation targets to realize automatic data construction. The rule of the data construction can be simply and conveniently described, managed and maintained through the excel table, namely the rule template of the data construction is simple and easy to manage; furthermore, the test platform automatically generates a form page from the form information according to the rule description and fills data in the form page for the test user, so that the test platform is convenient for other test users to use and is beneficial to team sharing data construction experience; each link of the data construction, namely each operation step, can output debugging information such as the result of the step and the like, so that the positioning in the test is facilitated. Thus, data construction efficiency is improved and sharing capability is improved.
The foregoing description is only an overview of the technical solutions of the present application, and in order to make the technical solutions of the present application more clear and clear, and to implement the technical solutions according to the content of the description, the following detailed description is made with reference to the preferred embodiments of the present application and the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
fig. 1 shows a flowchart of a data structure control method described by an excel table according to an embodiment of the present application.
Fig. 2 shows a schematic structural diagram of a data construction system for rule description through an excel table according to an embodiment of the present application.
FIG. 3 shows a flow diagram in application to a test environment scenario according to an embodiment of the present application.
Detailed Description
The technical solutions in the present specification are described in detail with reference to the drawings and the specific embodiments, and it should be understood that the specific features in the embodiments and the examples are not intended to limit the technical solutions in the present specification, and the technical features in the embodiments and the examples in the present specification may be combined with each other without conflict.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Examples
Referring to fig. 1, an embodiment of a data construction method described by rules through an excel table in the present application includes:
step S110, analyzing the basic information and the form information which are described by the rule through the excel form to generate a form page.
The rules are managed and described in an excel form mode, namely, a rule template is designed and managed and maintained.
In one embodiment, an excel table is built for rule description. The created excel table mainly includes three pieces of information (sheet), for example: basic information, form information and operation steps.
Further, the basic information comprises the role of rule description and maintainers; and/or the form information comprises key information required when the operation steps manually filled by the user are executed; and/or the operation steps comprise that each step corresponds to an individual operation, each individual operation has a corresponding operation target, and each operation step is provided with a corresponding parameter. The method specifically comprises the following steps:
1. basic information: the role of the template (e.g., constructing account information for a test user), a maintainer, etc.
2. Form information: some of the information is information that needs to be manually filled by a user (e.g., a tester) during data construction, and the information is used as key information when the operation step is performed, so as to complete the data construction of the test.
3. The method comprises the following operation steps: each operation step is a separate operation, such as triggering an http request, or performing a lookup for mysql, or performing an insert for the mongoDB database, etc.
Further, in a test environment, data under a certain specific scenario is constructed according to requirements, and operation targets which can be selected by the operation steps are as follows:
(i) some interfaces of the test environment are called (such as an http interface, or interfaces of the type thrift, protobuf, etc.). In the present embodiment, for example: and calling an http protocol interface, specifically dividing the http protocol interface into a get protocol and a post protocol, and returning a result in a json format.
(ii) Data modification, addition, deletion, modification and check are directly carried out in a storage system (the storage system can be a relational database similar to mysql, a document database similar to mongoDB or a key-value database similar to redis and the like generally). In the present embodiment, for example: the direct action in the mysql database can be specifically divided into several different operations of adding, deleting, changing and searching, wherein the content of the operation is a specific row of records.
Further, combining the targets of the above operations with the information of the three parts of the table, a rule template can be formed for data construction.
Further, the operation steps are associated (concatenated) with the form information, and the operation steps are associated (concatenated) with the operation steps.
Specifically, the specific character string in the rule description of the operation step includes: indicating a character string $ { form: key } of key information key input in a form page so as to associate the operation step with the form information; a character string $ { step number N: key } indicating an output result key of the operation step whose step number is N before the operation step is performed, to associate the operation step with the operation step. Thus, when the operation step is executed, if the character string $ { form: key } appears in the executed operation step, the actual value of the key information key input in the form page can be replaced; when the operation step is executed, if the character string $ { step serial number N: key } appears in the executed operation step, the value of the output result key of the operation step N can be replaced.
For example, when rule description of the configuration operation step is performed, a specific character string is set to be associated with a certain key in the form information, for example, the key may be key information input by a user, which is obtained by the form information through a form page, so that when the operation step is performed, an actual value of the key information key input in the form page and submitted through the form page is replaced with a value of the key required in the execution of the operation step (that is, a specific character string of the indication key is replaced with a value of the actual key); and a specific character string is set to be associated with a certain key in a result after an operation is executed in a certain operation step (identified by a step serial number N) before the operation step, so that certain output information, namely a key value, in an output result of the operation step N can be provided for the operation step (namely the specific character string of the key is indicated and replaced by an actual key value) to be executed and used when the operation step is executed.
And when the data construction is executed, generating a webpage form page based on the form information so as to fill in key information in the form information. Specifically, the system platform renders and generates a form page by analyzing two sheets of basic information and form information in the excel form, provides the form page for a user such as a tester to fill in the filling-in key information, and submits the filling-in key information after the completion of filling in.
The system platform receives the key information submitted by the form page.
And step S120, analyzing the operation steps described by the rule through the excel table, and selecting the corresponding operation targets according to the keywords described in the operation steps to execute the operation steps.
Wherein the operational objectives include at least: invoking one or more interface targets of a test environment; and/or, data modification is performed in the storage system.
The keywords described in the operation steps, i.e. the keywords of the operation steps, such as mysql _ insert, http _ get, etc., determine, by such short keywords, what way the current line (operation step) in the excel table should be parsed and operated on. Keywords include information in the headers of tables such as databases or interfaces. Specifically, the system platform analyzes operation steps in the excel table, and executes each operation step of the table step by step, wherein each operation step includes storing a system target or an interface target for a corresponding database, operating the targets, calling the interface, calling the database, and the like. For example: calling an http protocol interface, wherein the http protocol interface is specifically divided into different protocols of get and post; or, the direct action in the mysql database can be specifically divided into addition, deletion, modification, search and the like.
Step S130, when the operation step is executed, replacing the value of the specific character string in the rule description of the executed operation step based on the key information input in the form page and the result of the previous operation step.
The key information input in the form page is input by a user or a tester through the webpage form page, and the key information is submitted after being input and is returned to the system platform for use. When each operation step of the operation step table is executed, it has a corresponding operation target, such as calling an interface or acting on a database. And further, carrying out value substitution on a specific character string in the rule description of the operation step based on the key information input in the form page and the result of the previous operation step.
The specific character string in the rule description due to the operation steps includes: and a character string $ { form: key } indicating key information key input in the form page establishes association between the operation steps and the form information (form page). Thus, when the operation step is executed, if the character string $ { form: key } appears in the executed operation step, the actual value of the key information key input in the form page can be replaced.
In one embodiment, when any operation step is executed, a character string (substring) such as $ { form: key } appears in the complete character string in the description of the operation step, and the value of the key actually submitted in the key information of the single page is used to replace the current character string. As an example, the actually submitted values of the key information entered in the form page may be: the key input is the mobile phone number 12345678, and replaces the $ { form: key } character string appearing in the operation step executed, for example: will $ { form: phone No. } was replaced with 12345678, and the string appearing $ { form: phone No. means that the operating steps are executed to this point, requiring the actual submitted telephone number in the form page.
The specific character string in the rule description due to the operation steps includes: a string $ { step number N: key } indicating an output result key of the operation step whose step number before the operation step is performed is N, and an association between the operation step and the operation step is established. Thus, when the operation step is executed, if the character string $ { step serial number N: key } appears in the executed operation step, the value of the output result key of the operation step N can be replaced.
In one embodiment, when any step is executed, if a character string in the form of $ { step serial number: key } appears in the complete character string in the description of the step, the value of the key in the output result executed by the operation step with the step serial number indicating the serial number is used to replace the character string of the current indicated key whose value needs to be taken. For example, if the sequence number of the step is N, the step is represented as the nth operation step, so that the value corresponding to the key in the result after the nth operation step is executed is substituted for the current character string. For example, the value of the key corresponding to certain information in the output result of the operation step of the step number N may be: the output result of the operation step with the step number of 25 includes a user number "a", a key "B", and a file number "C", and replaces the $ { step number N: key } character string appearing in the executed operation step, for example: the replacement of $ {25: file number } by C means that the operation step is executed to here, and the file number in the result output by the operation step No. 25 is needed.
Step S140, debugging information of each operation step is output to complete data construction.
And outputting debugging information after each operation step is executed, so that operation results output after the corresponding operation steps are executed can exist, and the like, wherein the values of replaceable keys are included.
Wherein the debug information includes at least: description of operation steps, parameters of the replaced actual operation steps and operation results. Thereby, the data construction is completed.
Referring to fig. 2, an embodiment of a data structuring system described by the rule in excel according to the present application includes:
the analysis generating unit 210 is configured to analyze the basic information and the form information described by the rule through the excel table to generate a form page. The parsing executing unit 220 is configured to parse the operation steps described by the rule through the excel table, so as to select a corresponding operation target according to the keyword described in the operation steps to execute each operation step. A replacing unit 230, configured to, when the operation step is executed, replace a value of a specific character string in the rule description of the executed operation step based on the key information input in the form page and a result of a previous operation step. And an output unit 240 for outputting the debugging information of each operation step to complete the data construction.
The system further comprises a receiving unit (not shown) for receiving the key information from the form page submission.
Specifically, the rule description through the excel table is performed by firstly establishing the excel table and performing the rule description through the excel, so that the rule management and description can be performed through the excel table, that is, a rule template is designed and managed and maintained.
In one embodiment, an created excel table is used for rule description, and the excel table mainly includes three pieces (sheet) of information, for example: basic information, form information and operation steps.
Further, the basic information comprises the role of rule description and maintainers; and/or the form information comprises key information required when the operation steps manually filled by the user are executed; and/or the operation steps comprise that each step corresponds to an individual operation, each individual operation has a corresponding operation target, and each operation step is provided with a corresponding parameter. The method specifically comprises the following steps:
1. basic information: the role of the template (e.g., constructing account information for a test user), a maintainer, etc.
2. Form information: some of the information is information that needs to be manually filled by a user (e.g., a tester) during data construction, and the information is used as key information when the operation step is performed, so as to complete the data construction of the test.
3. The method comprises the following operation steps: each step is a separate operation, such as triggering an http request, or performing a lookup for mysql, or performing an insert for the mongoDB database, etc.
Further, in a test environment, data under a certain specific scenario is constructed according to requirements, and operation targets which can be selected by the operation steps are as follows:
(i) some interfaces of the test environment are called (such as an http interface, or interfaces of the type thrift, protobuf, etc.). In the present embodiment, for example: and calling an http protocol interface, specifically dividing the http protocol interface into a get protocol and a post protocol, and returning a result in a json format.
(ii) Data modification, addition, deletion, modification and check are directly carried out in a storage system (the storage system can be a relational database similar to mysql, a document database similar to mongoDB or a key-value database similar to redis and the like generally). In the present embodiment, for example: the direct action in the mysql database can be specifically divided into several different operations of adding, deleting, changing and searching, wherein the content of the operation is a specific row of records.
Further, combining the targets of the above operations with the information of the three parts of the table, a rule template can be formed for data construction.
Further, the operation steps are associated (concatenated) with the form information, and the operation steps are associated (concatenated) with the operation steps.
Specifically, the specific character string in the rule description of the operation step includes: indicating a character string $ { form: key } of key information key input in a form page so as to associate the operation step with the form information; a character string $ { step number N: key } indicating an output result key of the operation step whose step number is N before the operation step is performed, to associate the operation step with the operation step. Thus, when the operation step is executed, if the character string $ { form: key } appears in the executed operation step, the actual value of the key information key input in the form page can be replaced; when the operation step is executed, if the character string $ { step serial number N: key } appears in the executed operation step, the value of the output result key of the operation step N can be replaced.
For example, when rule description of the configuration operation step is performed, a specific character string is set to be associated with a certain key in the form information, for example, the key may be key information input by a user, which is obtained by the form information through a form page, so that when the operation step is performed, an actual value of the key information key input in the form page and submitted through the form page is replaced with a value of the key required in the execution of the operation step (that is, a specific character string of the indication key is replaced with a value of the actual key); and a specific character string is set to be associated with a certain key in a result after an operation is executed in a certain operation step (identified by a step serial number N) before the operation step, so that certain output information, namely a key value, in an output result of the operation step N can be provided for the operation step (namely the specific character string of the key is indicated and replaced by an actual key value) to be executed and used when the operation step is executed.
And when the data construction is executed, generating a webpage form page based on the form information so as to fill in key information in the form information. Specifically, the system platform renders and generates a form page by analyzing two sheets of basic information and form information in the excel form, provides the form page for a user such as a tester to fill in the filling-in key information, and submits the filling-in key information after the completion of filling in.
The system platform receives the key information submitted by the form page.
Specifically, in the parsing executing unit 220, the operation targets at least include: invoking one or more interface targets of a test environment; and/or, data modification is performed in the storage system. The keywords described in the operation steps, i.e. the keywords of the operation steps, such as mysql _ insert, http _ get, etc., determine, by such short keywords, what way the current line (operation step) in the excel table should be parsed and operated on. Keywords include information in the headers of tables such as databases or interfaces. Specifically, the system platform analyzes operation steps in the excel, and executes each operation step of the table step by step, wherein each operation step includes storing a system target or an interface target for a corresponding database, operating the targets, calling the interface, calling the database, and the like. For example: calling an http protocol interface, wherein the http protocol interface is specifically divided into different protocols of get and post; or, the direct action in the mysql database can be specifically divided into addition, deletion, modification, search and the like.
Specifically, in the replacing unit 230, the key information input in the form page is input by the user or tester through the web form page, and the information is submitted and returned to the system platform for use after being input. When each operation step of the operation step table is executed, it has a corresponding operation target, such as calling an interface or acting on a database. And further, carrying out value substitution on a specific character string in the rule description of the operation step based on the key information input in the form page and the result of the previous operation step.
The specific character string in the rule description due to the operation steps includes: and a character string $ { form: key } indicating key information key input in the form page establishes association between the operation steps and the form information (form page). Thus, when the operation step is executed, if the character string $ { form: key } appears in the executed operation step, the actual value of the key information key input in the form page can be replaced.
In one embodiment, when any operation step is executed, a character string (substring) such as $ { form: key } appears in the complete character string in the description of the operation step, and the value of the key actually submitted in the key information of the single page is used to replace the current character string. As an example, the actually submitted values of the key information entered in the form page may be: the key input is the mobile phone number 12345678, and replaces the $ { form: key } character string appearing in the operation step executed, for example: will $ { form: phone No. } was replaced with 12345678, and the string appearing $ { form: phone No. means that the operating steps are executed to this point, requiring the actual submitted telephone number in the form page.
The specific character string in the rule description due to the operation steps includes: a string $ { step number N: key } indicating an output result key of the operation step whose step number before the operation step is performed is N, and an association between the operation step and the operation step is established. Thus, when the operation step is executed, if the character string $ { step serial number N: key } appears in the executed operation step, the value of the output result key of the operation step N can be replaced.
In one embodiment, when any step is executed, if a character string in the form of $ { step serial number: key } appears in the complete character string in the description of the step, the value of the key in the output result executed by the operation step with the step serial number indicating the serial number is used to replace the character string of the current indicated key whose value needs to be taken. For example, if the sequence number of the step is N, the step is represented as the nth operation step, so that the value corresponding to the key in the result after the nth operation step is executed is substituted for the current character string.
For example, the value of the key corresponding to certain information in the output result of the operation step of the step number N may be: the output result of the operation step with the step number of 25 includes a user number "a", a key "B", and a file number "C", and replaces the $ { step number N: key } character string appearing in the executed operation step, for example: the replacement of $ {25: file number } by C means that the operation step is executed to here, and the file number in the result output by the operation step No. 25 is needed.
Specifically, in the output unit 240, the debugging information is output after each operation step is executed, so that there may be an operation result and the like output after the corresponding execution step, which further includes a value of a key that can be replaced and the like. Wherein the debug information includes at least: description of operation steps, parameters of the replaced actual operation steps and operation results. Thereby, the data construction is completed.
Referring to fig. 3, a method and a system of the present application are further illustrated according to a flowchart of an embodiment of the present application applied in a test environment scenario.
In the process of testing a product, a tool and the like, the testing is performed based on a 'testing environment', and the testing environment is an offline environment used when testing is performed before the product is released. The data required in the test environment is created by the tester. For example, in a scenario where "user login" needs to be tested, it needs to verify whether a page is responded correctly under different conditions such as no user name, correct user name and password, and wrong password. Thus, data meeting these three combinations of conditions needs to be prepared before testing. The present application is further described below.
First, rule description is performed by excel.
The preset data configuration selects two targets (other types of targets can be done in the same way): 1. the http protocol interface is specifically divided into different protocols of get and post, and the returned result is in a json format; 2. the mysql database is divided into operations of adding, deleting, changing and searching, wherein the content of the operation is a specific line of records.
Specifically, taking test data of a scene of "constructing user account data" as an example, there may be 2 operation steps in the construction process:
1. calling an existing registration interface of the test environment, and setting a user name (mobile phone number) and a password;
2. the value of the column "active status" is modified in the database to 1 according to the previous username id.
The method for combining these two objects and operations for data construction is the rule template, where the template is managed and maintained by excel building. The excel table is mainly composed of 3 pieces of information (Sheet):
1. basic information: this is mainly used to describe the role of the rule template (e.g. constructing account information of a test user), the maintainer, etc.
In the example of "construct user account data", the basic information part is set as follows:
title Description of the invention Authors refer to
User registration and activation Creating a test user and setting an activation status Zhang San
2. Form information: this section of information may completely describe what information is manually filled in by the user when constructing the test data for a scene.
In this example, the simulation of a user's registration behavior is implemented by invoking a registration interface, which requires information such as a mobile phone number and a password, and requires the user (tester) to provide the information in a form, rather than automatically generating the information, so that the data needs to be described in a rule template for automatically generating a form page on a web page during data construction.
There may be multiple items of form information to be filled in, there may be different types of form elements, such as single line text boxes, multi-line text boxes, radio boxes, etc., or there may be portions of the form information that have default values, such as a password that we can default to a default password of 123456.
In Sheet of form information of excel table, each line can be set to be description of a form element, including form id, necessity of selection, type, parameter, default value, description information and the like. The type can be selected from a single-line text box, a multi-line text box and the like, and the format of the parameter is different according to different types.
In the example of "construct user account data", a description sample of form information:
Figure BDA0001930159300000141
3. the method comprises the following operation steps: each operation step is a separate operation, such as triggering an http request, or performing a lookup for mysql, or performing an insertion for the mongoDB database, etc., so that the operation step is a core of the rule template, and depending on the configuration of the operation step, the automatic generation of the whole data construction process can be completed. For each operation of http get, post and database, different parameters need to be set in the operation steps.
The following table is an example of a header in a table of established operational steps, but this example should not be taken as a limitation on the embodiments of the method and system of the present application. The content of the header can prompt how to fill each column under different keyword rules (other operation types can also be set according to needs, such as mongo _ insert, redis _ update, and the like):
Figure BDA0001930159300000151
the following cells will refer to these prompts to fill in the different parameters required for the operation step in the different columns. The following is an example of several operational steps, but this example should not be construed as limiting the embodiments of the method and system of the present application.
A url get operation step that does not depend on any external data, such as:
Figure BDA0001930159300000152
equivalent to initiating a get request to the url in the table.
A url post operation step that does not depend on any external data, such as:
Figure BDA0001930159300000153
equivalently, a post request is initiated for url in the table, with parameters id 10 and status 1.
A database (mysql) that does not depend on any external data inserts insert operation steps, such as:
Figure BDA0001930159300000154
equivalent to executing the sql statement:
USE db_user;
INSERT INTO table_user(phone,password)values('13500000000','123456');
a database update operation step, for example:
Figure BDA0001930159300000161
equivalent to executing the sql statement:
USE db_user;
UPDATE table_user SET status=1,type=2WHERE id=10limit 1;
a database Select operation step, for example:
Figure BDA0001930159300000162
equivalent to executing the sql statement:
USE db_user;
SELECT*FROM table_user WHERE type=2AND status=1ORDER BY create_time DESC;
a database Delete operation step, for example:
Figure BDA0001930159300000163
equivalent to executing the sql statement:
USE db_user;
DELETE FROM table_user WHERE id=10LIMIT 1;
therefore, when the operation steps are formally configured for the test data to be configured in the excel form (for example, in the case of "configuring user account data"), the contents of the header can be referred to, for example, a suitable keyword is selected from the first column of the excel form, one way can be to select a specified keyword (for example, mysql _ insert, mysql _ update, url _ get, etc.) by means of a pull-down menu, the following columns are filled as required, for example, the operation of mysql is performed, the database and the table information (host, port, user name, password for operating the database are additionally configured in the program code of the platform), and the corresponding columns are respectively filled according to which operation is adding, deleting, modifying or checking.
Further, operations such as mysql may also be restricted to affect only one row of data at most, for example: the operation of deleting data by mistake, changing data by mistake and the like caused by rule setting errors is limited by the limit word limit in the mysql, the influence surface can be reduced by only limiting the operation to 1, and in addition, the condition that a plurality of data are returned after the operation is executed is limited to 1, which also contributes to the consistency of the operation steps.
In the process of configuring the operation steps, in addition to http get, post, database addition, deletion, modification and check and the like, abstraction is performed through a table form, and a mechanism (association) for performing series connection on the operation steps is further added in the table configuration description. Specifically, association may be performed between the operation step and the form information, and association may also be performed between the operation step and the operation step.
Association of operation steps with form information, such as a get operation for http:
url _ get rule url
url_get http://demo.anjuke.com/test/get-some-data?id=1
The id parameter cannot be 1 every time, but the operation step needs to be executed according to the id actually filled by the user in the form page generated by the form information, and at this time, the form information in the rule template can be configured as:
Figure BDA0001930159300000171
thus, during the test data construction process, a form page in the form of a web page is generated to be filled in by a tester (user), for example, a text box on the form page corresponds to a value of data id required to be input by the user during the data construction. Thus, in the http get operation, this id needs to be used, and then the rule description of the previous operation step is modified to associate the form information, and the actual input id value is needed to execute the step, for example:
url _ get rule url
url_get http://demo.anjuke.com/test/get-some-data?id=${form:id}
Here, the original id is 1, and the actual value of the element id in the form information is mapped in a manner $ { form: id }, so that the dependency relationship between the form information (especially the key information that needs to be input by the user) and the operation procedure is realized.
The association between an operation step and an operation step, for example, a part of parameters of a certain operation step in the execution of an operation, depends on the execution result of the operation in a certain previous operation step.
In a manner similar to $ { form: key name } depending on the form information, we can also refer to the operation execution result of one of the preceding operation steps in a manner such as $ { step number: key name }.
For example: one operation step is http get, post, then the result of executing the operation is easily defined, namely the actual json result of the http request.
Assuming that the first operation step (i.e. step number N equals 1) of all operation steps is an http get request, the return value after execution is:
Figure BDA0001930159300000181
then, in the operation step subsequent to the first operation step, the result of a certain field in the result returned after the operation step is executed needs to be used, and we can replace the result by $ { step sequence number: key of step }.
For example, we can use $ {1: total } to obtain the total value therein (i.e., 23457). For json, we do a hierarchical traversal by the symbol ". In the same result, for example, to obtain the value of broker _ id, it may use $ {1: items.0.broker _ id } for association, that is, key keys of different elements in a plurality of output results may be used, where 0 represents in a list-type sub-structure, and the character string is the actual value of broker _ id after each execution under the 0 th sub-element, and so on.
Assuming that the operation step is the operation on mysql, the result of the execution of the adding, changing and checking operation is defined as the actual value of the row of data after the operation, and the result of the execution of the deleting operation is the value before the deletion. For example, the operation step is an insert operation on the database:
Figure BDA0001930159300000191
after the insertion operation is performed, a new piece of data is added to the demo _ table data table in the demo _ db database (other fields are not known, and may be generated by adding int or setting a default value). After this step is performed, a new piece of data with name of demo _ name, area of demo _ area, and price of 100 is added to the data table, and other fields in the piece of data may be set with self-increment or default values, such as id of 10 and status of 0.
If the insertion operation is the 2 nd step of all the steps, i.e. the step number N is 2, when the id (i.e. 10) needs to be used in the following operation step X, although the value of the id is not known to be 10 before the operation step X is actually executed, after $ {2: id } is set to be used, the operation step X is executed, and the actual value is replaced with 10. For example, in the following update operation step X, status is modified to other values:
Figure BDA0001930159300000192
when the operation step X is executed, the value of id in the output result with the sequence number of 2 in the step is replaced by the value of id in the output result with the sequence number of 2, namely the value of id after the previous insert data.
And then, operating a data construction program, analyzing the basic information and the form information in the rule description through the excel form by the operating platform, rendering and generating a form page of a webpage which can be filled by a user, submitting the form page after the form page is filled by the user, and receiving the submitted key information input to the form page.
And then, the operation platform analyzes the operation steps in the rule description performed through the excel table, executes the operation steps step by step, calls an interface or operates a database and the like, and returns the result output after operation processing. When a certain operation step is executed, the step description is replaced if a specific character string appears. Specifically, one case is $ { form: key } or $ { form: key1, key2 … … key }, the character string is replaced by the value corresponding to the key (or key1, key2 … … key) actually submitted in the form information; another case is $ { step number: key or $ { step number: key1, key2 … … key } and the like, the value of one or more elements, namely key (or key1, key2, key and the like) in the result output after the Nth operation step before the operation step, with the corresponding step serial number N, in the character string is replaced by the value of the key required in the operation step.
Finally, debugging information is output after each operation step is executed, wherein the debugging information comprises step description, actual operation step parameters after replacement, results after operation execution and the like, and therefore the construction of the whole test data is completed.
Because the rules are described (rule templates are constructed) by establishing the excel table, the establishment, management and maintenance of the excel are simpler, more convenient and more efficient, and by means of the excel rule description, a correlation mechanism can be established among the information for data construction, and the platform is easier to analyze when the data construction is carried out. Thus, program code need not be developed each time to be automatically reconstructed.
Furthermore, when data construction is carried out, the platform can automatically generate a form page according to main basic information and form information in the excel rule description, the analysis is simple and rapid, the use by other people is facilitated, and the team can share the experience of data construction. Furthermore, each link and each operation step of the data construction can output all executed results and other information, and each link and operation step can be conveniently positioned.
With this understanding, a server associated with an embodiment of the method implemented by the present application includes a processor and a memory, the memory is configured to store a processing program for each step of an embodiment of the method, and the processor is configured to execute the program stored in the memory.
Based on such understanding, all or part of the flow in one embodiment of the method implemented by the present application may also be implemented by a computer program, which may be stored in a computer-readable storage medium and can implement the steps of the above method embodiments when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying said computer program code, medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all changes and modifications that fall within the scope of the specification. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (18)

1. A data construction method for rule description through an excel table comprises the following steps:
analyzing basic information and form information which are regularly described through an excel form to generate a form page;
analyzing the operation steps described by the rule through the excel table, and selecting corresponding operation targets according to the keywords described in the operation steps to execute the operation steps;
when the operation step is executed, based on the key information input in the form page and the result of the previous operation step, replacing a specific character string in the rule description of the executed operation step, specifically including: the specific character string in the rule description of the operation step includes: indicating a character string $ { form: key } of key information key input in a form page so as to associate the operation step with the form information; a character string $ { step number N: key } indicating an output result key of the operation step whose step number is N before the operation step is performed, to associate the operation step with the operation step; when the operation step is executed, replacing the character string $ { form: key } appearing in the executed operation step with the actual value of the key information key input in the form page; when the operation step is executed, replacing the character string $ { step serial number N: key } appearing in the executed operation step with the value of the output result key of the operation step N;
and outputting debugging information of each operation step to complete data construction.
2. The method according to claim 1, wherein the rule description by excel comprises:
and establishing the excel form and describing rules, wherein the excel form comprises basic information, form information and operation steps.
3. The method of claim 2, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the basic information comprises the role and maintainer described by the rule;
the form information comprises key information required when the operation steps which need to be manually filled by the user are executed;
the operation steps include: each operation step corresponds to an independent operation, each independent operation has a corresponding operation target, and each operation step is provided with a corresponding parameter;
and associating the operation steps with the form information according to the specific character strings, and associating the operation steps with the operation steps according to the specific character strings.
4. The method of claim 3, the operational objectives comprising at least:
invoking one or more interface targets of a test environment; and/or the presence of a gas in the gas,
data modification is performed in the storage system.
5. The method of claim 4, generating a form page, comprising:
and generating a webpage form page based on the form information so as to fill in key information in the form information.
6. The method of claim 5, further comprising:
and receiving key information submitted by the form page.
7. The method according to claim 1, wherein the operation steps described by the rule through the excel table are analyzed to select the corresponding operation target according to the keyword in the operation steps to execute each operation step, and the method comprises the following steps:
and executing each operation step of the excel table step by step, and operating the corresponding database storage system target or interface target.
8. The method of claim 1, outputting debug information for each step to complete data construction, comprising:
after each operation step is executed, debugging information is output to complete data construction;
wherein the debug information includes at least: description of operation steps, actual operation step parameters after replacement and operation results.
9. A data construction system for rule description through excel tables, comprising:
the analysis generating unit is used for analyzing the basic information and the form information which are regularly described through the excel form so as to generate a form page;
the analysis execution unit is used for analyzing the operation steps described by the rule through the excel table so as to select corresponding operation targets according to the keywords described in the operation steps to execute the operation steps;
a replacing unit, configured to, when the operating step is executed, replace a specific character string in a rule description of the executed operating step based on key information input in the form page and a result of a previous operating step; the specific character string in the rule description of the operation step includes: indicating a character string $ { form: key } of key information key input in a form page so as to associate the operation step with the form information; a character string $ { step number N: key } indicating an output result key of the operation step whose step number is N before the operation step is performed, to associate the operation step with the operation step; when the operation step is executed, replacing the character string $ { form: key } appearing in the executed operation step with the actual value of the key information key input in the form page; when the operation step is executed, replacing the character string $ { step serial number N: key } appearing in the executed operation step with the value of the output result key of the operation step N;
and the output unit is used for outputting the debugging information of each operation step to complete data construction.
10. The system according to claim 9, wherein said rule description by excel further comprises:
and establishing the excel form and describing rules, wherein the excel form comprises basic information, form information and operation steps.
11. The system of claim 10, wherein the first and second sensors are arranged in a single unit,
the basic information comprises the role and maintainer described by the rule; and/or the presence of a gas in the gas,
the form information comprises key information required when the operation steps which need to be manually filled by the user are executed;
the operation steps include: each operation step corresponds to an independent operation, each independent operation has a corresponding operation target, and each operation step is provided with a corresponding parameter;
and associating the operation steps with the form information according to the specific character strings, and associating the operation steps with the operation steps according to the specific character strings.
12. The system of claim 11, the operational objectives comprising at least:
invoking one or more interface targets of a test environment; and/or the presence of a gas in the gas,
data modification is performed in the storage system.
13. The system of claim 12, the parsing generation unit, further comprising:
and the webpage is used for generating a webpage form page based on the form information so as to fill out key information in the form information.
14. The system of claim 13, further comprising:
and the receiving unit is used for receiving the key information submitted by the form page.
15. The system of claim 9, the parsing execution unit, further comprising:
and each operation step for executing the excel table step by step is used for operating the corresponding database storage system target or interface target.
16. The system of claim 9, the output unit, further comprising:
the debugging device is used for outputting debugging information after each operation step is executed so as to complete data construction; wherein the debug information includes at least: description of operation steps, actual operation step parameters after replacement and operation results.
17. A server, comprising a processor and a memory:
the memory is used for storing a program for executing the method of any one of claims 1 to 8;
the processor is configured to execute programs stored in the memory.
18. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN201811636432.6A 2018-12-29 2018-12-29 Data construction method and system for rule description through excel Active CN109857735B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811636432.6A CN109857735B (en) 2018-12-29 2018-12-29 Data construction method and system for rule description through excel

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811636432.6A CN109857735B (en) 2018-12-29 2018-12-29 Data construction method and system for rule description through excel

Publications (2)

Publication Number Publication Date
CN109857735A CN109857735A (en) 2019-06-07
CN109857735B true CN109857735B (en) 2021-05-04

Family

ID=66893290

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811636432.6A Active CN109857735B (en) 2018-12-29 2018-12-29 Data construction method and system for rule description through excel

Country Status (1)

Country Link
CN (1) CN109857735B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111931471B (en) * 2020-08-31 2024-04-16 平安银行股份有限公司 Form collection method, form collection device, electronic equipment and storage medium
CN115081416B (en) * 2022-08-23 2022-12-06 中科科界(北京)科技有限公司 Voting generation method and device based on file parsing transcoding and configuration

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103778107A (en) * 2012-10-25 2014-05-07 上海宝信软件股份有限公司 Method and platform for quickly and dynamically generating form based on EXCEL
CN103970737A (en) * 2013-01-24 2014-08-06 腾讯科技(深圳)有限公司 Data constitution method and device
CN107729003A (en) * 2017-11-20 2018-02-23 江苏神州信源系统工程有限公司 Automatic generation method, device and the electronic equipment of code
CN108268525A (en) * 2016-12-30 2018-07-10 深圳市优朋普乐传媒发展有限公司 A kind of report implementation method and device based on Excel template

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103778107A (en) * 2012-10-25 2014-05-07 上海宝信软件股份有限公司 Method and platform for quickly and dynamically generating form based on EXCEL
CN103970737A (en) * 2013-01-24 2014-08-06 腾讯科技(深圳)有限公司 Data constitution method and device
CN108268525A (en) * 2016-12-30 2018-07-10 深圳市优朋普乐传媒发展有限公司 A kind of report implementation method and device based on Excel template
CN107729003A (en) * 2017-11-20 2018-02-23 江苏神州信源系统工程有限公司 Automatic generation method, device and the electronic equipment of code

Also Published As

Publication number Publication date
CN109857735A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
US20230385321A1 (en) Systems and methods for processing a natural language query in data tables
CN104866426B (en) Software test integrated control method and system
KR102214297B1 (en) Conditional validation rules
US20140075242A1 (en) Testing rest api applications
US20160224594A1 (en) Schema Definition Tool
US9588742B2 (en) Rule-based automatic class generation from a JSON message
CN109800258A (en) Data file dispositions method, device, computer equipment and storage medium
CN111679979B (en) Destructive testing method and device
CN109857735B (en) Data construction method and system for rule description through excel
CN109324960A (en) Automatic test approach and terminal device based on big data analysis
CN114036425A (en) Page access method, client, server and system
US20210124752A1 (en) System for Data Collection, Aggregation, Storage, Verification and Analytics with User Interface
CN110309214A (en) A kind of instruction executing method and its equipment, storage medium, server
JP2019101889A (en) Test execution device and program
CN111459943A (en) Data processing method, device, system, equipment and storage medium
CN110866054A (en) Label configuration method and device and computer storage medium
US11989503B2 (en) Formula generation by example
CN111638926A (en) Method for realizing artificial intelligence in Django framework
CN112417020B (en) Service expansion realization method, device, computer equipment and storage medium
CN114328525A (en) Data processing method and device
CN114528218A (en) Test program generation method, test program generation device, storage medium, and electronic device
CN114416547A (en) Test case based test method
CN113536762A (en) JSON text comparison method and device
CN111625472A (en) Unit testing method and device
CN115599976B (en) User grouping method, device, electronic equipment and storage medium

Legal Events

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