Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and a system for batch customizing of variables, which implement data separation between test data and automation scripts, and can perform batch parameterization assignment on variable names quickly.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
in a first aspect, an embodiment of the present invention provides a method for batch quantizing a user-defined variable, including the following steps:
establishing an assignment table, importing case information into the assignment table, enabling the case information of the assignment table to comprise file positions, file paths, work table numbers and case names of cases, setting the case names as row query indexes, and setting variable names of variables to be customized at the top end of the assignment table;
analyzing the parameter name of the case information, positioning a form tab of the case information, and finding a case position of a variable to be customized;
searching for parameter values identical to the row query index, taking rows of the parameter values as test data rows, wherein variable values of the test data rows respectively correspond to variable names at the top ends of the assignment tables;
executing custom variables on the test data row, and circularly assigning all variable values of the test data row to the variable names at the top end of the assignment table.
Further, the file location includes a project location and a home location, the project location corresponding to a relative path of the file path, and the home location corresponding to an absolute path of the file path.
Further, the parsing of the parameter name comprises POI type parsing, and the form tab is determined by the working table number.
Further, the variable names comprise variable name suffixes, multiple groups of variable names with different data are defined through the variable name suffixes, and different variable name assignments are circularly completed through filling values of the variable name suffixes.
And further, completing data separation of the test data and the automation script through the assignment table, and directly maintaining the data through a column corresponding to the test data in the assignment table when the test data has newly added, modified and deleted fields or values.
On the other hand, an embodiment of the present invention further provides a system for quantifying custom variables in batches, including:
the table information transmission module is used for importing case information into an assignment table, enabling the case information of the assignment table to comprise a file position, a file path, a working table number and a case name of a case, setting the case name as a row query index, and setting a variable name of a variable to be customized at the top of the assignment table;
the parameter name analysis module is used for analyzing the parameter name of the case information, positioning a form tab of the case information and finding out the case position of the variable to be customized;
the test data positioning module is used for searching for the parameter values which are the same as the row query indexes, taking the rows of the parameter values as test data rows, and enabling variable values of the test data rows to respectively correspond to variable names at the top ends of the assignment tables;
and the parameterization execution module is used for executing the self-defined variables on the test data row and circularly assigning all variable values of the test data row to the variable names at the top end of the assignment table.
Further, the table information delivery module includes a file location management unit that determines a project location and a home location of the file location, the project location corresponding to a relative path of the file path and the home location corresponding to an absolute path of the file path.
Furthermore, the parameter name analysis module comprises a fuzzy implementation unit, which is used for carrying out POI class analysis on the parameter names and determining the form tab according to the work table number.
Furthermore, the parameter name analysis module further comprises a suffix name setting unit, wherein the variable names comprise variable name suffixes, a plurality of groups of variable names with different data are defined through the suffix name setting unit, and different variable name assignments are circularly completed through filling values of the variable name suffixes.
Furthermore, the system separates the test data from the data of the automation script through the assignment table, and when the test data has fields or values which are added, modified and deleted, the data maintenance is directly carried out through the columns corresponding to the test data in the assignment table.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the invention discloses a method and a system for batch self-defining of variables, which realize the data separation of test data and automation scripts, maintain parameterized test data in an assignment table in the process of self-defining of the variables, take scene identification of case names as row indexes, store variable values in corresponding row subsequent cells, assign row cells to store variable names, query the scene identification to corresponding row data variable values when executing, assign the values to variable names in the same column one by one, and realize the batch parameterization assignment of the self-defining variables. Due to the separation of the test data and the automation script, the efficiency of the user-defined variable is improved remarkably, only one step is needed no matter how many fields need parameterization, the execution time is greatly shortened, and the human efficiency is improved; the change of the test data does not affect the script, the speed of newly adding, modifying and deleting fields or values is improved, only corresponding columns are needed to be newly added, modified and deleted, and the later-period automatic maintenance cost is reduced; through the unified management of the functional test data and the automatic test data, the data sharing between the functional test data and the automatic test data is realized; due to the complete separation of script maintenance and data maintenance, data can be directly maintained in the assignment table, and the requirement standard for the skills of personnel is reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
as shown in fig. 1, this embodiment provides a method for batch quantizing a custom variable, including the following steps:
s1: establishing an assignment table, importing case information into the assignment table, enabling the case information of the assignment table to comprise file positions, file paths, work table numbers and case names of cases, setting the case names as row query indexes, and setting variable names of variables to be customized at the top end of the assignment table;
s2: analyzing the parameter name of the case information, positioning a form tab of the case information, and finding a case position of a variable to be customized;
s3: searching for parameter values identical to the row query index, taking rows of the parameter values as test data rows, wherein variable values of the test data rows respectively correspond to variable names at the top ends of the assignment tables;
s4: executing custom variables on the test data row, and circularly assigning all variable values of the test data row to the variable names at the top end of the assignment table.
Specifically, in the process of customizing variables, parameterized test data is maintained in an assignment table, so that case information of the assignment table comprises file positions, file paths, work table numbers and case names of cases, a scene identifier of the case name is used as a row index, variable values are stored in corresponding row subsequent cells, the row cells are assigned to store variable names, the scene identifier is inquired to the corresponding row of data variable values when the execution is carried out, the values are assigned to the variable names in the same column one by one, and the batch parameterized assignment of the customized variables is realized. Due to the separation of the test data and the automation script, the efficiency of the user-defined variable is improved remarkably, only one step is needed no matter how many fields need parameterization, the execution time is greatly shortened, and the human efficiency is improved; the change of the test data does not affect the script, the speed of newly adding, modifying and deleting fields or values is improved, only corresponding columns are needed to be newly added, modified and deleted, and the later-period automatic maintenance cost is reduced; data sharing between the functional test data and the automatic test data is realized through unified management of the functional test data and the automatic test data; due to the complete separation of script maintenance and data maintenance, data can be directly maintained in the assignment table, and the requirement standard for the skills of personnel is reduced.
Preferably, the file location comprises a project location and a home location, the project location corresponding to a relative path of the file path and the home location corresponding to an absolute path of the file path. Through two different paths, the corresponding assignment table can be quickly found, the parameterization process of the user-defined variable can be quickly carried out whenever, and the efficiency of the user-defined variable is improved.
Preferably, the resolution of the parameter name includes POI class resolution, and the form tab is determined by the work table number. The POI class analysis is called a POI ambiguity evaluation, that is, it is a simple fuzzy Implementation, and the simple fuzzy Implementation is used to analyze the parameter values corresponding to the file location, the file path, the work table number, and the case name in the assignment table, for example, when the assignment table of this embodiment is an Excel table, no matter the format of the table is xls or xlsx, the work table number can be quickly and accurately found through the POI class analysis, and then the table tab is determined.
Preferably, the variable names include variable name suffixes, multiple groups of variable names with different data are defined through the variable name suffixes, and different variable name assignments are circularly completed through filling values of the variable name suffixes. For example, for a test data row with a case name of "TC01" in an assignment table, the execution is to assign each column of data corresponding to the row to a variable name in the assignment table one by one, define different variable names for multiple groups of data, if a second group of variables is required to be defined, fill in a value with a suffix, for example, — 2", and add" -2 "after the assigned variable name is the value in the assignment table, so that the effect of assigning a variable value" 1 "to the variable name" var1-2", assigning a variable value" 2 "to the variable name" var2-2", and so on is achieved until the loop completes all columns of values. Therefore, compared with the prior art, the parameterization of all variable names can be quickly executed through the setting of the variable name suffix, the parameterization process only has one step, the execution time is greatly shortened, and the execution efficiency is improved.
Preferably, the data separation of the test data and the automation script is completed through the assignment table, and when the test data has fields or values which are added, modified and deleted, data maintenance is directly performed through columns corresponding to the test data in the assignment table. Specifically, in the conventional processing process, because the test data is in the automation script, each new, modified or deleted field or value of each test data needs to be maintained one by one, but according to the method for batch customization of variables disclosed by the embodiment of the invention, because the test data is separated from the data of the automation script, the name of the customized variable is in one row of the assignment table, and the name of each case is in a specific column, therefore, the data maintenance can be directly performed through the column corresponding to the test data in the assignment table, the maintenance time is shortened, the cost and the human efficiency of the data maintenance are obviously reduced, and because the data can be directly maintained in the assignment table, the requirement on the skill standard of personnel is reduced. In addition, by the method for customizing the variables in batches, data of the functional test and the automatic test are unified, for example, the functional test of a certain system is prepared for backing data, a table of original backing data can be combined with automation, the functional test and the automatic test are directly communicated, parameterization is separated because steps are the same, and an automatic script can be automatically generated by one key by adopting a program mode.
Example two:
as shown in fig. 2, this embodiment provides a system for batch quantizing custom variables, including:
the table information transmission module 1 is used for importing case information into an assignment table, enabling the case information of the assignment table to comprise a file position, a file path, a work table number and a case name of a case, setting the case name as a row query index, and setting a variable name of a variable to be customized at the top of the assignment table;
the parameter name analysis module 2 is used for analyzing the parameter names of the incoming case information, positioning form tabs of the case information and finding out the case positions of variables to be customized;
the test data positioning module 3 is used for searching for parameter values which are the same as the row query indexes, taking rows of the parameter values as test data rows, and enabling variable values of the test data rows to respectively correspond to variable names at the top ends of the assignment tables;
and the parameterization execution module 4 is used for executing the self-defined variables on the test data row and circularly assigning all variable values of the test data row to the variable names at the top end of the assignment table.
Specifically, based on an automated testing tool of self-research, package of custom variable keywords and reference of POI classes are performed, and considering that variables need to be defined more quickly and efficiently in an actual scene and test data is managed more reasonably, the embodiment is based on the above points in combination with optimization research and development of the actual scene, wherein a system for batched custom variables maintains parameterized test data in an assignment table in the process of assigning custom variable names, so that case information of the assignment table includes file positions, file paths, work table numbers and case names of cases, scene identifiers of the case names are used as row indexes, corresponding row subsequent cells store variable values, row cells store variable names, and when the system is executed, the scene identifiers are inquired into corresponding row data variable values, and the values are assigned to the variable names in the same column one by one, thereby realizing batched parameterized assignment of the custom variables. Due to the separation of the test data and the automation script, the efficiency of the user-defined variable is improved remarkably, and only one step is needed no matter how many fields need parameterization, so that the execution time is greatly shortened, and the human efficiency is improved; the change of the test data does not affect the script, the speed of newly adding, modifying and deleting fields or values is improved, only corresponding columns are needed to be newly added, modified and deleted, and the later-period automatic maintenance cost is reduced; data sharing between the functional test data and the automatic test data is realized through unified management of the functional test data and the automatic test data; due to the complete separation of script maintenance and data maintenance, data can be directly maintained in the assignment table, and the requirement standard for the skills of personnel is reduced. For example, if it takes about 10.5S to define 100 variables to execute in the conventional manner, and it takes about 0.4S to execute in the current manner, the performance is more obvious as the number of variables is larger, and it can be found that the time is significantly reduced.
Preferably, the table information delivery module 1 comprises a file location management unit 11, which determines a project location and a home location of the file location, the project location corresponding to a relative path of the file path and the home location corresponding to an absolute path of the file path. The corresponding assignment table can be quickly found by the file position management unit 11, the parameterization process of the custom variable can be quickly carried out whenever the custom variable is executed, and the efficiency of the custom variable is improved.
Preferably, the parameter name resolution module 3 includes a fuzzy Implementation unit 31, configured to perform POI (point occlusion Implementation) class resolution on the parameter name, and determine the form tab according to the working table number. No matter the format of the table is xls or xlsx, the work table number can be quickly and accurately found through POI class analysis, and then the table tab is determined.
Preferably, the parameter name resolution module 3 further includes a suffix name setting unit 32, where the variable names include variable name suffixes, multiple groups of variable names with different data are defined by the suffix name setting unit, and different variable name assignments are circularly completed by filling values of the variable name suffixes. If a second group of variables need to be defined, a suffix name setting unit 32 is used to fill in a value, for example, — 2 "in the suffix, and the assigned variable name is a value in the assignment table, and then" -2 "is added, so as to achieve the effect of assigning the variable value" 1 "to the variable name" var1-2", assigning the variable value" 2 "to the variable name" var2-2", and so on, until the loop completes all columns of values. Therefore, compared with the prior art, the parameterization of all variable names can be quickly executed through the setting of the variable name suffix, the parameterization process only has one step, the execution time is greatly shortened, and the execution efficiency is improved.
Preferably, the system separates the test data from the data of the automation script through the assignment table, and when the test data has fields or values which are newly added, modified and deleted, the system directly maintains the data through the columns corresponding to the test data in the assignment table. In the conventional data maintenance processing process, because the test data is in the automation script, each new field, modified field or value of each test data is required to be maintained one by one, but according to the batch custom variable system disclosed by the embodiment of the invention, because the test data is separated from the data of the automation script, the name of the custom variable is in one row of the assignment table, and the name of each case is in a specific column, for example, when the script is optimized, if there are 100 new fields, the traditional module has 100 cases, 100 cases need to be modified, and the existing mode only needs to modify 1 column in the data table. Therefore, data maintenance can be directly carried out through columns corresponding to the test data in the assignment table, maintenance time is shortened, cost and labor efficiency of data maintenance are obviously reduced, and due to the fact that the data can be directly maintained in the assignment table, requirements on skills of personnel are reduced. In addition, through the system for customizing variables in batches of the embodiment, data of functional testing and automatic testing are unified, for example, functional testing of a certain system is data ready for paving, a form of original paving data can be combined with automation, functional testing and automatic testing are directly communicated, parameterization is separated because steps are the same, and an automatic script can be automatically generated by one key by adopting a program mode.
All the above optional technical solutions may be combined arbitrarily to form optional embodiments of the present invention, and are not described in detail herein.
It should be noted that: in the system for batched user-defined variables provided in the above embodiment, only the division of the function modules is used for illustration when the system for batched user-defined variables is used for batched user-defined variables, and in practical applications, the function allocation may be completed by different function modules as needed, that is, the internal structure of the system for batched user-defined variables may be divided into different function modules to complete all or part of the functions described above. In addition, the system for customizing variables in batches and the method embodiment for customizing variables in batches provided by the above embodiments belong to the same concept, and the specific implementation process thereof is detailed in the method embodiment and is not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.