Disclosure of Invention
In view of the above defects in the prior art, the technical problems to be solved by the present invention are the problems of high hardware cost, difficulty in simulation of scenes, complexity in development of test programs, difficulty in maintenance and the like in the existing method for testing the accuracy of analysis and statistics data of a cloud server, and the test method and device for generating a simulation test scene based on the visual dragging of a Web page are provided.
In order to achieve the purpose, the invention provides a test method for generating a simulation test scene based on visual dragging of a Web page, which comprises the following steps:
creating and storing a group simulating a test scene in a Web page;
connecting the cloud server according to the stored simulation test scene, automatically acquiring data of the cloud server, and designing the scene according to the cloud service data;
and selecting a scene in the Web page to operate and obtaining a test result.
Further, creating and storing a simulation test scene, specifically comprising:
creating a group of functional modules according to the test requirement;
and under the grouping of the created functional modules, creating and storing a simulation scene, and setting basic information of the scene.
Further, according to the saved simulation test scenario, data of the cloud server is automatically acquired, and scenario design is performed according to cloud service data, which specifically includes:
connecting the cloud server;
the method comprises the steps of automatically acquiring data of a cloud server, and displaying the data in a webpage for selection in a card form;
selecting specific items and quantities corresponding to the real television according to the data obtained from the cloud server, and automatically creating a simulation machine graph;
adding a date track according to the test requirement;
and dragging the graph of the simulator to a date track, setting data to be sent in a simulated mode, completing scene design and storing the scene.
Further, selecting a scene in the Web page to run and obtaining a test result, specifically comprising:
automatically generating an executable script according to the simulation machine graph in the saved scene;
and clicking the running script, and comparing the statistical data in the cloud server with an expected result to obtain a final test result.
In a preferred embodiment of the present invention, a testing apparatus for generating a simulation test scenario based on a Web page visual drag is provided, which includes:
the new building module is used for building and storing a simulation test scene in the Web page;
the design module is used for automatically acquiring data of the cloud server according to the stored simulation test scene and carrying out scene design according to the cloud service data;
and the operation module is used for selecting a scene in the Web page to operate and obtaining a test result.
Further, the newly-built module comprises:
the grouping unit is used for creating the grouping of the functional modules according to the test requirement;
and the storage unit is used for creating and storing the simulated scene and setting the basic information of the scene under the grouping of the created functional modules.
Further, the design module includes:
a connection unit for connecting the cloud server;
the acquisition unit is used for automatically acquiring data of the cloud server and displaying the data in a webpage for selection in a card form;
the simulation machine graphic creating unit is used for selecting specific items and quantities corresponding to the real television according to the data obtained from the cloud server and automatically creating simulation machine graphics;
the adding unit is used for adding a date track according to the test requirement;
and the setting unit is used for dragging the graph of the simulator to the date track, setting data to be sent in a simulated mode, finishing scene design and storing the scene.
Further, the operation module includes:
the script unit is used for automatically generating an executable script according to the simulation machine graph in the saved scene;
and the test unit is used for clicking the operation script and comparing the statistical data with an expected result in the cloud server to obtain a final test result.
In another preferred embodiment of the present invention, a computer device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the program, performs the method as in any one of the above.
In another preferred embodiment of the present invention, a computer-readable storage medium storing a computer program is characterized in that the computer program is configured to enable a computer to implement a test method for generating a simulation test scenario based on a Web page visual drag when the computer executes the test method.
Technical effects
1) The simulation test scenes are managed by Web webpage groups, so that the existing simulation scenes can be clearly seen, and the scenes needing to be maintained and used can be conveniently clicked and selected when the scenes are maintained and used.
2) By automatically acquiring the cloud server data, the operation of manually setting project information and part of simulation data can be omitted, convenience is brought to test work, and time cost is saved.
3) The simulation test scene is designed in a visual dragging mode, so that the whole scene can be intuitively grasped during design, the error risk is reduced, and the test quality is improved.
4) The runnable script is automatically generated according to the graphic scene, so that a tester does not need to manually write script codes, the requirement on the coding aspect of the tester is lowered, the tester only needs to pay attention to how to design a more complete test case, and the popularization, the study and the application of the simulation test scene in a test team are greatly facilitated.
5) Most of the whole process is visual operation based on the Web page, so that the test function is guaranteed, the use difficulty is reduced, and the labor cost is saved.
The conception, the specific structure and the technical effects of the present invention will be further described with reference to the accompanying drawings to fully understand the objects, the features and the effects of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular internal procedures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
Example one
As shown in fig. 1, the embodiment provides a test method for generating a simulation test scenario based on a Web page visual drag, which includes the following steps:
step 100, creating and storing a group of simulation test scenes in a Web page; the method specifically comprises the following steps:
step 101, creating a grouping of functional modules according to test requirements; for example, if the ranking, map and rhythm functional modules are activated, three groups can be created in sequence, and then scenes are added in each group for design;
and 102, under the grouping of the created functional modules, creating and storing a simulated scene, and setting basic information of the scene, such as a scene name, a scene description, a simulated real scene and the like.
200, automatically acquiring data of a cloud server according to a stored simulation test scene, and designing a scene according to cloud service data; the method specifically comprises the following steps:
step 201, connecting the cloud server; the data of the cloud server are automatically acquired and displayed in a webpage for selection in a card form; when scene design is carried out, the cloud server database is connected, and client and project information is acquired and visually displayed in a webpage for selection;
step 202, selecting specific items and quantities corresponding to real televisions according to data obtained from a cloud server, and automatically creating a simulator graph; the method comprises the steps that a user and item information acquired from a cloud server database is clicked, items are selected to set a brand of a television to be simulated, the number of the television is simulated by inputting the number, for example, a CVTE _1 item of a CVTE user can be selected, 500 televisions are simulated, and a corresponding draggable rectangular graph called a simulator graph is generated above a page;
step 203, adding a date track according to the test requirement; adding date tracks below the page, wherein each date track occupies a line of space below the page;
and 204, dragging the graph of the simulator to a date track, setting data to be sent in a simulated mode, completing scene design and storing the scene. Dragging the simulator graph to a certain date track, for example, in the track of 8 th month 8, a graph which is the same as the dragged simulator graph is newly added in the track, which means that the simulator will simulate 8 th month 8 and send data to the cloud server, and then clicking the simulator graph in the track to set the data for simulated sending.
A plurality of different simulation test scenes are designed and stored by setting different simulator graphs, adding different date tracks and setting different simulation data.
Step 300, selecting a scene in a Web page to run and obtaining a test result, specifically comprising:
step 301, automatically generating an executable script according to the stored simulator graph in the scene;
and 302, clicking the running script, and comparing the statistical data in the cloud server with an expected result to obtain a final test result.
The embodiment of the invention relates to three data:
1. project information data in the cloud server, wherein the data need to be preset in advance;
2. the statistical data in the cloud server is automatically counted by the cloud server after the simulation scene is operated, so that the statistical data does not need to be preset in advance;
3. expected data is known when the test case is designed; for example, when testing the function of a calculator, designing a certain test case is as follows: 50+50, expected equals 100, the expected data is known.
In addition, the design of a plurality of simulation test scenes can be completed by repeating the steps 201 to 204, and all scene designs under grouping can be completed by repeating the steps 102 to 204.
The process of the method will be described here in terms of a simulated scenario test that activates the ranking function:
1) creating a group named "activation ranking";
2) clicking an activated ranking group, clicking to create a simulation test scene named smoking test, and then clicking the smoking test scene to start design;
3) selecting Hisense _1 items of Hisense clients from the client and item information tabs acquired by the cloud server, setting and simulating 1000 televisions, generating Hisense _1 simulation machine graphs, generating 800 Hisense _2 simulation machine graphs and 500 Hisense _3 simulation machine graphs in the same way;
4) adding a date track of No. 8 month No. 2020;
5) dragging the Hisense _1 simulator graph, the Hisense _2 simulator graph and the Hisense _3 simulator graph into a date track of 8 months and 8 # respectively;
6) clicking Hisensen _1 simulator graph in the date track, and setting simulation data: selecting a cloud server interface address as a website of a television activation function, and selecting a simulated address as Shanghai; similarly, setting simulation data of the Hisense _2 simulator graph and the Hisense _3 simulator graph in the track;
7) clicking and saving a smoking test scene, wherein the saved smoking test scene can automatically generate an executable script;
8) clicking the script to run a smoking test scene;
9) and checking the scene operation progress and the result, and comparing whether the activated ranking data in the cloud server is consistent with the expected data after the scene operation is successful, so as to finally obtain a test result.
The method has the advantages that the simulation test scenes of the current Web page are clearly seen in the grouping management simulation test scenes of the Web page, the scenes needing to be maintained and used can be conveniently selected by the motor during scene maintenance and use, and the operable scripts can be automatically generated according to the graphic scenes, so that testers do not need to manually write script codes, the efficiency is improved, meanwhile, the code writing errors are reduced, the programming requirements on the testers are reduced, and the method is favorable for popularization and application.
Example two
In a preferred embodiment of the present invention, a testing apparatus for generating a simulation test scenario based on a Web page visual drag is provided, which includes:
the new building module is used for building and storing a simulation test scene in the Web page;
the design module is used for automatically acquiring data of the cloud server according to the stored simulation test scene and carrying out scene design according to the cloud service data;
and the operation module is used for selecting a scene in the Web page to operate and obtaining a test result.
Further, the newly-built module comprises:
the grouping unit is used for creating the grouping of the functional modules according to the test requirement;
and the storage unit is used for creating and storing the simulated scene and setting the basic information of the scene under the grouping of the created functional modules.
The design module includes:
the establishing unit is used for connecting the cloud server;
the acquisition unit is used for automatically acquiring data of the cloud server and displaying the data in a webpage for selection in a card form;
the simulation machine graphic creating unit is used for selecting specific items and quantities corresponding to the real television according to the data obtained from the cloud server and automatically creating simulation machine graphics;
the adding unit is used for adding a date track according to the test requirement;
and the setting unit is used for dragging the graph of the simulator to the date track, setting data to be sent in a simulated mode, finishing scene design and storing the scene.
The operation module comprises:
the script unit is used for automatically generating an executable script according to the simulation machine graph in the saved scene;
and the test unit is used for clicking the operation script and comparing the statistical data with an expected result in the cloud server to obtain a final test result.
The apparatus of this embodiment is used to implement the method of the first embodiment, and the implementation process is the same as that of the first embodiment, which will not be described herein again.
EXAMPLE III
The third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program that is stored in the memory and can be executed on the processor, and when the processor executes the computer program, the computer device implements any one of the methods described above.
The computer device of this embodiment includes: a processor, a memory, and a computer program, such as a test program, stored in the memory and executable on the processor. The processor implements the steps in the above-described respective data synchronization method embodiments when executing the computer program. Alternatively, the processor implements the functions of the modules/units in the above device embodiments when executing the computer program.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory and executed by the processor to implement the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program in the computer device.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer device may include, but is not limited to, a processor, a memory.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device. Further, the memory may also include both an internal storage unit and an external storage device of the computer device. The memory is used for storing the computer program and other programs and data required by the computer device. The memory may also be used to temporarily store data that has been output or is to be output.
In another preferred embodiment of the present invention, a computer-readable storage medium storing a computer program is characterized in that the computer program is configured to enable a computer to implement a test method for generating a simulation test scenario based on a Web page visual drag when the computer executes the test method.
The foregoing detailed description of the preferred embodiments of the invention has been presented. It should be understood that numerous modifications and variations could be devised by those skilled in the art in light of the present teachings without departing from the inventive concepts. Therefore, the technical solutions available to those skilled in the art through logic analysis, reasoning and limited experiments based on the prior art according to the concept of the present invention should be within the scope of protection defined by the claims.