Disclosure of Invention
In order to solve the problems in the prior art, the invention provides an automated testing method and system for an Internet of things information product based on a cloud architecture.
The invention provides a cloud architecture-based automatic testing method for an Internet of things information product, which comprises the following steps of:
s1, selecting and loading a test technology;
s2, configuring a test instrument;
s3, loading a test case;
s4, loading and analyzing the operation block;
s5, loading and analyzing a test instrument and a test instruction list;
s6, executing an instruction sequence of each test block according to the sequence of the test blocks;
s7, ending the test.
As a further improvement of the present invention, in step S2, the meter used for the test is configured, and the configuration information includes the device type, the device name and the device connection manner, and the device address information.
As a further improvement of the invention, in step S3, when the test technology is initialized, a test case script is loaded, a test case script file is analyzed, and a test case object is dynamically generated according to the test case name.
As a further improvement of the present invention, in step S4, the operation block loaded and parsed includes:
an operation block 1, initializing a comprehensive tester;
an operation block 2, initializing a spectrum analyzer;
an operation block 3, setting a port of the comprehensive tester;
an operation block 4 for setting the output frequency of the comprehensive tester;
an operation block 5 for setting the center frequency of the spectrometer;
an operation block 6, setting a Mark mode;
an operation block 7 for setting a sweep width and an analysis bandwidth;
an operation block 8 for reading the analysis bandwidth of the spectrometer;
an operation block 9 for reading the analyzer differential power;
an operation block 10 for reading total power of the analyzer;
an operation block 11 reads the analyzer center frequency power.
As a further improvement of the present invention, in step S5, device information is defined, including device name, model number and connection mode, defining instructions and parameter list.
As a further improvement of the present invention, in step S6, the test case executes the test instructions contained in the test blocks one by one according to the device information of the UI configuration in the order of the test blocks.
As a further improvement of the invention, in step S1, when the test technology is loaded, the test case script file corresponding to the test technology stored on the disk is read, the test case set is dynamically generated according to the test case node name attribute defined by the script, and meanwhile, in the test process, the test case is scheduled and managed through the test technology layer.
As a further improvement of the invention, the test case script file defines test case numbers, test case names and theoretical duration, each test case defines a series of functional blocks according to the test sequence, which are called test blocks, and when the test cases are loaded, each test block script is analyzed to form test logic.
As a further refinement of the present invention, the key attributes include test block names and remark information, each test block defining all test equipment supporting the present test technique and instructions and instruction parameters supported by the test equipment.
The invention also provides an automated testing system for the internet of things information product based on the cloud architecture, which comprises a readable storage medium, wherein the readable storage medium stores execution instructions, and the execution instructions are used for realizing the method according to any one of the above when being executed by a processor.
The beneficial effects of the invention are as follows: through the scheme, the testing efficiency of the Internet of things information product is improved, and the testing cost is reduced.
Detailed Description
The invention is further described with reference to the following description of the drawings and detailed description.
The automatic test method for the Internet of things information product based on the cloud architecture is characterized in that a test process is scripted, an XML language is a structured description language, various data can be effectively expressed, a new carrier is provided for information exchange, storage and calculation, the XML language is a text language, the reading is easy, meanwhile, a tree structure is adopted for organizing and storing the data, the expression capability is rich, and meanwhile, the XML language has a unified grammar format verification rule, and the reliability and the usability of the data are improved.
The system creatively summarizes and summarizes the test process, organizes the test process by using XML language in the form of script, abstracts the test case into a series of test blocks, each test block corresponds to a set of functional actions, writes instrument instructions and instruction parameter scripts according to instruments supported by the system in the test blocks, defines and describes the instrument instructions and parameters in the scripts, and realizes the association between the scripts and actual instruments as well as the operation of the instruments. By changing the script, a new test measurement process can be realized, and the quick realization capability of the test case is provided.
FIG. 1 is a hierarchical relationship diagram of a scripted organization test procedure, and the test procedure, the description and the association of instructions and parameters are realized through XML language, so that the scripted of the test case is realized.
As shown in fig. 1, the uppermost layer is a test technology layer, and the automatic test system realizes different test technology modules, such as a Wi-Fi radio frequency test technology module and a Wi-Fi interoperation technology module, according to different test technology fields or test standards. Each test technology module exists independently in the form of a plug-in. During testing, the corresponding test technology module is automatically loaded according to the selection of the test technology by the test engineer. When the test technology is loaded, a test case script file corresponding to the test technology stored on a disk is read, and a test case set is dynamically generated according to attributes such as a test case node name defined by a script. Meanwhile, in the test process, the test technology layer schedules and manages the test cases.
As shown in FIG. 1, the second layer is a test Case layer, and a design test Case label pair < Case > </Case > defines key attributes such as a test Case number, a test Case name, a theoretical duration and the like. The test technology module loads the test case script and parses the script. The test case layer defines a series of functional blocks according to test sequences, which we call test blocks, according to test specification requirements. When the test case is loaded, analyzing each test block script to form test logic.
As shown in fig. 1, the third layer is a test block layer, and the test block node is a child node of the test Case node < Case > node. The testing process of each test case is divided into different functional blocks according to functions, each functional Block is called a test Block, the test blocks have unified naming rules, and a < Block > </Block > tag pair is designed, and key attributes comprise test Block names and remark information and are used for unified identification of upper-layer applications. Each test block defines all test equipment supporting the present test technique and the instructions and instruction parameters supported by that equipment.
As shown in fig. 1, the fourth layer is the device and instruction parameter layer. The XML node of the layer is defined as a < Device > </Device > tag pair, which is a child node of the test Block < Block > node. The layer defines the attributes of the equipment, such as equipment type, equipment model, equipment name, connection mode and the like; meanwhile, the layer also defines an operation instruction list and corresponding instruction parameters of the equipment in the test block.
As shown in fig. 1, the test case layer dynamically generates a device driving object of the device according to the device general parameter information, such as a connection mode, provided by the device and instruction parameter layer, and the device address configuration information provided by the UI application layer, so as to write a test instruction of the device and read a test result.
Taking the test example of the WiFi radio frequency test technology, namely radio frequency signal sideband noise, as an example, the whole test application steps and processes are described in a table mode:
step 1, selecting and loading a test technology, wherein the test system loads a WiFi radio frequency test technology according to the selection of a test engineer;
step 2, configuring a test instrument, wherein the configuration information comprises information such as equipment type, equipment name, equipment connection mode, equipment address and the like, and after the configuration is completed, relevant information in a corresponding instrument script is updated;
step 3, loading test cases, loading test case scripts, analyzing test case script files, dynamically generating test case objects according to test case names, managing a dynamically generated test case set by a test technology module, and scheduling the test cases in the test process;
step 4, loading and analyzing the operation block;
operation block 1: initializing comprehensive tester, node < InitSU >
Operation block 2: initializing spectrum analyzer, node < InitSA >
Operation block 3: setting a comprehensive tester port, wherein the node is SetSuPort
Operation block 4: setting the output frequency of the comprehensive tester, and setting a node < SetSUOutputFreq >
Operation block 5: setting the center frequency of a spectrometer and a node < SetSACENTERFreq ]
Operation block 6: setting Mark mode, node < setMarkMode >
Operation block 7: setting sweep and analysis Bandwidth, node < SetSaSpand RBW ]
Operation block 8: reading the analysis bandwidth of the spectrometer, node < ReadRBW >
Operation block 9: reading analyzer differential power, node < ReadDeltaPower >
Operation block 10: reading total power of analyzer, node < ReadSAPower >
Operation block 11: reading the central frequency power of the analyzer, and a node < ReadSaPowerByFreq >;
analyzing the test blocks according to the test block script, wherein the test blocks are totally defined into 11 test blocks as shown in the left column, and the test blocks are executed in sequence to form the whole test process of the test case; the cloud platform dynamically generates a test process control code according to the test block script;
step 5, loading and analyzing the test instrument and the test instruction list;
in each test block, defining equipment supported by the test block and a list of instructions and parameters for the equipment to realize the control block function; taking the operation block 1 "initialize comprehensive tester" as an example, the device information and instruction list of the R & S CWM500 comprehensive tester are defined:
(1) Device information is defined, including device names: a comprehensive tester; model: CWM500; the connection mode is as follows: VISA;
(2) Defining a list of instructions and parameters;
instruction 1: resetting the equipment;
instruction 2: switching display modes, parameters: a display mode;
instruction 3: setting a signaling mode and parameters: a signaling mode;
program analysis test equipment general information parameters and instruction sequences of the instrument in the test block, wherein the instruction sequences comprise parameters;
using the equipment general information, the test case dynamically generates an equipment driving object through an equipment factory object;
step 6, the test case executes the test instructions contained in the test blocks one by one according to the equipment information (equipment type, equipment name and equipment address) configured by the UI according to the sequence of the test blocks; the method comprises the steps of calling a writing instruction, reading result data and the like of the equipment driving object by using the equipment driving object generated in the steps, and transmitting the instruction and instruction parameters in the test block into the method as parameters to realize business operation of equipment;
realizing test service operation of equipment, including read-write instruction and test result data;
and 7, ending the test, and finishing the execution of the test case.
According to the cloud architecture-based automatic testing method and system for the Internet of things information product, the cloud platform adopts the XML script form to define the test cases and the test elements of all layers, in the testing process, the system program is not required to be modified, the measuring process can be controlled to be changed only by modifying the script, the test instruction and the instruction parameter are replaced, and the application flexibility and the testing efficiency of a test engineer are greatly improved.
According to the cloud architecture-based automatic test method and system for the Internet of things information product, the scripting of the business control process is realized through the definition of the script elements of the hierarchical tree form, the test measurement process can be dynamically controlled without modifying the platform program by changing the script, the change can be quickly adapted to the instruction difference among different small versions of certain test equipment through the modification of the script, the flexibility of the measurement control process is greatly improved, the on-site test engineer can conveniently adjust and test the system, and the adaptability of the test measurement system is improved. Meanwhile, the independently developed instrument driving library is independent of equipment driving provided by equipment manufacturers, has strong flexibility and can meet all operations required by various specific tests.
The foregoing is a further detailed description of the invention in connection with the preferred embodiments, and it is not intended that the invention be limited to the specific embodiments described. It will be apparent to those skilled in the art that several simple deductions or substitutions may be made without departing from the spirit of the invention, and these should be considered to be within the scope of the invention.