CN112835803B - Tool generation method, test data construction method, device, equipment and medium - Google Patents
Tool generation method, test data construction method, device, equipment and medium Download PDFInfo
- Publication number
- CN112835803B CN112835803B CN202110204223.XA CN202110204223A CN112835803B CN 112835803 B CN112835803 B CN 112835803B CN 202110204223 A CN202110204223 A CN 202110204223A CN 112835803 B CN112835803 B CN 112835803B
- Authority
- CN
- China
- Prior art keywords
- data construction
- scene
- file
- test data
- page
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000010276 construction Methods 0.000 title claims abstract description 348
- 238000012360 testing method Methods 0.000 title claims abstract description 224
- 238000000034 method Methods 0.000 title claims abstract description 62
- 238000004806 packaging method and process Methods 0.000 claims abstract description 19
- 238000013507 mapping Methods 0.000 claims description 8
- 230000004044 response Effects 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 3
- 230000008569 process Effects 0.000 abstract description 16
- 230000006872 improvement Effects 0.000 abstract description 2
- 238000012856 packing Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 238000013522 software testing Methods 0.000 description 6
- 238000011161 development Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000011156 evaluation Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention discloses a tool generation method, a test data construction method, a device, equipment and a medium. Wherein the method comprises the following steps: acquiring a target scene corresponding to the test data structure; generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in; and packaging the data construction page file and the data construction script file into executable files corresponding to the test data construction tool, wherein the executable files are used for realizing test data construction. According to the technical scheme provided by the embodiment of the invention, the generated test data construction tool is not limited by the area, the construction of the test data can be quickly and conveniently carried out, the test data construction process is simplified, and the improvement of the test efficiency is facilitated.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a tool generation method, a test data construction method, a device, equipment and a medium.
Background
The software test is used as an important link in the aspects of verifying the correctness, the integrity, the safety and the like of the software, and plays an important role in comprehensively evaluating the quality of the software. In the software testing process, the test data is used as an input link in the software testing process, and the comprehensiveness of the test data, the fitting property of the test data and a service scene, the convenience of the test data construction and the like affect the efficiency of the software testing and the evaluation of the software quality.
In the prior art, the test data structure has the following problems: the test data construction is long in time consumption, so that the test efficiency is low; the environment on which the test data script is executed is complicated to build, and the skill requirement on the testers is high; most of test data construction tools can only be used in an intranet, and if the test data construction tool is used for implementing the test outside, the data construction is still inconvenient.
At present, no better test data construction tool and test data construction method exist.
Disclosure of Invention
The embodiment of the invention provides a tool generation method, a test data construction method, a device, equipment and a medium, wherein the test data construction tool is not limited by a region, can quickly and conveniently construct test data, simplifies the test data construction process, and is beneficial to improving the test efficiency.
In a first aspect, an embodiment of the present invention provides a test data construction tool generating method, including:
acquiring a target scene corresponding to the test data structure;
generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in;
and packaging the data construction page file and the data construction script file into executable files corresponding to a test data construction tool, wherein the executable files are used for realizing test data construction.
In a second aspect, an embodiment of the present invention provides a test data construction method, implemented based on an executable file corresponding to a test data construction tool in the method according to the first aspect of the present invention, where the method includes:
loading a data construction page file to display a data construction page containing a target scene;
receiving scene selection operation acted on the data construction page by a user, and determining a corresponding first scene according to the scene selection operation;
operating the data construction script file according to the first scene to construct test data corresponding to the first scene by using a second preset plug-in;
outputting the constructed test data in the data construction page.
In a third aspect, an embodiment of the present invention provides a test data construction tool generating apparatus, including:
the scene acquisition module is used for acquiring a target scene corresponding to the test data structure;
the file generation module is used for generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in;
and the file packaging module is used for packaging the data construction page file and the data construction script file into an executable file corresponding to the test data construction tool, wherein the executable file is used for realizing test data construction.
In a fourth aspect, an embodiment of the present invention provides a test data construction device, implemented based on an executable file corresponding to a test data construction tool in a device according to the third aspect of the present invention, where the device includes:
the file loading module is used for loading the data construction page file so as to display a data construction page containing a target scene;
the scene determining module is used for receiving scene selection operation acted on the data construction page by a user and determining a corresponding first scene according to the scene selection operation;
the data construction module is used for running the data construction script file according to the first scene so as to construct test data corresponding to the first scene by using a second preset plug-in;
and the data output module is used for outputting the constructed test data in the data construction page.
In a fifth aspect, embodiments of the present invention provide a computer apparatus, comprising:
one or more processors;
a storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the test data construction tool generation method or the test data construction method according to any of the embodiments of the present invention.
In a sixth aspect, an embodiment of the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the test data construction tool generation method or the test data construction method according to any embodiment of the present invention.
The embodiment of the invention provides a tool generating method, a test data constructing method, a device, equipment and a medium, wherein a target scene corresponding to test data construction is firstly obtained, then a data construction page file corresponding to the target scene is generated through a first preset plug-in according to the target scene, a data construction script file corresponding to the target scene based on a second preset plug-in is generated, finally the data construction page file and the data construction script file are packaged into an executable file corresponding to the test data construction tool, the executable file is used for realizing the test data construction, and the generated test data construction tool is not limited by areas by adopting the technical scheme, so that the test data construction process can be quickly and conveniently carried out, the test data construction process is simplified, and the test efficiency is improved.
Drawings
FIG. 1 is a flowchart of a method for generating a test data construction tool according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a method for generating a test data construction tool according to a second embodiment of the present invention;
FIG. 3 is a flowchart of a test data construction method according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a test data constructing tool generating device according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a test data constructing apparatus according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a computer device according to a sixth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a method for generating a test data construction tool according to a first embodiment of the present invention, where the embodiment is applicable to a case of generating a test data construction tool. The test data construction tool generating method provided by the embodiment of the invention can be executed by the test data construction tool generating device provided by the embodiment of the invention, and the device can be realized in a software and/or hardware mode and is integrated in computer equipment for executing the method.
Referring to fig. 1, the method of the present embodiment includes, but is not limited to, the following steps:
s110, acquiring a target scene corresponding to the test data structure.
The number of the target scenes is not limited, and may be one or more.
In the software testing process, the test data is used as an input link in the software testing process, and the comprehensiveness of the test data, the fitting property of the test data and a service scene, the convenience of the test data construction and the like affect the efficiency of the software testing and the evaluation of the software quality. In order to be able to generate a test data construction tool, it is necessary to acquire a target scene corresponding to the test data construction process, so as to generate a data construction page file and a data construction script file corresponding to the target scene in a targeted manner according to the target scene.
S120, generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in.
The first preset plugin may be understood as a tool capable of generating a data construction page file corresponding to a target scene, and may be a graphical display interface tool, for example, touchGFX, microsoft FrontPage, pyQt5, or the like. The second preset plug-in may be understood as a tool capable of data construction, such as QTP, winRunner, robot, dataFactory, DBMonster or Faker, etc. The data construction script file may be understood as a file corresponding to a data construction method corresponding to the target scene based on the second preset plugin.
After the target scene is acquired, a data construction page file corresponding to the target scene can be generated through a first preset plug-in according to the target scene, and the data construction page file can display a data construction page containing the target scene so as to be displayed to relevant testers. And generating a data construction script file corresponding to the target scene based on the second preset plug-in according to the target scene, and executing the data construction script file can perform data construction of the target scene.
S130, packaging the data construction page file and the data construction script file into executable files corresponding to the test data construction tool.
The executable file is used for realizing test data construction.
In order to solve the problems that the execution environment of the built test script is complex, the construction of test data in the outgoing process is troublesome, and the like, after the data construction page file and the data construction script file are obtained, the data construction page file and the data construction script file can be packed into executable files corresponding to the test data construction tool through a packing method or a packing tool, so that the generated test data construction tool is not limited by areas, the construction of the test data can be carried out anytime and anywhere, and manpower and material resources are saved.
It should be noted that: in the embodiment of the invention, the corresponding packing operation can be performed by the packing tool or the packing plug-in, and the specific packing tool or the packing plug-in is not particularly limited.
According to the technical scheme provided by the embodiment, firstly, the target scene corresponding to the test data construction is obtained, then, the data construction page file corresponding to the target scene is generated through the first preset plug-in, the data construction script file corresponding to the target scene based on the second preset plug-in is generated, finally, the data construction page file and the data construction script file are packaged into the executable file corresponding to the test data construction tool, the executable file is used for realizing the test data construction, the generated test data construction tool is not limited by the area, the construction of test data can be quickly and conveniently carried out, the test data construction process is simplified, and the test efficiency is improved.
Example two
Fig. 2 is a flowchart of a test data construction tool generating method according to a second embodiment of the present invention. The embodiment of the invention is optimized based on the embodiment. Optionally, the process of acquiring the target scene corresponding to the test data structure and the process of generating the corresponding data structure page file and data structure script file are explained in detail in this embodiment.
Referring to fig. 2, the method of the present embodiment includes, but is not limited to, the following steps:
s210, acquiring a scene corresponding to the test service, determining the scene as a target scene corresponding to the test data structure, and determining data parameters corresponding to the target scene.
In the process of generating the test data construction tool, a scene corresponding to the test service needs to be acquired first, so that the universality and applicability of the test data construction tool are enhanced. The target scenes corresponding to different test services are also different. For example, if the test service is a user management service, the corresponding target scenario may be a new user scenario or a new department scenario, etc.; for another example, if the test service is an item management service, the corresponding target scenario may be a new item scenario, an existing item scenario, a completed item scenario, and so on. In order to make the test data construction tool have a larger application range, a plurality of general target scenes are provided. After the scene corresponding to the test service is obtained, the scene is determined to be a target scene corresponding to the test data construction, and data parameters corresponding to the target scene are determined, for example, when the target scene is a newly built user scene, the corresponding data parameters can be related parameters such as the name, login name, mobile phone number, identity card number, mailbox address and the like of the user. The data parameters corresponding to the target scene are determined, so that the subsequent generation of the script file based on the data of the second preset plug-in unit by taking the data parameters corresponding to the target scene as input parameters can be facilitated.
S220, generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file based on the data of a second preset plug-in by taking the data parameters corresponding to the target scene as input parameters.
After the target scene is acquired, a data construction page file corresponding to the target scene can be generated through the first preset plug-in according to the target scene. Meanwhile, after the data parameters corresponding to the target scene are determined, the data construction script file based on the second preset plug-in can be generated by taking the data parameters corresponding to the target scene as input parameters, namely, the data construction script file corresponding to the data parameters corresponding to the target scene is generated.
Optionally, the first preset plug-in is PyQt5, and the second preset plug-in is Faker; correspondingly, the generating, according to the target scene, the data construction page file corresponding to the target scene through the first preset plug-in, and generating the data construction script file corresponding to the target scene based on the second preset plug-in may specifically include: determining a target data construction page graphical display requirement corresponding to the target scene based on a preset mapping relation, wherein the preset mapping relation comprises a corresponding relation between the target scene and the data construction page graphical display requirement, and the data construction page graphical display requirement comprises page layout information and page element response event information; generating a data construction page file corresponding to the target scene according to the target data construction page graphical display requirement through PyQt 5; generating a data construction script file based on the Faker by taking the data parameters corresponding to the target scene as input parameters.
Among them, pyQt5 can be understood as a tool for creating a graphical user interface (Graphical User Interface, abbreviated as GUI) application, which integrates Python with Qt library, effectively improving development efficiency. The GUI refers to a computer-operated user interface that is displayed in a graphical manner. Faker can be understood as a multi-data source test data construction tool that can simulate the generation of most common data types, including common database field types (integer, floating point, and character) and custom types (IP address, mailbox, identification card number, etc.).
It should be noted that: in the embodiment of the present invention, the first preset plug-in is PyQt5, and the second preset plug-in is Faker, where PyQt5 and Faker are respectively a first preset plug-in and a second preset plug-in corresponding to a Python programming language, and if they are other programming languages, the first preset plug-in and the second preset plug-in may be other corresponding plug-ins, and the embodiment is not specifically limited.
Specifically, because the preset mapping relationship includes a corresponding relationship between the target scene and the graphical display requirement of the data construction page, the graphical display requirement of the target data construction page corresponding to the target scene can be determined based on the preset mapping relationship, mainly including determining page layout information and page element response event information of the target data construction page, for example, taking the left side of the page of the target data construction page as a scene selection area, i.e. a distribution area of page elements, and taking the right side of the page as a test data output area, i.e. an area corresponding to the page element response event, and realizing scene selection through buttons or menus and the like. In addition, the graphic display requirement of the data construction page can be set in a self-defined mode according to the requirement of a user, for example, page layout and page element response events in the data construction page are displayed correspondingly according to the favorite page display style of the user; the graphic display requirement of the data construction page can be designed in advance, and the embodiment is not particularly limited. The PyQt5 can generate a data construction page file corresponding to the target scene according to the target data construction page graphical display requirement, and generate a data construction script file based on Faker by taking the data parameters corresponding to the target scene as input parameters.
According to the embodiment of the invention, the PyQt5 is used for generating the data construction page file corresponding to the target scene, the data construction page containing the target scene can be displayed through the data construction page file, the operability of a tester is enhanced, and the operation difficulty is reduced. Meanwhile, the data parameters corresponding to the target scene are used as input parameters, and the script file is constructed based on the Faker data, so that the construction of subsequent test data is facilitated.
Further, before the generating, by the first preset plug-in, the data construction page file corresponding to the target scene and generating, by the second preset plug-in, the data construction script file corresponding to the target scene, the method may specifically further include: building a development environment of a preset programming language according to the target scene, and installing a first preset plug-in and a second preset plug-in corresponding to the preset programming language.
Specifically, a development environment of a preset programming language, for example, a development environment of Python is built according to a target scene, and a first preset plug-in and a second preset plug-in corresponding to the preset programming language are installed, so that a data construction page file and a data construction script file corresponding to the target scene can be conveniently generated through the built development environment, the first preset plug-in and the second preset plug-in.
Further, the first preset plug-in is PyQt5, and the second preset plug-in is Faker, and correspondingly, before installing the first preset plug-in and the second preset plug-in corresponding to the preset programming language, the method further includes: the pip plug-in is installed.
Specifically, the pip is a Python package management tool through which Python packages can be searched, downloaded, installed, and uninstalled, and thus a pip plug-in needs to be installed before PyQt5 and Faker are installed.
S230, packaging the data construction page file and the data construction script file into executable files corresponding to the test data construction tool.
Optionally, the packaging the data construction page file and the data construction script file into executable files corresponding to the test data construction tool may specifically include: determining file paths of the data construction page file and the data construction script file; and under the file path, generating an executable file corresponding to a test data construction tool containing the data construction page file and the data construction script file by executing a preset package command.
Specifically, when packaging the data construction page file and the data construction script file, it is necessary to determine file paths of the data construction page file and the data construction script file first, for example, by determining file paths of the data construction page file and the data construction script file after entering the cmd command console, and after determining corresponding file paths, by executing a preset packaging command under the file paths, for example, under the Python programming language, if packaging is performed using a pyinstrer tool, the packaging command at this time is: pyinstrler-F-wxx.py, where xx refers to file names of corresponding data construction page files and data construction script files, can generate executable files corresponding to test data construction tools that include the data construction page files and the data construction script files. In the embodiment of the invention, the executable file corresponding to the test data construction tool can be quickly packed by a simple method by firstly determining the file path of the data construction page file and the data construction script file and then executing the preset packing command under the file path to generate the executable file corresponding to the test data construction tool, so that the executable file corresponding to the test data construction tool is quickly generated.
According to the technical scheme provided by the embodiment, firstly, the scene corresponding to the test service is acquired, the scene is determined to be the target scene corresponding to the test data construction, the data parameters corresponding to the target scene are determined, then, the data construction page file corresponding to the target scene is generated through the first preset plug-in unit according to the target scene, the data construction script file based on the second preset plug-in unit and taking the data parameters corresponding to the target scene as input parameters is generated, finally, the data construction page file and the data construction script file are packed into the executable file corresponding to the test data construction tool, the data parameters corresponding to the target scene are determined to facilitate the subsequent generation of the data construction script file based on the second preset plug-in unit, the accurate construction of the test data is facilitated, and the packing can be performed quickly through a simple method, so that the executable file corresponding to the test data construction tool is generated quickly, the efficiency of the subsequent test data construction is improved, the test data construction process is simplified, and the test efficiency is improved.
Example III
Fig. 3 is a flowchart of a test data construction method according to a third embodiment of the present invention, where the present embodiment is applicable to a case of constructing test data by using an executable file corresponding to a test data construction tool. The test data construction method provided by the embodiment of the invention can be executed by the test data construction device provided by the embodiment of the invention, and the device can be realized by software and/or hardware and is integrated in computer equipment for executing the method.
Referring to fig. 3, the method of the present embodiment includes, but is not limited to, the following steps:
s310, loading a data construction page file to display a data construction page containing a target scene.
In the above embodiment of the present invention, the executable file corresponding to the test data construction tool has been obtained, and the executable file includes the data construction page file and the data construction script file, so by running the executable file, the data construction page file can be loaded, so that the data construction page including the target scene is displayed, so that the scene selection operation applied to the data construction page by the user can be received subsequently, and the corresponding first scene is determined according to the scene selection operation.
S320, receiving a scene selection operation of a user on the data construction page, and determining a corresponding first scene according to the scene selection operation.
After the user performs scene selection by triggering the scene selection operation of the data construction page, the executable file receives the scene selection operation of the user on the data construction page, and the corresponding first scene, namely the scene selection result, can be determined according to the scene selection operation.
S330, constructing a script file according to the first scene operation data so as to construct test data corresponding to the first scene by using a second preset plug-in.
And running the data construction script file in the executable file corresponding to the test data construction tool according to the first scene, and constructing the test data corresponding to the first scene through a second preset plug-in.
S340, outputting the constructed test data in the data construction page.
After the test data corresponding to the first scene is constructed, the constructed test data is output in a data construction page so that a user can check the test data and conduct subsequent test work.
According to the technical scheme provided by the embodiment, the data construction page file is firstly loaded to display the data construction page containing the target scene, then the scene selection operation of a user on the data construction page is received, the corresponding first scene is determined according to the scene selection operation, then the script file is constructed according to the first scene operation data, the test data corresponding to the first scene is constructed by utilizing the second preset plug-in, finally the constructed test data is output in the data construction page, the simple and quick construction of the test data can be realized through the executable file corresponding to the test data construction tool, the constructed test data is more attached to the actual scene, meanwhile, due to the easy operability of the executable file, the time of a tester is saved, and the test efficiency is facilitated to be improved.
In some embodiments, the running the data construction script file according to the first scenario to construct test data corresponding to the first scenario by using a second preset plug-in may specifically include: and operating the data construction script file according to the first scene, and calling a corresponding test data construction method in a second preset plug-in based on the parameter data corresponding to the first scene to construct test data corresponding to the first scene.
In the embodiment of the invention, the script file is constructed according to the first scene operation data, and the corresponding test data construction method in the second preset plug-in is called based on the parameter data corresponding to the first scene to construct the test data corresponding to the first scene, so that the test data and the parameter corresponding to the first scene are in a corresponding relation, the actual test requirement is more satisfied, and the efficiency of the test is improved.
In some embodiments, the data construction page file is generated by a first preset plug-in, the first preset plug-in being PyQt5 and the second preset plug-in being Faker.
According to the embodiment of the invention, the PyQt5 is used for generating the data construction page file corresponding to the target scene, the data construction page containing the target scene can be displayed through the data construction page file, the operability of a tester is enhanced, and the operation difficulty is reduced. Meanwhile, the Faker is utilized to construct the test data corresponding to the first scene, so that the problem that the test data are constructed manually in the existing test data construction method is solved, and the efficiency of constructing the test data is improved.
Example IV
Fig. 4 is a schematic structural diagram of a test data constructing tool generating device according to a fourth embodiment of the present invention, and as shown in fig. 4, the device may include:
a scene acquisition module 410, configured to acquire a target scene corresponding to the test data structure;
the file generating module 420 is configured to generate, according to the target scene, a data construction page file corresponding to the target scene through a first preset plug-in, and generate a data construction script file corresponding to the target scene based on a second preset plug-in;
and the file packaging module 430 is configured to package the data construction page file and the data construction script file into an executable file corresponding to a test data construction tool, where the executable file is used to implement test data construction.
According to the technical scheme provided by the embodiment, firstly, the target scene corresponding to the test data construction is obtained, then, the data construction page file corresponding to the target scene is generated through the first preset plug-in, the data construction script file corresponding to the target scene based on the second preset plug-in is generated, finally, the data construction page file and the data construction script file are packaged into the executable file corresponding to the test data construction tool, the executable file is used for realizing the test data construction, the generated test data construction tool is not limited by the area, the construction of test data can be quickly and conveniently carried out, the test data construction process is simplified, and the test efficiency is improved.
Further, the scene acquisition module 410 may be specifically configured to: acquiring a scene corresponding to a test service, determining the scene as a target scene corresponding to the test data structure, and determining data parameters corresponding to the target scene; correspondingly, the generating the data construction script file corresponding to the target scene based on the second preset plugin may specifically include: generating a script file based on the data of the second preset plugin by taking the data parameters corresponding to the target scene as input parameters.
Further, the first preset plug-in is PyQt5, and the second preset plug-in is Faker; accordingly, the file generating module 420 may be specifically configured to: determining a target data construction page graphical display requirement corresponding to the target scene based on a preset mapping relation, wherein the preset mapping relation comprises a corresponding relation between the target scene and the data construction page graphical display requirement, and the data construction page graphical display requirement comprises page layout information and page element response event information; generating a data construction page file corresponding to the target scene according to the target data construction page graphical display requirement through PyQt 5; generating a data construction script file based on the Faker by taking the data parameters corresponding to the target scene as input parameters.
Further, the file packaging module 430 may be specifically configured to: determining file paths of the data construction page file and the data construction script file; and under the file path, generating an executable file corresponding to a test data construction tool containing the data construction page file and the data construction script file by executing a preset package command.
The test data construction tool generating device provided by the embodiment can be applied to the test data construction tool generating method provided by any embodiment, and has corresponding functions and beneficial effects.
Example five
Fig. 5 is a schematic structural diagram of a test data constructing apparatus according to a fifth embodiment of the present invention, as shown in fig. 5, the apparatus may include:
a file loading module 510 for loading a data construction page file to display a data construction page containing a target scene;
the scene determining module 520 is configured to receive a scene selection operation performed by a user on the data construction page, and determine a corresponding first scene according to the scene selection operation;
a data construction module 530, configured to run the data construction script file according to the first scenario, so as to construct test data corresponding to the first scenario by using a second preset plug-in;
and a data output module 540 for outputting the constructed test data in the data construction page.
According to the technical scheme provided by the embodiment, the data construction page file is firstly loaded to display the data construction page containing the target scene, then the scene selection operation of a user on the data construction page is received, the corresponding first scene is determined according to the scene selection operation, then the script file is constructed according to the first scene operation data, the test data corresponding to the first scene is constructed by utilizing the second preset plug-in, finally the constructed test data is output in the data construction page, the simple and quick construction of the test data can be realized through the executable file corresponding to the test data construction tool, the constructed test data is more attached to the actual scene, meanwhile, due to the easy operability of the executable file, the time of a tester is saved, and the test efficiency is facilitated to be improved.
Further, the data construction module 530 may be specifically configured to: and operating the data construction script file according to the first scene, and calling a corresponding test data construction method in a second preset plug-in based on the parameter data corresponding to the first scene to construct test data corresponding to the first scene.
The test data construction device provided by the embodiment can be applied to the test data construction method provided by any embodiment, and has corresponding functions and beneficial effects.
Example six
Fig. 6 is a schematic structural diagram of a computer device according to a sixth embodiment of the present invention, where, as shown in fig. 6, the computer device includes a processor 610, a storage 620, and a communication 630; the number of processors 610 in the computer device may be one or more, one processor 610 being taken as an example in fig. 6; the processor 610, the storage 620, and the communication 630 in the computer device may be connected by a bus or other means, for example in fig. 6.
The storage 620 is a computer readable storage medium, and may be used to store a software program, a computer executable program, and modules, such as a module corresponding to a test data construction tool generating method in an embodiment of the present invention (for example, a scene acquisition module 410, a file generation module 420, and a file packaging module 430 in a test data construction tool generating device), and a module corresponding to a test data construction method in an embodiment of the present invention (for example, a file loading module 510, a scene determination module 520, a data construction module 530, and a data output module 540 in a test data construction device). The processor 610 executes various functional applications of the computer device and data processing, i.e., implements the test data construction tool generation method or the test data construction method described above, by running software programs, instructions, and modules stored in the storage 620.
The storage 620 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for functions; the storage data area may store data created according to the use of the terminal, etc. In addition, storage 620 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, storage 620 may further include memory located remotely from processor 610, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Communication means 630 for implementing a network connection or a mobile data connection between the servers.
The computer device provided in this embodiment may be used to execute the test data construction tool generating method or the test data construction method provided in any of the foregoing embodiments, and has corresponding functions and beneficial effects.
Example seven
The seventh embodiment of the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the test data construction tool generation method or the test data construction method in any of the embodiments of the present invention.
The test data construction tool generation method specifically comprises the following steps:
acquiring a target scene corresponding to the test data structure;
generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in;
and packaging the data construction page file and the data construction script file into executable files corresponding to a test data construction tool, wherein the executable files are used for realizing test data construction.
The test data construction method specifically comprises the following steps:
loading a data construction page file to display a data construction page containing a target scene;
receiving scene selection operation acted on the data construction page by a user, and determining a corresponding first scene according to the scene selection operation;
operating the data construction script file according to the first scene to construct test data corresponding to the first scene by using a second preset plug-in;
outputting the constructed test data in the data construction page.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform the related operations in the test data construction tool generating method or the test data construction method provided in any embodiment of the present invention.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., and include several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to execute the method according to the embodiments of the present invention.
It should be noted that, in the embodiments of the test data construction tool generating device and the test data construction device, each unit and module included are only divided according to the functional logic, but are not limited to the above-mentioned division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, and various modifications and variations may be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A method of generating a test data construction tool, comprising:
acquiring a target scene corresponding to the test data structure;
generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in, wherein the data construction page file is used for displaying a data construction page containing the target scene;
and packaging the data construction page file and the data construction script file into executable files corresponding to a test data construction tool, wherein the executable files are used for realizing test data construction.
2. The method of claim 1, wherein the obtaining the target scene corresponding to the test data structure comprises:
acquiring a scene corresponding to a test service, determining the scene as a target scene corresponding to the test data structure, and determining data parameters corresponding to the target scene;
correspondingly, the generating the data construction script file corresponding to the target scene based on the second preset plugin comprises the following steps:
generating a script file based on the data of the second preset plugin by taking the data parameters corresponding to the target scene as input parameters.
3. The method of claim 2, wherein the first preset plug-in is PyQt5 and the second preset plug-in is Faker;
correspondingly, the generating, according to the target scene, a data construction page file corresponding to the target scene through a first preset plug-in, and generating, based on a second preset plug-in, a data construction script file corresponding to the target scene includes:
determining a target data construction page graphical display requirement corresponding to the target scene based on a preset mapping relation, wherein the preset mapping relation comprises a corresponding relation between the target scene and the data construction page graphical display requirement, and the data construction page graphical display requirement comprises page layout information and page element response event information;
generating a data construction page file corresponding to the target scene according to the target data construction page graphical display requirement through PyQt 5;
generating a data construction script file based on the Faker by taking the data parameters corresponding to the target scene as input parameters.
4. A method according to any one of claims 1-3, wherein said packaging said data construction page file and said data construction script file into an executable file corresponding to a test data construction tool comprises:
determining file paths of the data construction page file and the data construction script file;
and under the file path, generating an executable file corresponding to a test data construction tool containing the data construction page file and the data construction script file by executing a preset package command.
5. A method of constructing test data based on an executable file implementation corresponding to the test data construction tool according to any one of claims 1 to 4, the method comprising:
loading a data construction page file to display a data construction page containing a target scene;
receiving scene selection operation acted on the data construction page by a user, and determining a corresponding first scene according to the scene selection operation;
operating the data construction script file according to the first scene to construct test data corresponding to the first scene by using a second preset plug-in;
outputting the constructed test data in the data construction page.
6. The method of claim 5, wherein the running the data construction script file from the first scene to construct test data corresponding to the first scene using a second preset plug-in comprises:
and operating the data construction script file according to the first scene, and calling a corresponding test data construction method in a second preset plug-in based on the parameter data corresponding to the first scene to construct test data corresponding to the first scene.
7. A test data construction tool generating apparatus, comprising:
the scene acquisition module is used for acquiring a target scene corresponding to the test data structure;
the file generation module is used for generating a data construction page file corresponding to the target scene through a first preset plug-in according to the target scene, and generating a data construction script file corresponding to the target scene based on a second preset plug-in, wherein the data construction page file is used for displaying a data construction page containing the target scene;
and the file packaging module is used for packaging the data construction page file and the data construction script file into an executable file corresponding to the test data construction tool, wherein the executable file is used for realizing test data construction.
8. A test data construction apparatus based on an executable file implementation corresponding to the test data construction tool of claim 7, the apparatus comprising:
the file loading module is used for loading the data construction page file so as to display a data construction page containing a target scene;
the scene determining module is used for receiving scene selection operation acted on the data construction page by a user and determining a corresponding first scene according to the scene selection operation;
the data construction module is used for running the data construction script file according to the first scene so as to construct test data corresponding to the first scene by using a second preset plug-in;
and the data output module is used for outputting the constructed test data in the data construction page.
9. A computer device, the computer device comprising:
one or more processors;
a storage means for storing one or more programs;
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-6.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110204223.XA CN112835803B (en) | 2021-02-23 | 2021-02-23 | Tool generation method, test data construction method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110204223.XA CN112835803B (en) | 2021-02-23 | 2021-02-23 | Tool generation method, test data construction method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112835803A CN112835803A (en) | 2021-05-25 |
CN112835803B true CN112835803B (en) | 2024-02-23 |
Family
ID=75933172
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110204223.XA Active CN112835803B (en) | 2021-02-23 | 2021-02-23 | Tool generation method, test data construction method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112835803B (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2001093043A1 (en) * | 2000-03-27 | 2001-12-06 | Accenture Llp | System, method, and article of manufacture for an automated scripting solution for enterprise testing |
CN101571802A (en) * | 2009-06-19 | 2009-11-04 | 北京航空航天大学 | Visualization automatic generation method of embedded software test data and system thereof |
CN103761181A (en) * | 2013-11-18 | 2014-04-30 | 芜湖大学科技园发展有限公司 | Construction method of power test environment |
CN104767729A (en) * | 2015-02-10 | 2015-07-08 | 上海创景计算机系统有限公司 | Communication data protocol construction and deconstruction system and method |
CN106294184A (en) * | 2016-08-30 | 2017-01-04 | 广州华多网络科技有限公司 | The graphical creation method of test scene, device and terminal unit |
CN107329900A (en) * | 2017-07-06 | 2017-11-07 | 携程计算机技术(上海)有限公司 | The method for generating test data |
CN107480053A (en) * | 2017-07-21 | 2017-12-15 | 杭州销冠网络科技有限公司 | A kind of Software Test Data Generation Method and device |
CN108388515A (en) * | 2018-03-06 | 2018-08-10 | 平安科技(深圳)有限公司 | Test data generating method, device, equipment and computer readable storage medium |
CN109460367A (en) * | 2018-11-16 | 2019-03-12 | 四川长虹电器股份有限公司 | Method based on the sustainable integrated automation performance test of Jmeter |
CN110162458A (en) * | 2019-04-15 | 2019-08-23 | 深圳壹账通智能科技有限公司 | Test data building method, device and storage medium |
CN111008122A (en) * | 2019-10-12 | 2020-04-14 | 平安普惠企业管理有限公司 | Test data generation method and device, computer equipment and storage medium |
CN112306893A (en) * | 2020-11-27 | 2021-02-02 | 平安普惠企业管理有限公司 | UI page testing method and device, computer equipment and storage medium |
-
2021
- 2021-02-23 CN CN202110204223.XA patent/CN112835803B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2001093043A1 (en) * | 2000-03-27 | 2001-12-06 | Accenture Llp | System, method, and article of manufacture for an automated scripting solution for enterprise testing |
CN101571802A (en) * | 2009-06-19 | 2009-11-04 | 北京航空航天大学 | Visualization automatic generation method of embedded software test data and system thereof |
CN103761181A (en) * | 2013-11-18 | 2014-04-30 | 芜湖大学科技园发展有限公司 | Construction method of power test environment |
CN104767729A (en) * | 2015-02-10 | 2015-07-08 | 上海创景计算机系统有限公司 | Communication data protocol construction and deconstruction system and method |
CN106294184A (en) * | 2016-08-30 | 2017-01-04 | 广州华多网络科技有限公司 | The graphical creation method of test scene, device and terminal unit |
CN107329900A (en) * | 2017-07-06 | 2017-11-07 | 携程计算机技术(上海)有限公司 | The method for generating test data |
CN107480053A (en) * | 2017-07-21 | 2017-12-15 | 杭州销冠网络科技有限公司 | A kind of Software Test Data Generation Method and device |
CN108388515A (en) * | 2018-03-06 | 2018-08-10 | 平安科技(深圳)有限公司 | Test data generating method, device, equipment and computer readable storage medium |
CN109460367A (en) * | 2018-11-16 | 2019-03-12 | 四川长虹电器股份有限公司 | Method based on the sustainable integrated automation performance test of Jmeter |
CN110162458A (en) * | 2019-04-15 | 2019-08-23 | 深圳壹账通智能科技有限公司 | Test data building method, device and storage medium |
CN111008122A (en) * | 2019-10-12 | 2020-04-14 | 平安普惠企业管理有限公司 | Test data generation method and device, computer equipment and storage medium |
CN112306893A (en) * | 2020-11-27 | 2021-02-02 | 平安普惠企业管理有限公司 | UI page testing method and device, computer equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
My Laravel Beginner’s Guide : Let’s generate fake data in Laravel;Nithisa.L;https://medium.com/@nithisa.l/my-laravel-beginners-guide-let-s-generate-fake-data-in-laravel-13c369a51c1c;20200629;全文 * |
推荐技术人员一款Python开源库(造数据神器);狂师;https://www.jb51.net/article/190365.htm;20200708;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112835803A (en) | 2021-05-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107908541B (en) | Interface testing method and device, computer equipment and storage medium | |
CN108595329B (en) | Application testing method and device and computer storage medium | |
CN110730107B (en) | Test data generation method and device, computer equipment and storage medium | |
CN108459954B (en) | Application program vulnerability detection method and device | |
CN114546738B (en) | Universal test method, system, terminal and storage medium for server | |
CN111858296B (en) | Interface testing method, device, equipment and storage medium | |
CN110569159A (en) | Baffle generation method, device, equipment and computer storage medium | |
CN109726134B (en) | Interface test method and system | |
CN110554962A (en) | Regression testing process covering method, server and computer readable storage medium | |
CN113568839A (en) | Method, device, equipment and medium for software testing and statistical test coverage rate | |
CN108052440B (en) | Method, device, equipment and storage medium for correcting operation logic of business system | |
CN111258913A (en) | Automatic algorithm testing method and device, computer system and readable storage medium | |
CN112597052A (en) | Interface testing method and device and computer readable storage medium | |
CN111026647B (en) | Method and device for acquiring code coverage rate, computer equipment and storage medium | |
CN117370203B (en) | Automatic test method, system, electronic equipment and storage medium | |
CN110990008A (en) | Method, device, storage medium and electronic equipment for updating page | |
CN113434396A (en) | Interface test method, device, equipment, storage medium and program product | |
CN108399125B (en) | Automatic testing method and device, computer equipment and storage medium | |
CN111881041A (en) | Front-end application testing method and device, terminal equipment and storage medium | |
CN111694550A (en) | Page display control method, device and system | |
CN110162310B (en) | Plug-in interface test method and device, computer equipment and storage medium | |
CN110543429A (en) | Test case debugging method and device and storage medium | |
CN112835803B (en) | Tool generation method, test data construction method, device, equipment and medium | |
CN112685023A (en) | Front-end development processing method, device, equipment and storage medium based on basic library | |
CN111159028A (en) | Webpage testing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |