Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a cloud architecture-based automatic testing method and system for an internet of things information product.
The invention provides an automatic testing method of an internet of things information product based on a cloud architecture, which realizes the following steps through an XML language:
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 the test instrument and the test instruction list;
s6, executing the instruction sequence of each test block according to the sequence of the test blocks;
and S7, ending the test.
As a further improvement of the present invention, in step S2, the meter used in the test is configured, and the configuration information includes the device type, the device name and the device connection mode, and the device address information.
As a further improvement of the present invention, in step S3, when the test technology is initialized, the test case script is loaded, the test case script file is parsed, and the 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;
anoperation block 4, setting the output frequency of the comprehensive tester;
an operation block 5, setting the center frequency of the frequency spectrograph;
an operation block 6, setting a Mark mode;
operation block 7, setting sweep width and analyzing bandwidth;
an operation block 8, reading the analysis bandwidth of the frequency spectrograph;
an operation block 9 for reading the differential power of the analyzer;
an operation block 10 for reading the total power of the analyzer;
and operating the block 11, and reading the center frequency power of the analyzer.
As a further improvement of the present invention, in step S5, device information including a device name, a model, and a connection method, a definition instruction, and a parameter list are defined.
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 in the order of the test blocks according to the device information of the UI configuration.
As a further improvement of the present invention, in step S1, when a 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 a test case node name attribute defined by the script, and meanwhile, in the test process, the test cases are scheduled and managed through a test technology layer.
As a further improvement of the invention, the test case script file defines the test case number, the test case name and the theoretical duration, each test case defines a series of function blocks called test blocks according to the test sequence, and each test block script is analyzed to form test logic when the test case is loaded.
As a further improvement of the invention, the key attributes comprise test block names and remark information, and each test block defines all test equipment supporting the test technology and instructions and instruction parameters supported by the test equipment.
The invention also provides an automatic test system for the internet of things information product based on the cloud architecture, which comprises a readable storage medium, wherein execution instructions are stored in the readable storage medium, and when being executed by a processor, the execution instructions are used for realizing the method in any one of the above.
The invention has the beneficial effects that: by 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 and embodiments in conjunction with the accompanying drawings.
A test process is designed in a scripted mode, an XML language is a structural description language and can effectively express various data, a new carrier is provided for information exchange, storage and calculation, the XML language is a text language and is easy to read, meanwhile, data are organized and stored in a tree structure, the expression capacity is rich, meanwhile, the XML language has a uniform grammar format verification rule, and reliability and usability of the data are improved.
The system creatively summarizes and summarizes the test process, organizes the test process by using an XML language through a script form, abstracts a test case into a series of test blocks, each test block corresponds to a set of functional actions, compiles a script of instrument instructions and instruction parameters according to the instrument supported by the system in the test blocks, defines and describes the instrument instructions and parameters in the script, and realizes the association of the script with the actual instrument and the instrument operation. By changing the script, a new test measurement process can be realized, and the rapid realization capability of the test case is provided.
FIG. 1 is a hierarchical relationship diagram of a scripted organization test process, which realizes the test process, instruction, parameter description and association through XML language, and realizes the scripted test case.
As shown in fig. 1, the top layer is a testing technology layer, and the automatic testing system respectively implements different testing technology modules, such as a Wi-Fi radio frequency testing technology module and a Wi-Fi interoperability technology module, according to different testing technology fields or testing standards. Each test technology module exists independently in a plug-in manner. During testing, the corresponding test technology module is automatically loaded according to the selection of the test engineer on the test technology. When the test technology is loaded, the test case script file corresponding to the test technology stored on the disk is read, and a test case set is dynamically generated according to attributes such as test case node names defined by the script. Meanwhile, in the testing process, the testing technical layer schedules and manages the testing cases.
As shown in fig. 1, the second layer is a test Case layer, and the design test Case tag pair < Case > </Case > defines key attributes such as test Case number, test Case name, 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 function blocks, which are called test blocks, according to the test specification requirements in sequence. When the test case is loaded, each test block script is analyzed to form test logic.
As shown in FIG. 1, the third level is the test block level, and the test block nodes are children of the testcase node < Case > node. The testing process of each testing example is divided into different functional blocks according to functions, each functional Block is called a testing Block, the testing blocks have a uniform naming rule, a < Block > </Block > tag pair is designed, and key attributes comprise testing Block names and remark information and are used for uniform identification of upper-layer applications. Each test block defines all test devices that support the present test technique and the instructions and instruction parameters that the device supports.
As shown in fig. 1, the fourth layer is the device and command parameter layer. The XML node of this 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 device in the test block.
As shown in fig. 1, the test case layer dynamically generates a device driver object of the device according to device general parameter information provided by the device and command parameter layer, such as a connection mode, and device address configuration information provided by the UI application layer, and writes a test command of the device and reads a test result.
The following describes the whole test application steps and process in a table manner by taking a test example of the WiFi radio frequency test technology, namely "radio frequency signal sideband noise", as an example:
step 1, selecting and loading a testing technology, wherein a testing system loads a WiFi radio frequency testing technology according to the selection of a testing engineer;
step 2, configuring a test instrument, configuring the instrument used in the test, wherein configuration information comprises information such as equipment type, equipment name, equipment connection mode, equipment address and the like, and after configuration is finished, relevant information in a corresponding instrument script can be updated;
step 3, loading a test case script when a test technology is initialized, analyzing the test case script file, dynamically generating a test case object according to the name of the test case, managing a dynamically generated test case set by a test technology module, and scheduling the test case in the test process;
step 4, loading and analyzing the operation block;
operation block 1: initialize the comprehensive tester, node < InitSU >
Operation block 2: initializing the Spectrum Analyzer, node < InitSA >
Operation block 3: setting a port of the comprehensive tester, node < SetSuPort >
Operation block 4: setting the output frequency of the comprehensive tester, node < SetSuOutputFreq >
Operation block 5: set spectrometer center frequency, node < SetSACenterFreq >
Operation block 6: set Mark mode, node < SetMarkMode >
Operation block 7: setting sweep and analyze Bandwidth, node < SetSaSpanAndRBW >
Operation block 8: reading spectrometer analysis Bandwidth node < ReadRBW >
Operation block 9: reading Analyzer differential Power, node < ReadDeltaPower >
Operation block 10: reading the total power of the analyzer, node < ReadSAPower >
Operation block 11: reading the power of the central frequency of the analyzer, node < ReadSaPowerByFreq >;
analyzing the test blocks according to the test block script, wherein as shown in a left column, the test case defines 11 test blocks in total, 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 the devices supported by the test block and the instruction and parameter list of the device for realizing the function of the control block; here, taking the operation block 1 "initialize comprehensive tester" as an example, the device information and instruction list of the CWM500 comprehensive tester of R & S is defined:
(1) device information is defined, including the device name: a comprehensive measuring instrument; the model is as follows: a CWM 500; the connection mode is as follows: VISA;
(2) defining a list of instructions and parameters;
instruction 1: resetting the equipment;
instruction 2: switching display mode, parameters: a display mode;
instruction 3: setting a signaling mode, and parameters: a signaling mode;
analyzing general information parameters of the test equipment and the instruction sequence of the instrument in the test block by a program, wherein the instruction sequence comprises the parameters;
using the general information of the equipment, 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; calling methods such as writing instructions and reading result data of the equipment driving object by using the equipment driving object generated in the step, and transmitting instructions and instruction parameters in the test block into the method as parameters to realize service operation on the equipment;
realizing test service operation on equipment, including reading and writing instructions and test result data;
and 7, finishing the test and finishing the execution of the test case.
According to the automatic testing method and system for the Internet of things information product based on the cloud architecture, the cloud platform adopts the form of the XML script, the testing examples and all layers of testing elements are defined, in the debugging and testing process, the system program is not required to be modified, the testing process can be controlled and changed only by modifying the script, the testing instructions and the instruction parameters are replaced, and the application flexibility and the debugging and testing efficiency of a testing engineer are greatly improved.
According to the automatic testing method and system for the internet of things information product based on the cloud architecture, the scripting of the service control process is realized through the definition of the hierarchical tree-shaped script elements, the testing and measuring process can be dynamically controlled without modifying a platform program through changing the script, the change can be quickly adapted to the command difference between different small versions of certain testing equipment through modifying the script, the flexibility of the measuring and controlling process is greatly improved, a field testing engineer can conveniently debug the system, and the adaptability of the testing and measuring system is improved. Meanwhile, the independently developed instrument driving library does not depend on equipment driving provided by equipment manufacturers, has strong flexibility and can meet all operations required by various specific tests.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.