CN115237805A - Test case data preparation method and device - Google Patents
Test case data preparation method and device Download PDFInfo
- Publication number
- CN115237805A CN115237805A CN202210956255.XA CN202210956255A CN115237805A CN 115237805 A CN115237805 A CN 115237805A CN 202210956255 A CN202210956255 A CN 202210956255A CN 115237805 A CN115237805 A CN 115237805A
- Authority
- CN
- China
- Prior art keywords
- function
- recognition result
- text recognition
- text
- public
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Quality & Reliability (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Machine Translation (AREA)
Abstract
The invention provides a test case data preparation method and device, which can be used in the financial field or other fields. The method comprises the following steps: acquiring a data preparation text input by a user, and identifying the data preparation text to obtain a text identification result; wherein the text recognition result comprises function parameter information; according to the text recognition result, matching is carried out in a pre-established public function list, and a public function corresponding to the text recognition result is determined; and generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result. According to the invention, the common function list is built, the function standard is standardized, the repeated construction of the common function is prevented, and the number-making script is flexibly adapted in a mode of identifying the input text, so that the data preparation process of simplifying manual testing and automatic testing is reduced, the data preparation threshold is reduced, and the testing efficiency is improved.
Description
Technical Field
The invention relates to the technical field of test cases, in particular to a test case data preparation method and device.
Background
The test data is the data needed in the process of executing the test case, and the test data preparation is the premise of a test tool, so that the coverage of service conditions can be ensured, and the requirements of service can be met. Data preparation in software testing is an important prerequisite in the testing process. Currently, data preparation is mainly manually made in the testing process, such as inserting data into a database of a testing environment, invoking some transaction programs for data preparation, and the like.
The tester needs to be familiar with the data preparation process, but the test process needs to depend on external data, so that the manufacturing is difficult. In addition to manual counting, the counting capability of the automatic test script is gradually enhanced, and more data preparation requirements of manual testing and automatic testing can be met. However, the automatic number-making scripts are not uniformly managed and distributed in different departments for different applications, and cannot be well reused.
Disclosure of Invention
In view of the problems in the prior art, embodiments of the present invention mainly provide a method and an apparatus for preparing test case data, so as to reduce a threshold for data preparation and improve test efficiency.
In order to achieve the above object, an embodiment of the present invention provides a method for preparing test case data, where the method includes:
acquiring a data preparation text input by a user, and identifying the data preparation text to obtain a text identification result; the text recognition result comprises function parameter information;
according to the text recognition result, matching is carried out in a pre-established public function list, and a public function corresponding to the text recognition result is determined;
and generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result.
Optionally, in an embodiment of the present invention, recognizing the data preparation text to obtain a text recognition result includes:
and utilizing a preset word dictionary library to perform word segmentation and analysis on the data preparation text to obtain the text recognition result.
Optionally, in an embodiment of the present invention, the segmenting and analyzing the data-prepared text by using a preset word dictionary library to obtain the text recognition result includes:
utilizing a preset word dictionary library to perform word segmentation on the data preparation text to obtain a plurality of data preparation words;
and performing character analysis processing on the data preparation vocabulary to obtain a text recognition result.
Optionally, in an embodiment of the present invention, generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result includes:
packaging the public function corresponding to the text recognition result to obtain an artificial number function corresponding to the text recognition result;
and generating the test data according to the execution environment information and the input parameter information in the artificial number function and the function parameter information.
Optionally, in an embodiment of the present invention, according to the text recognition result, matching is performed in a pre-established public function list, and determining the public function corresponding to the text recognition result includes:
and searching and matching in a pre-established public function list by using the class name and the function name in the text recognition result, and determining the public function corresponding to the text recognition result.
Optionally, in an embodiment of the present invention, the public function list is established as follows:
acquiring a historical public basic function, and performing function summarization on the historical public basic function by using a preset construction standard;
and performing function conflict processing and annotation information analysis processing on the historical public basic functions which are subjected to function summarization to obtain a public function list.
Optionally, in an embodiment of the present invention, acquiring a historical common basis function, and performing function summarization on the historical common basis function by using a preset construction standard includes:
acquiring historical public basis functions from a plurality of test case items;
storing the historical public basic functions in a script directory by using the script directory in a preset construction standard;
and carrying out name processing on the historical public basic function by utilizing the preset class name and function name in the preset construction standard so as to finish function summarization.
The embodiment of the invention also provides a test case data preparation device, which comprises:
the text recognition module is used for acquiring a data preparation text input by a user, and recognizing the data preparation text to obtain a text recognition result; the text recognition result comprises function parameter information;
the public function module is used for matching in a pre-established public function list according to the text recognition result and determining a public function corresponding to the text recognition result;
and the test data module is used for generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result.
Optionally, in an embodiment of the present invention, the text recognition module is further configured to: and performing word segmentation and analysis on the data preparation text by using a preset word dictionary library to obtain a text recognition result.
Optionally, in an embodiment of the present invention, the text recognition module includes:
the text word segmentation unit is used for segmenting the data preparation text by utilizing a preset word dictionary library to obtain a plurality of data preparation words;
and the text recognition unit is used for performing character analysis processing on the data preparation vocabulary to obtain a text recognition result.
Optionally, in an embodiment of the present invention, the test data module includes:
the number making function unit is used for packaging the public function corresponding to the text recognition result to obtain the number making function corresponding to the text recognition result;
a test data unit for generating test data according to the execution environment information and input parameter information in the artificial number function and function parameter information
Optionally, in an embodiment of the present invention, the common function module is further configured to: and searching and matching in a pre-established public function list by using the class name and the function name in the text recognition result, and determining the public function corresponding to the text recognition result.
Optionally, in an embodiment of the present invention, the apparatus further includes: the function list module is used for acquiring the historical public basic functions and summarizing the historical public basic functions by utilizing a preset construction standard; and performing function conflict processing and annotation information analysis processing on the historical public basic functions which are subjected to function summarization to obtain the public function list.
Optionally, in an embodiment of the present invention, the function list module includes:
the basic function unit is used for acquiring a historical common basic function from a plurality of test case items;
the script directory unit is used for storing the historical public basic function under a script directory by utilizing the script directory in a preset construction standard;
and the function summarizing unit is used for carrying out name processing on the historical public basic function by utilizing the preset class name and the function name in the preset construction standard so as to complete function summarizing.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
The invention also provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the above method.
According to the invention, the common function list is built, the function standard is specified, the repeated construction of the common function is prevented, the number-making script is flexibly adapted in a mode of recognizing the input text, the data preparation process of manual testing and automatic testing is simplified, the threshold of data preparation is reduced, and the testing efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flow chart of a test case data preparation method according to an embodiment of the present invention;
FIG. 2 is a flowchart of obtaining a text recognition result in an embodiment of the present invention;
FIG. 3 is a flow chart of generating test data in an embodiment of the present invention;
FIG. 4 is a flow chart of establishing a list of common functions in an embodiment of the present invention;
FIG. 5 is a flow chart of function summarization in an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a test case data preparing apparatus according to an embodiment of the present invention;
FIG. 7 is a block diagram of a text recognition module according to an embodiment of the present invention;
FIG. 8 is a block diagram of a test data module according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a test case data preparation apparatus according to another embodiment of the present invention;
FIG. 10 is a diagram illustrating a structure of a function list module according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method and a device for preparing test case data, which can be used in the financial field and other fields.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Fig. 1 is a flowchart illustrating a method for preparing test case data according to an embodiment of the present invention, where an execution subject of the method for preparing test case data according to the embodiment of the present invention includes, but is not limited to, a computer. According to the invention, the common function list is built, the function standard is specified, the repeated construction of the common function is prevented, the number-making script is flexibly adapted in a mode of recognizing the input text, the data preparation process of manual testing and automatic testing is simplified, the threshold of data preparation is reduced, and the testing efficiency is improved. The method shown in fig. 1 comprises:
the method comprises the following steps that S1, a data preparation text input by a user is obtained, and the data preparation text is identified to obtain a text identification result; wherein the text recognition result comprises function parameter information.
The data preparation text input by the user records basic requirements of the test data required by the user, such as information of a test environment, a function name and the like for which the test data aims. The method comprises the steps of analyzing a section of data preparation text input by a user, segmenting the data preparation text and calling a right function to perform data preparation. Specifically, the sentence division is carried out on the input data preparation text according to commas or a bingo structure, the bingo structure is taken as a short sentence, and then the word division is carried out to obtain a plurality of data preparation words. The data preparation words are subjected to word analysis by using a conventional word analysis method to obtain a text recognition result, for example, the recognized data preparation words can be open to the public and the public, open, and the like, so that the recognition of the data preparation file is realized.
As an embodiment of the present invention, the text recognition result further includes a class name and a function name.
Furthermore, a text recognition result is obtained by performing word segmentation and analysis on the data preparation text input by the user. Specifically, the text recognition result includes function parameter information, i.e., input parameter information of a function required by the test data. In addition, the text recognition result also includes a class name and a function name.
And S2, according to the text recognition result, matching in a pre-established public function list, and determining a public function corresponding to the text recognition result.
The public function list is established in advance, and specifically, the public functions are maintained according to the preset public function library construction standard by using the historical public basic functions of the test cases. During maintenance, the following specific requirements are met: public functions must be placed in the agreed package catalog; class names begin with the C letter followed by the Chinese noun; the function name is in Chinese, preferably a verb or bingo structure, and the function should include a function annotation. Therefore, function conflict processing and annotation information analysis processing are completed, a public function list is obtained, a good directory structure is established for the functions of the cases, meanwhile, the public functions are packed and summarized for the later, and conflict caused by the fact that the same package names and class names are used among different applications is prevented to a great extent.
Furthermore, information such as class names and function names included in the text recognition result is utilized to search and match in the public function list, and the public function corresponding to the text recognition result is determined. Specifically, the text recognition result may include a plurality of function names, so that a plurality of common functions corresponding to the text recognition result may be retrieved.
And S3, generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result.
And packaging the public function corresponding to the text recognition result to obtain the number making function corresponding to the text recognition result. Specifically, a plurality of common functions corresponding to the text recognition result are combined and packaged, so that a new function, namely, an artificial function for generating test data can be obtained.
As an embodiment of the present invention, the function parameter information includes execution environment information and input parameter information.
Furthermore, test data are generated according to the execution environment information, the input parameter information and the number making function in the text recognition result. Specifically, the test data is generated by configuring and operating the artificial function by using the execution environment information and the input parameter information.
As an embodiment of the present invention, recognizing a data preparation text, and obtaining a text recognition result includes: and utilizing a preset word dictionary library to perform word segmentation and analysis on the data preparation text to obtain a text recognition result.
In this embodiment, as shown in fig. 2, performing word segmentation and parsing on the data-prepared text by using a preset word dictionary library to obtain a text recognition result includes:
step S21, utilizing a preset word dictionary library to perform word segmentation on the data preparation text to obtain a plurality of data preparation words;
and S22, performing character analysis processing on the data preparation vocabulary to obtain a text recognition result.
The specific process of the preset word dictionary library comprises the following steps: importing word libraries such as verbs, nouns and connecting words commonly used in Chinese; counting the method names and parameters of the number making function and segmenting words, segmenting the words from left to right of a text by adopting a forward maximum matching method, segmenting the words with the maximum current position length in a greedy algorithm mode, wherein the function name is a phrase of a V-shaped structure, an object is a noun, and the noun can be modified by conditional adjectives, such as opening a public to a visiting user, opening the public to the visiting user, a verb, a visiting user and a public to the public, which are adjectives for modifying the object, possibly a plurality of words.
Furthermore, words obtained after the data preparation text is subjected to word segmentation are input into a dictionary library for matching with the user input text, so that the data preparation text is analyzed, and a text recognition result is obtained.
In this embodiment, as shown in fig. 3, generating test data according to the function parameter information in the text recognition result and the common function corresponding to the text recognition result includes:
step S31, packaging the public function corresponding to the text recognition result to obtain a number making function corresponding to the text recognition result;
and step S32, generating test data according to the execution environment information and the input parameter information in the artificial number function and the function parameter information.
And packaging the public function corresponding to the text recognition result to obtain the number making function corresponding to the text recognition result. Specifically, a plurality of common functions corresponding to the text recognition result are combined and packaged, so that a new function, namely, an artificial function for generating test data can be obtained.
As an embodiment of the present invention, matching in a pre-established public function list according to a text recognition result, and determining a public function corresponding to the text recognition result includes: and searching and matching in a pre-established public function list by using the class name and the function name in the text recognition result, and determining the public function corresponding to the text recognition result.
And searching and matching in the public function list by using information such as class names, function names and the like included in the text recognition result, and determining the public function corresponding to the text recognition result. Specifically, the text recognition result may include a plurality of function names, so that a plurality of common functions corresponding to the text recognition result may be retrieved.
As an embodiment of the present invention, as shown in fig. 4, the common function list is established by:
step S41, acquiring historical public basic functions, and performing function summarization on the historical public basic functions by using a preset construction standard;
and step S42, performing function conflict processing and annotation information analysis processing on the historical public basic functions which are subjected to function summarization to obtain a public function list.
In this embodiment, as shown in fig. 5, acquiring a historical common basis function, and performing function summarization on the historical common basis function by using a preset construction standard includes:
s51, acquiring a historical public basic function from a plurality of test case items;
step S52, storing the historical public basic function under a script directory by utilizing the script directory in the preset construction standard;
and S53, carrying out name processing on the historical public basic function by utilizing the preset class name and function name in the preset construction standard so as to finish function summarization.
The public function list is established in advance, specifically, historical public basic functions are obtained from a plurality of test case projects, and the public functions are maintained by using the historical public basic functions of the test cases according to the preset public function library construction standard. During maintenance, the following specific requirements are met: the common functions must be placed in the agreed package catalog; class names begin with the C letter followed by the Chinese noun; the function name is in Chinese, preferably a verb or bingo structure, and the function should include a function annotation. Therefore, function conflict processing and annotation information analysis processing are completed, a public function list is obtained, a good directory structure is established for the functions of the cases, and meanwhile, the same package names and class names are used for guiding conflicts before different applications are prevented for packaging and summarizing the public functions to a great extent.
In an embodiment of the present invention, a system for applying the test case data preparation method is further provided in the embodiment of the present invention, and specifically, the system of the present invention is actually applied in the form of a test data supply platform. The platform can generate test basic data by self through a page or an API (application program interface), and supports real-time calling and using of cache data, so that the data preparation threshold can be greatly reduced, and the test efficiency is improved. And the stocked case resources are reused inside the team and among the cross teams, so that the compiling efficiency of the test case is improved, the preparation capacity of the case data is enhanced, and a common basis is provided for compiling the scene case and the cross application case. And searching the test case public library, generating an operation interface and an independently executable script according to the public library information, and using the generated script as a data preparation script for manual test and automatic test. And the data is directly read from the cache database or acquired by calling two methods in real time.
In the embodiment, the current case resources are reused inside the project team and among the cross-team, so that the development efficiency of the automatic test case is improved, the preparation capacity of case data is enhanced, and a common basis function is provided for compiling the scene case and the cross-application case. And (4) establishing a common function library construction standard together according to the discussion consensus, and maintaining the common functions of the business field in respective case projects by each team. During maintenance, the following specific requirements are met:
(1) The common functions must be placed in the agreed package directory. Specifically, the catalog divides the lines according to the business product: common- > fova/nova- > service line- > service system- > common function. With common beginning as a requirement.
(2) Class names begin with the letter C, followed by a Chinese noun.
(3) The function name is in Chinese, and preferably a verb or bingo structure, the function should include a function annotation.
Furthermore, through the public function sharing process, a good directory structure can be established for the functions of the cases, and meanwhile, the public functions for later packaging and summarizing prevent conflict caused by the use of completely same package names and class names before different applications to a great extent.
In this embodiment, COMMON functions have been shared by various departments under a directory of case items, such as the COMMON directory. The method comprises the following steps of automatically generating JAR packages and JAVADOC documents at regular time through a batch program of the scheme, and comprising the following operations:
(1) Downloading the resources: downloading case items from case libraries of each item department, downloading all source codes from directories in each designated case item, such as SRC/COMMON directories (where public function packages are), downloading public functions and files dependent on the public functions, downloading dependent third party packages (such as third party basic JAR package libraries required by running of some public functions), and basic classes required to be used by the public functions.
(2) Pre-compiling: and pre-compiling the common function classes of the case items:
A. if there is a compilation error, the erroneous item is not updated at night and the associated principal is notified.
B. If the compilation passes, the item source code and dependency packages are aggregated into an item, such as a MTCOMMON item.
(3) And (3) processing conflicts: in the agreed package directory structure specification, the conflict of the same package name and the same class name when most public functions are summarized can be prevented. However, because the packet path and the class name of the class depending on the packet cannot be predicted, there still exists a possibility of collision, and the versions of the third packet depending on the two common functions are not consistent, at this time, it is necessary to judge the version numbers of the two versions, and select the class with the higher version number. The specific treatment process comprises the following steps:
A. and (3) processing packet conflict: and circulating the dependency packages of all cases, and recording the corresponding relation between the case items and the dependency packages. And calculating and generating an MD5 value (whether the files are actually the same file) of a dependent packet through an MD5 information abstract algorithm, adding the packet into a temporary directory, if the packet with the MD5 value in the temporary directory is found, not adding the packet, if the file names are the same but the MD5 values are different, proving that the two files are not the same file, reserving the file with the newer modification time, and if the other file is different, notifying an applied contact person of a mail to solve the problem. If the package name is found to exist but the versions are not consistent, the high version of the package is retained.
B. And (3) processing class conflicts: the dependent packages of all items can be deduplicated and centralized in the temporary directory through the above steps, but different packages may still have the same package name (path) and class name, which may cause the case to wrongly refer to the dependent class. For a plurality of packages containing the same package name (path) and class name, the belonged packages of the class are taken and are sorted from earlier to later time, and case items depending on the packages are compiled
The following examples are specific: case 1 and case 2 entries, case 1.Jar and case 2.Jar both contain the same package name (path) com.company.path and class name appoindtlass, appoindtlass may be implemented in two different ways at both, where the order of dependent packages is adjusted by ordering the last update of both, case 1.Jar and case 2.Jar, the earlier package takes precedence, order 1.Jar is listed first, case 1 and case 1 entries are compiled, where both entries use order 1.Jar preferentially, and if both are compiled, then it is stated that case 1.Jar applies to both entries, and finally the order of dependence of case 1.Jar is listed in order 2.Jar. If DEPEND1.JAR can not make both items compile, then the dependency order of DEPEND2.JAR is adjusted to the front, test whether the two items can be compiled, if so, finally arrange the dependency order of DEPEND1.JAR at DEPEND2.JAR. If both dependent packages can not make all items compiled, the dependent package with earlier time is reserved, and the package with later time is regarded as a conflict package introduced later, and the relevant application is informed of the resolution through the mail. And exclude the conflict package depend2.Jar and the case entry from the temporary directory.
(4) Packaging and adding source codes to control and release: and finally, uniformly packaging the case items without compiling errors, namely, mtcommon. Since the public functions all have JAVADOC, JAVADOC will be automatically extracted and formed into an online document.
(5) Timing construction: the packed flow is packaged into a callable program, and batch tasks are executed every day through JENKINS (configuration scheduling tasks) operation to complete extraction, packing and release of public functions.
The specific using process of the notice packet comprises the following steps: before using the public function, a DES case dependent item containing a package of the public function mtcommon.
Further, when a common function method is used, a call is made by a "class name. Method name (parameter)".
In addition, the further packaging process includes: since the source codes of other applications can be seen when the public packet is used, a new public function can be further written and formed according to the combination of the public functions. For example, when data is prepared, a plurality of functions are required to be called in sequence, the output of the former function is the input of the latter function, and therefore the required functions can be assembled flexibly.
By sharing the standardized public function and generating the public packet, the conflict problem generated when the public function is summarized can be solved. Different users can use the public functions provided by other departments and applications to the outside by introducing the public package.
In the embodiment, in the process of using the common function, only the JAVA item can be directly introduced into the common package for use in the test case item, and since the number of common function data is very large, it is difficult for the user to find the required data. In order to solve the above problems, a specific process of building a test data platform that does not need to be relied on is described below, which is convenient for a common user to prepare test data.
First, a common function list needs to be generated, and a calling method of a function can be known through a method list (JSON file). And providing an interface operable to generate call logic at the interface operation to generate the test data.
Further, the detailed annotation information of each method in all class classes is preprocessed, a discarded method, a non-public method and a non-static method which do not write annotations and have a predicted label are filtered, and other methods which meet the requirements are extracted and analyzed based on regular matching, and the following processing is specifically carried out:
1) Creating a method information object for recording method information;
2) Setting a method Name, a class Name and a method Description for the method object;
3) Acquiring keyword information, and if the keyword information does not exist, just acquiring a method name as the keyword (the keyword is a keyword for searching the function);
4) Obtaining author information and return values of methods;
5) Acquiring parameter information of the method, and describing parameter names, parameter types, parameter serial numbers and parameter descriptions of each parameter of the method;
6) Adding all the aspect information and the parameter information into a list;
7) And sorting the method list according to the keyword information and writing the method list into the json file.
In the present embodiment, after having the list information of the json function list, it is known how these common functions are called. And combining the common function mtcommon.
In order to facilitate the user to call, the invention provides a platform interface for searching out available public function scripts. The usage pattern is as follows, the query conditions include environment, application, class name, and method name. The query conditions are specified as follows:
environment: the scenario environment is executed, and the scenario can be automatically converted into a corresponding IP and a corresponding port in the background;
the application comprises the following steps: a home application of the script;
class name: the class name corresponding to the script.
The method comprises the following steps: and the method name corresponding to the script.
The method comprises the steps of inputting condition information such as class names and the like, outputting a class list, and providing three sorting modes for a user to find a desired class conveniently, wherein the first sorting mode is default letter sorting, the second sorting mode is overall use frequency sorting of the class, and the third sorting mode is matching times sorting of current application items and the class names.
Furthermore, the input items of the query are class names and methods, and the class names and the methods are converted into java objects by analyzing an interface generated by a json file and circularly reading information such as method names, method descriptions, package paths, type names, parameters and the like in a json method list. Listing methods in the class, or directly searching information such as method names and the like to match the methods, analyzing and generating detailed method information on an interface by java objects after selecting the methods,
further, after the method is selected, an adding method is clicked on the operation page. And displaying method information such as parameter information and the like of the method, and generating an input interface corresponding to the method. Inputting the specific value of the parameter, and clicking the execution method on the page.
Furthermore, after the execution is finished, the generated corresponding result can be used as test data, meanwhile, the data is stored into a background cache database by taking (method and + parameter) as an identifier, and the data is directly read from the cache database when the use is reduced.
In this embodiment, in order to enable the number making process to be used on different platforms for multiple times, the number making process is packaged into an address of a URL, and the generation rule is a concatenation platform server address and a request json string, where the json string includes an environment, a package name, a class name, a method name, parameter information, and a number of cache days. Different platforms can repeat the process of number making by accessing URL addresses (IP and 80 ports of a platform server for number providing need to be accessed), and the specific flow is as follows:
1) Selecting environment information;
2) Filling parameter input information;
3) Clicking to generate an interface URL;
4) And displaying the interface.
After the data is generated through page operation, the data can be stored in a database cache, if the same environment exists next time and the same method parameters are called, the data in the cache is directly read, the real transaction of the bottom layer does not need to be called, and the time for generating the data is shortened. The number of cache days is the number of days for reading the cache data, for example, the number of cache days is set to 30 days, and if the cache data exists in 30 days (the same environment exists, the same method parameter is called), the data of the cache data database is directly used. If the number of caching days is not set, the cause function is called in real time every time. The generated URL address may be executed on a browser or may be dropped into a different test case item to cause script execution.
Furthermore, a monitoring program is added in the platform background server, and the class name and the method calling times can be counted by analyzing the request log of the server and analyzing the calling parameters. And further, the use condition of each class, method and environment can be counted.
In this embodiment, the platform of the present invention performs data preparation based on text recognition. In order to more conveniently prepare data, a user is provided with a step of inputting a text, and the text is converted into data preparation after being analyzed.
The process of constructing the word dictionary base is as follows:
1) And importing word libraries such as verbs, nouns and conjunctions which are commonly used in Chinese.
2) Counting the method names and parameters of the number making function and segmenting words, segmenting the words from left to right of a text by adopting a forward maximum matching method, segmenting the words with the maximum current position length in a greedy manner, wherein the function name is a phrase of a V-shaped structure, the object is a noun, and the noun can be modified by conditional adjectives, such as opening a public to a visiting user, opening the public to the visiting user, being a verb, the visiting user being a noun, and the public to the public being an adjective for modifying the object, possibly a plurality of words.
3) And inputting the well-divided word notes into a dictionary library for matching the user input text.
Further, according to the text matching number function, the specific process is as follows:
the method comprises the steps of performing word segmentation on a text by analyzing the input text of a user and calling a right function to perform data preparation, firstly performing sentence segmentation on the input text according to a comma or bingo structure, taking the bingo structure as a short sentence, and then performing word segmentation, which is described as follows;
1) A single phrase matches a single operational mantissa function:
the method comprises the steps of segmenting short sentences input by a user to obtain corresponding noun objects, inquiring corresponding number making functions according to nouns, matching according to different conditions if a plurality of number making functions are matched, wherein an adjective of the noun object in the function names of the number making functions is converted into a condition, each parameter in the number making functions is converted into a condition, if the parameter is provided with a data dictionary, the data dictionary can be used as condition matching, and if the currency parameter data dictionary is Renminbi, USD and Euro, the condition can be one of three types. Comparing the conversion condition of the short sentence input by the user with the condition converted by the artificial number function with the matching number of the conditions, and selecting the artificial number function with the most matched condition as a calling object.
Matching example: the user inputs ' open to the coming and going home of the citizen coin ', and the words are divided into ' open ', ' open to the public ', ' Renminbi ', ' going and going home ', ' open ' is an operation verb, the going and going home ' is a noun object, the ' going and public ' and the ' Renminbi ' are conditions for modifying ' going and going home '. According to the noun object 'the family going' two functions are searched out, wherein the two functions are a function 'open to the public and the family going' and a function 'open to the individual and the family going', the two functions both have two parameters 'customer number' and 'currency type', and the 'currency type' data dictionary is RMB, dollars and Euros. The matching condition is shown in the following table, and the matching condition is matched to an open-to-public account (client number, currency) manufacture function, the client number is called as a parameter to take a default value, and the currency is RMB, as shown in the table 1.
TABLE 1
2) The plurality of phrases combine a plurality of artificial functions:
dividing an input text into a plurality of short sentences according to a bingo structure or commas, carrying out number function matching on each short sentence, connecting the number functions in series according to parameters, inputting the output of a former function as the parameter of a latter function when the function is called, and taking the default value of the parameter if the parameter cannot be matched. When the short sentence is matched with the number function, if the matching condition numbers of the two number functions are the same, comparing the conditions of other short sentences, and preferentially using the function if the matching condition numbers are the same.
Matching example: the user inputs 'opening a client number, opening a public-to-business account, opening a transfer agreement, and transferring into 100 Yuan', the text is divided into four short sentences through clauses, the four short sentences respectively search corresponding manufacture functions, wherein the matching mode of the short sentence 1 and the short sentence 3 is the same as that of the single short sentence matched single operation manufacture function; the short sentence 2 queries two number making functions according to the noun object, and because the short sentence is unconditionally matched, our 'individual' using the short sentence 1 is matched with the corresponding function; phrase 4 cannot find a function according to the noun object, and queries the function with the highest matching degree according to the noun "amount" and the return type "account" corresponding to the previous phrase, as shown in table 2.
TABLE 2
Wherein, the manufacture number is made according to the environment and the number, the user can specify the environment of the manufacture number function execution when inputting the text specification information, such as "opening an account number of XX type in the environment of function a", and can specify the number between the verb and noun in the short sentence in the text to determine the calling number, such as "opening 10 account numbers of XX type in the environment of function a", if a plurality of short sentences, the number word also acts on the following short sentence.
Further, a text which cannot be matched is recorded, short sentences which cannot be matched are recorded in the process of identifying and matching the number function of the text, subsequent analysis is provided, as the short sentence 4 in the 'a plurality of short sentences combined with a plurality of number functions' cannot be matched, the number function can be analyzed according to the record, and the matching probability can be improved by modifying the format of the verb into the format of the verb.
The invention can be used for preparing automatic test and manual test data, and has the following advantages: the common function is prevented from being built repeatedly by the common function building standard and the standard of the standard function; a new public function can be further compiled and formed according to the combination of the public functions; the method can flexibly adapt to the number making script in a text input mode, reduce the data preparation process of simplifying manual test and automatic test and improve the test efficiency; the method can share the modeling capacity of each application automatic test script, and meet more data preparation requirements of manual test and automatic test; and the data is directly read from the cache database or acquired by calling two methods in real time.
Fig. 6 is a schematic structural diagram of a test case data preparing apparatus according to an embodiment of the present invention, where the apparatus includes:
the text recognition module 10 is configured to acquire a data preparation text input by a user, and recognize the data preparation text to obtain a text recognition result; the text recognition result comprises function parameter information;
the public function module 20 is configured to perform matching in a pre-established public function list according to the text recognition result, and determine a public function corresponding to the text recognition result;
and the test data module 30 is configured to generate test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result.
As an embodiment of the present invention, the text recognition module is further configured to: and utilizing a preset word dictionary library to perform word segmentation and analysis on the data preparation text to obtain a text recognition result.
As an embodiment of the present invention, as shown in fig. 7, the text recognition module 10 includes:
the text word segmentation unit 11 is configured to perform word segmentation on the data preparation text by using a preset word dictionary library to obtain a plurality of data preparation words;
and the text recognition unit 12 is used for performing word analysis processing on the data preparation vocabulary to obtain a text recognition result.
In the present embodiment, as shown in fig. 8, the test data module 30 includes:
the number function unit 31 is configured to perform packing processing on the public function corresponding to the text recognition result to obtain a number function corresponding to the text recognition result;
the test data unit 32 is configured to generate test data according to the execution environment information and the input parameter information in the artificial function and the function parameter information.
As an embodiment of the present invention, the common function module 20 is further configured to: and searching and matching in a pre-established public function list by using the class name and the function name in the text recognition result, and determining the public function corresponding to the text recognition result.
As an embodiment of the present invention, as shown in fig. 9, the apparatus further includes: the function list module 40 is used for acquiring the historical public basic functions and summarizing the historical public basic functions by using a preset construction standard; and performing function conflict processing and annotation information analysis processing on the historical public basic functions which are subjected to function summarization to obtain a public function list.
In this embodiment, as shown in fig. 10, the function list module 40 includes:
a basis function unit 41, configured to obtain a historical common basis function from a plurality of test case items;
the script directory unit 42 is configured to store the historical public basic function under a script directory in a preset construction standard;
and the function summarizing unit 43 is configured to perform name processing on the historical common basic function by using the preset class name and function name in the preset construction standard, so as to complete function summarizing.
Based on the same application concept as the test case data preparation method, the invention also provides the test case data preparation device. Because the principle of solving the problem of the test case data preparation device is similar to that of a test case data preparation method, the implementation of the test case data preparation device can refer to the implementation of the test case data preparation method, and repeated parts are not described again.
According to the method, the public function list is built, the function standard is normalized, the repeated construction of the public function is prevented, the new number making function is further compiled and formed according to the combination of the public function, the number making script is flexibly adapted in a mode of recognizing the input text, the data preparation process of manual testing and automatic testing is simplified, the threshold of data preparation is lowered, and the testing efficiency is improved.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
The present invention also provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the above method.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
As shown in fig. 11, the electronic device 600 may further include: communication module 110, input unit 120, audio processor 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in FIG. 11; furthermore, the electronic device 600 may also comprise components not shown in fig. 11, which may be referred to in the prior art.
As shown in fig. 11, the central processor 100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
The input unit 120 provides an input to the cpu 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage portion 144 of the memory 140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging application, address book application, etc.).
The communication module 110 is a transmitter/receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter/receiver) 110 is coupled to the central processor 100 to provide an input signal and receive an output signal, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, enabling recording locally through a microphone 132, and enabling locally stored sound to be played through a speaker 131.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A method of test case data preparation, the method comprising:
acquiring a data preparation text input by a user, and identifying the data preparation text to obtain a text identification result; wherein the text recognition result comprises function parameter information;
according to the text recognition result, matching is carried out in a pre-established public function list, and a public function corresponding to the text recognition result is determined;
and generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result.
2. The method of claim 1, wherein recognizing the data-ready text, and obtaining a text recognition result comprises:
and utilizing a preset word dictionary library to perform word segmentation and analysis on the data preparation text to obtain the text recognition result.
3. The method of claim 2, wherein the segmenting and parsing the data-prepared text using a predetermined dictionary of words to obtain the text recognition result comprises:
utilizing a preset word dictionary library to perform word segmentation on the data preparation text to obtain a plurality of data preparation words;
and performing character analysis processing on the data preparation vocabulary to obtain the text recognition result.
4. The method according to claim 1, wherein the generating test data according to the function parameter information in the text recognition result and the common function corresponding to the text recognition result comprises:
packaging the public function corresponding to the text recognition result to obtain a number making function corresponding to the text recognition result;
and generating the test data according to the number making function, the execution environment information in the function parameter information and the input parameter information.
5. The method according to claim 1, wherein the matching is performed in a pre-established public function list according to the text recognition result, and determining the public function corresponding to the text recognition result comprises:
and searching and matching in a pre-established public function list by using the class name and the function name in the text recognition result, and determining the public function corresponding to the text recognition result.
6. The method of claim 1, wherein the list of common functions is established by:
acquiring a historical public basic function, and performing function summarization on the historical public basic function by using a preset construction standard;
and performing function conflict processing and annotation information analysis processing on the historical public basic functions which are subjected to function summarization to obtain the public function list.
7. The method of claim 6, wherein the obtaining the historical common basis functions and the function summarizing the historical common basis functions by using the preset construction standard comprises:
acquiring the historical common basis function from a plurality of test case items;
storing the historical public basic function under a script directory by utilizing the script directory in a preset construction standard;
and carrying out name processing on the historical public basic functions by utilizing preset class names and function names in the preset construction standard so as to finish function summarization.
8. A test case data preparation apparatus, the apparatus comprising:
the text recognition module is used for acquiring a data preparation text input by a user, and recognizing the data preparation text to obtain a text recognition result; wherein the text recognition result comprises function parameter information;
the public function module is used for matching in a pre-established public function list according to the text recognition result and determining a public function corresponding to the text recognition result;
and the test data module is used for generating test data according to the function parameter information in the text recognition result and the public function corresponding to the text recognition result.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210956255.XA CN115237805A (en) | 2022-08-10 | 2022-08-10 | Test case data preparation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210956255.XA CN115237805A (en) | 2022-08-10 | 2022-08-10 | Test case data preparation method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115237805A true CN115237805A (en) | 2022-10-25 |
Family
ID=83678540
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210956255.XA Pending CN115237805A (en) | 2022-08-10 | 2022-08-10 | Test case data preparation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115237805A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116578499A (en) * | 2023-07-13 | 2023-08-11 | 建信金融科技有限责任公司 | Intelligent analysis and test method and system for public component function change influence |
CN117032835A (en) * | 2023-10-09 | 2023-11-10 | 中邮消费金融有限公司 | Number making device and method for scene arrangement |
-
2022
- 2022-08-10 CN CN202210956255.XA patent/CN115237805A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116578499A (en) * | 2023-07-13 | 2023-08-11 | 建信金融科技有限责任公司 | Intelligent analysis and test method and system for public component function change influence |
CN116578499B (en) * | 2023-07-13 | 2023-09-22 | 建信金融科技有限责任公司 | Intelligent analysis and test method and system for public component function change influence |
CN117032835A (en) * | 2023-10-09 | 2023-11-10 | 中邮消费金融有限公司 | Number making device and method for scene arrangement |
CN117032835B (en) * | 2023-10-09 | 2024-01-26 | 中邮消费金融有限公司 | Number making device and method for scene arrangement |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2018272840B2 (en) | Automated dependency analyzer for heterogeneously programmed data processing system | |
US10169337B2 (en) | Converting data into natural language form | |
KR101143027B1 (en) | Self-describing software image update components | |
CN115237805A (en) | Test case data preparation method and device | |
CN109558525B (en) | Test data set generation method, device, equipment and storage medium | |
US10127264B1 (en) | Techniques for automated data analysis | |
US20060080603A1 (en) | Method and apparatus for utilizing an object model to manage document parts for use in an electronic document | |
CN106648569B (en) | Target serialization realization method and device | |
CN113535720A (en) | Index creating method, device and equipment in block chain type account book | |
CN110764760B (en) | Method, apparatus, computer system, and medium for drawing program flow chart | |
CN112988601A (en) | Test script development method and device | |
CN110020358A (en) | Method and apparatus for generating dynamic page | |
CN112860265A (en) | Method and device for detecting operation abnormity of source code database | |
US8862609B2 (en) | Expanding high level queries | |
CN113448869A (en) | Method and device for generating test case, electronic equipment and computer readable medium | |
CN115599386A (en) | Code generation method, device, equipment and storage medium | |
US7885985B2 (en) | System and method for building a datastore for storing and retrieving regression testing data for a complex application | |
US20070055492A1 (en) | Configurable grammar templates | |
CN113722352A (en) | Intelligent data verification method, system and storage medium for reporting and reviewing scheme | |
CN113419957B (en) | Rule-based big data offline batch processing performance capacity scanning method and device | |
US20220100719A1 (en) | Techniques for performing lifecycle operations on a data store | |
CN114968917A (en) | Method and device for rapidly importing file data | |
CN111930627B (en) | Method and device for determining code coverage rate of EGL programming language | |
CN114819631A (en) | Multitask visualization method and device, computer equipment and storage medium | |
US20150324333A1 (en) | Systems and methods for automatically generating hyperlinks |
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 |