CN109254925B - Test data frame generation method and device and software test method and device - Google Patents
Test data frame generation method and device and software test method and device Download PDFInfo
- Publication number
- CN109254925B CN109254925B CN201811501874.XA CN201811501874A CN109254925B CN 109254925 B CN109254925 B CN 109254925B CN 201811501874 A CN201811501874 A CN 201811501874A CN 109254925 B CN109254925 B CN 109254925B
- Authority
- CN
- China
- Prior art keywords
- test
- function
- data frame
- data
- tested
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
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)
- Data Exchanges In Wide-Area Networks (AREA)
- Maintenance And Management Of Digital Transmission (AREA)
Abstract
The invention provides a test data frame generation method, which comprises the following steps: analyzing a specification of a system to obtain all functions to be realized by the system, wherein the system comprises a plurality of devices, each function of the system corresponds to the device for realizing the function, and for a certain function of the system, the device for realizing the function is set as a tested device, and the other devices are set as testing tools to obtain an interactive function scene between each device and other devices; according to the equivalent division of each function scene, acquiring a normal data frame and an abnormal data frame corresponding to each function, wherein each data frame is a test case; and packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file. The invention adopts a mode of separating the test data from the test device, only needs to modify the test data document during the regression test, does not need to modify the test device, and uses the software test device to replace all test tools, thereby simplifying the test environment and the test steps, reducing the test time consumption and the error rate and improving the test efficiency.
Description
Technical Field
The invention belongs to the technical field of software testing, and particularly relates to a test data frame generation method and device and a software testing method and device.
Background
In the prior art, functions of a system need to be realized by matching multiple devices, and testing of data frames among the devices needs to test each device with a data communication control function in the system, and whether the device under test receiving the data frames has a certain function is verified by observing the reaction of the device under test. Testing requires traversing all normal and abnormal data frame classes that the device under test can handle. Regression testing requires repeating the above tests again. The problems lead to long test time, high error rate and low efficiency. In order to test the processing capability of data frames in all functions of each device of a system, the existing test means uses part of devices in the system as tools, and configures parameters of the tools and devices to trigger certain functions according to function division, thereby completing verification of all functions of the tested devices. It is generally necessary to transmit a data frame to each device having a data communication control function, observe the device under test log and conditions, and test and verify the response of the device under test to the data frame. The test block diagram refers to fig. 1. And then, the function verification of the correct frame and the abnormal frame is completed by modifying the parameters of each connection tool device. If the system function or the process is modified, a regression test is required, and all the operations are required to be repeated during the regression test.
In the testing process, if the types of the devices in the system are multiple, the networking for testing is relatively complex, and the current networking environment for testing refers to fig. 2. For example, the system has n (n ═ 10) devices, and for the test, if there is interaction between each device, there is C (n,2), for example, when n ═ 10, there are 45 connected data frame processing cases. In terms of test coverage comprehensiveness, every point-to-point communication must be tested. When the device functions are many, the device parameters of the configuration tool become more, the triggering of some process functions has dependent conditions, and the configuration a needs to be modified, the function A needs to be operated, the configuration B needs to be modified, and the function B needs to be operated. The whole process is complicated. The simultaneous observation of the logs and the conditions of the device under test also requires a great deal of effort for the tester and is very easy to make mistakes. After the version is iteratively upgraded, the testing work becomes more painful each time the regression test is performed.
Disclosure of Invention
The invention aims to provide a test data frame generation method and device and a software test method and device, and solves the problems of long test time consumption, high error rate and low efficiency.
The technical solution for realizing the purpose of the invention is as follows:
the invention provides a test data frame generation method, which comprises the following steps:
step a: analyzing a specification of a system to obtain all functions to be realized by the system, wherein the system comprises a plurality of devices, each function of the system corresponds to the device for realizing the function, and for a certain function of the system, the device for realizing the function is set as a tested device, and the other devices are set as testing tools to obtain an interactive function scene between each device and other devices;
step b: according to the equivalent division of each function scene, acquiring a normal data frame and an abnormal data frame corresponding to each function, wherein each data frame is a test case;
step c: and packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file.
Further, in the test data frame generation method of the present invention, the test data frame file is in an xml, json, or csv format.
Further, in the test data frame generation method of the present invention, the test data frame file includes a test case number, a simulated device identifier, and an implemented function number.
Second, the present invention provides a test data frame generating apparatus, including:
the analysis module is used for analyzing a specification of the system, obtaining all functions to be realized by the system, corresponding each function of the system to equipment for realizing the function, setting the equipment for realizing the function as the tested equipment and the other equipment as testing tools for a certain function of the system, and obtaining an interactive function scene between each equipment and other equipment;
the dividing module is used for acquiring normal data frames and abnormal data frames corresponding to each function according to the equivalent division of each function scene, wherein each data frame is a test case;
and the generating module is used for packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file.
Further, in the test data frame generation device of the present invention, the test data frame file is in an xml, json, or csv format.
Further, in the test data frame generating device of the present invention, the test data frame file includes a test case number, a simulated device identifier, and an implemented function number.
Thirdly, the invention provides a software testing method based on self-defined data frame communication, which comprises the following steps:
step A: installing a software testing device into tool equipment of a system, well assembling a testing system network, and inputting a testing starting instruction to the testing device by a tester to start testing;
and B: opening and reading a pre-generated test data frame file according to the test opening instruction and the attribute of the tested equipment;
and C: automatically sending test data frames to corresponding tested equipment according to the system function number sequence; or selecting the required functional test items according to the current test requirements, not selecting the unnecessary functional test items, and sending a test data frame to the tested equipment by the system according to the selected functional test items;
step D: receiving response data returned by the tested device, comparing the returned response data with expected return data through assertion setting, if the response data is consistent with the expected return data, indicating that the test case passes, otherwise, indicating that the test case does not pass;
step E: analyzing the test result again, taking the passed test cases in the system as one type, taking the failed test cases as another type, and listing the tested devices, the unrealized functions and the corresponding test data frames of the failed test cases as the system function defects;
step F: and summarizing the test result and the system function defect, and outputting the test result and the system function defect to a tester.
Furthermore, the software testing device is connected with the tested equipment of the system through the network communication equipment, and the physical connection form is a serial port, a network port or an optical fiber.
Fourth, the invention provides a software testing device based on custom data frame communication, comprising:
the read data frame unit is used for receiving a test starting instruction, and opening and reading a test data frame file generated in advance;
the data frame sending unit is used for automatically sending test data frames to the corresponding tested equipment according to the system function number sequence or sending the test data frames to the tested equipment according to the selected function test items, wherein the selected function test items are selected according to the current test requirements;
the analysis return response unit is used for receiving response data returned by the tested equipment, comparing the returned response data with expected return data through assertion setting, if the response data is consistent with the expected return data, the test case is passed, otherwise, the test case is not passed;
the analysis and statistics unit is used for analyzing the test result, taking the passed test cases as one type and the failed test cases as another type, and listing the tested devices, the unrealized functions and the corresponding test data frames of the failed test cases as system function defects;
and the output report unit is used for summarizing the test result and the system function defect and outputting the test result and the system function defect to a tester.
Furthermore, the software testing device based on the custom data frame communication of the invention is characterized in that the data frame sending unit and the analysis return response unit are connected with the tested equipment of the system through network communication equipment, and the physical connection form is a serial port, a network port or an optical fiber.
Compared with the prior art, the invention adopting the technical scheme has the following beneficial effects:
1. the scheme of the invention adopts a mode of separating the test data from the test device, and only the test data document needs to be modified when the regression test or the automatic test causes the change, and the test device does not need to be modified.
2. The scheme of the invention reduces the time consumption and the error rate of the test and improves the test efficiency.
3. The scheme of the invention uses the software testing device to replace all testing tools, and simulates the configuration parameters of the testing tools to send the testing data frames, thereby greatly simplifying the testing environment and the testing steps.
Drawings
FIG. 1 is a test block diagram of a prior art test system;
FIG. 2 is a test environment of a prior art test system;
FIG. 3 is a flow chart diagram of a test data frame generation method of the present invention;
FIG. 4 is a schematic structural diagram of a test data frame generating apparatus according to the present invention;
FIG. 5 is a schematic flow chart of a software testing method of the present invention;
FIG. 6 is a schematic structural diagram of a software testing apparatus according to the present invention;
FIG. 7 is a test environment for the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
Example 1
The embodiment provides a method for generating a test data frame, as shown in fig. 3, including:
step a: analyzing a specification of the system to obtain all functions to be realized by the system, wherein the system comprises a plurality of devices, each function of the system corresponds to the device for realizing the function, and for a certain function of the system, the device for realizing the function is set as a tested device, and the other devices are set as testing tools, so that an interactive function scene between each device and other devices is obtained.
In specific implementation, firstly, according to a requirement specification and a detailed design specification of a system or a product, which functions are mainly implemented by the system are analyzed, which devices operate interactively, and finally which device implements the functions, the device implementing the functions is used as a device to be tested, and other devices are used as testing tools to analyze which data frames need to be relied on by the device to be tested to send control information to implement the functions.
Step b: and acquiring normal data frames and abnormal data frames corresponding to each function according to the equivalent division of each function scene, wherein each data frame is a test case.
In the specific implementation, the data frames are divided according to the equivalence class of the black box test to analyze which normal data frames are needed for functional implementation, which data frames are needed for functional failure, which data frames are needed for abnormal processing, and each data frame is used as a test case.
Step c: and packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file.
In specific implementation, the data frames are all placed in a file, which can be in xml, json or csv format, and the test data frame file includes test case number, simulated equipment identifier and implemented function number, and these formats and contents are convenient for analysis.
Example 2
The present embodiment provides a test data frame generating apparatus, as shown in fig. 4, including:
the analysis module is used for analyzing a specification of the system, obtaining all functions to be realized by the system, corresponding each function of the system to equipment for realizing the function, setting the equipment for realizing the function as the tested equipment and the other equipment as testing tools for a certain function of the system, and obtaining an interactive function scene between each equipment and other equipment;
the dividing module is used for acquiring normal data frames and abnormal data frames corresponding to each function according to the equivalent division of each function scene, wherein each data frame is a test case;
and the generating module is used for packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file.
In specific implementation, the generating module puts the generated test data frames in a file, which can be in xml, json or csv format, and the like, and the test data frame file includes test case number, simulated equipment identifier and implemented function number, and the format and the content are convenient for analysis.
Example 3
The embodiment provides a software testing method based on custom data frame communication, as shown in fig. 5, including:
step A: the software testing device is installed in tool equipment of the system, a testing system network is assembled, and a tester inputs a testing starting instruction to the testing device to start testing.
And B: and opening and reading a pre-generated test data frame file according to the test opening instruction and the attribute of the tested equipment.
And C: automatically sending test data frames to corresponding tested equipment according to the system function number sequence; or selecting the required functional test items according to the current test requirements, not selecting the unnecessary functional test items, and sending the test data frame to the tested device by the system according to the selected functional test items.
In specific implementation, the data can be automatically sent according to function number sequencing, and the data can also be designed into a graphical interface, so that testers can manually select which functions to test.
Step D: and receiving response data returned by the tested device, comparing the returned response data with expected return data through assertion setting, if the response data is consistent with the expected return data, indicating that the test case passes, namely indicating that the correctness of the corresponding function is not problematic, otherwise, indicating that the test case does not pass, namely that the corresponding function is not reasonably realized.
Step E: and analyzing the test result again, taking the passed test cases in the system as one type, taking the failed test cases as another type, and listing the tested devices, the unrealized functions and the corresponding test data frames of the failed test cases as system function defects.
In a specific implementation, it is not indicated by the need which device under test does not perform the function, and which data frame response does not meet the expectation.
Step F: and summarizing the test result and the system function defect, and outputting the test result and the system function defect to a tester so as to judge the global function of the system.
The test environment is simplified as shown in fig. 7, a software testing device is used in the test process to replace all tool devices in fig. 1, as long as the software testing device simulates and sends corresponding test data frames, and the whole test flow refers to fig. 3.
Example 4
The present embodiment provides a software testing apparatus based on custom data frame communication, as shown in fig. 6, including:
the read data frame unit is used for receiving a test starting instruction, and opening and reading a test data frame file generated in advance;
the data frame sending unit is used for automatically sending test data frames to the corresponding tested equipment according to the system function number sequence or sending the test data frames to the tested equipment according to the selected function test items, wherein the selected function test items are selected according to the current test requirements;
the analysis return response unit is used for receiving response data returned by the tested equipment, comparing the returned response data with expected return data through assertion setting, if the response data is consistent with the expected return data, the test case is passed, otherwise, the test case is not passed;
the analysis and statistics unit is used for analyzing the test result, taking the passed test cases as one type and the failed test cases as another type, and listing the tested devices, the unrealized functions and the corresponding test data frames of the failed test cases as system function defects;
and the output report unit is used for summarizing the test result and the system function defect and outputting the test result and the system function defect to a tester. Whether the function of the system is complete and correct can be evaluated according to the report and the actual delivery requirement of the system.
The software testing device is installed on a computer and is connected with the tested equipment through the computer, the physical connection mode is a serial port, a network port, an optical fiber or other communication modes, and data inlets and outlets of all the tested equipment can be gathered through network communication equipment (such as a switch and a serial server).
This way of using a software test apparatus instead of all test tools greatly simplifies the test environment, as shown in fig. 7.
The foregoing is directed to embodiments of the present invention and, more particularly, to a method and apparatus for controlling a power converter in a power converter, including a power converter, a display and a display panel.
Claims (9)
1. A method for generating a test data frame, comprising:
step a: analyzing a specification of a system to obtain all functions to be realized by the system, wherein the system comprises a plurality of devices, each function of the system corresponds to the device for realizing the function, for a certain function of the system, the device for realizing the function is set as a tested device, and the other devices are test tools to obtain an interactive function scene between each device and other devices;
step b: according to the equivalent division of each function scene, acquiring a normal data frame and an abnormal data frame corresponding to each function, wherein each data frame is a test case; the data frames are divided according to the equivalence class of the black box test to analyze which normal data frames are needed for function realization, which data frames are needed for function failure, which data frames are needed for abnormal processing, and each data frame is taken as a test case;
step c: and packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file, wherein the test data frame file comprises a test case number, a simulated equipment identifier and an realized function number.
2. The method of claim 1, wherein the test data frame file is in xml, json, or csv format.
3. A test data frame generation apparatus, comprising:
the analysis module is used for analyzing a specification of the system, obtaining all functions to be realized by the system, corresponding each function of the system to equipment for realizing the function, setting the equipment for realizing the function as the tested equipment and the other equipment as testing tools for a certain function of the system, and obtaining an interactive function scene between each equipment and other equipment;
the dividing module is used for acquiring normal data frames and abnormal data frames corresponding to each function according to the equivalent division of each function scene, wherein each data frame is a test case;
and the generating module is used for packaging the data frame according to the communication protocol and the test requirement to generate a test data frame file.
4. The device of claim 3, wherein the test data frame file is in xml, json, or csv format.
5. The apparatus according to claim 3, wherein the test data frame file includes a test case number, a simulated device identifier, and an implemented function number.
6. A software testing method based on self-defined data frame communication is characterized by comprising the following steps:
step A: installing a software testing device into tool equipment of a system, well assembling a testing system network, and inputting a testing starting instruction to the testing device by a tester to start testing;
and B: opening and reading a pre-generated test data frame file according to the attribute of the tested equipment according to the test opening instruction, wherein the test data frame file comprises a test case number, a simulated equipment identifier and an realized function number; dividing the data frames in the test data frame file into normal data frames and abnormal data frames corresponding to each function according to the equivalent division of each function scene, wherein each data frame is a test case;
and C: automatically sending test data frames to corresponding tested equipment according to the system function number sequence; or selecting the required functional test items according to the current test requirements, not selecting the unnecessary functional test items, sending a test data frame to the tested equipment by the system according to the selected functional test items, and designing to automatically send data according to the functional number sequence, or designing to be a graphical interface, and manually selecting which functions to test by a tester;
step D: receiving response data returned by the tested device, comparing the returned response data with expected return data through assertion setting, if the response data is consistent with the expected return data, indicating that the test case passes, otherwise, indicating that the test case does not pass;
step E: analyzing the test result again, taking the passed test cases in the system as one type, taking the failed test cases as another type, and listing the tested devices, the unrealized functions and the corresponding test data frames of the failed test cases as the system function defects; indicating the failed test case because which tested device does not realize the function and indicating which data frame response does not meet the expectation;
step F: and summarizing the test result and the system function defect, and outputting the test result and the system function defect to a tester.
7. The software testing method based on the custom data frame communication as claimed in claim 6, wherein the software testing device is connected with the tested device of the system through the network communication device, and the physical form of the connection is a serial port, a network port or an optical fiber.
8. A software testing device based on custom data frame communication is characterized by comprising:
the reading data frame unit is used for receiving a test starting instruction, opening and reading a test data frame file generated in advance, wherein the test data frame file comprises a test case number, a simulated equipment identifier and an realized function number; dividing the data frames in the test data frame file into normal data frames and abnormal data frames corresponding to each function according to the equivalent division of each function scene, wherein each data frame is a test case;
the data frame sending unit is used for automatically sending test data frames to the corresponding tested equipment according to the system function number sequence or sending the test data frames to the tested equipment according to the selected function test items, wherein the selected function test items are selected according to the current test requirements;
the analysis return response unit is used for receiving response data returned by the tested equipment, comparing the returned response data with expected return data through assertion setting, if the response data is consistent with the expected return data, the test case is passed, otherwise, the test case is not passed;
the analysis and statistics unit is used for analyzing the test result, taking the passed test cases as one type and the failed test cases as another type, and listing the tested devices, the unrealized functions and the corresponding test data frames of the failed test cases as system function defects;
and the output report unit is used for summarizing the test result and the system function defect and outputting the test result and the system function defect to a tester.
9. The software testing device based on self-defined data frame communication of claim 8, wherein the data frame sending unit and the analysis return response unit are connected with the tested device of the system through a network communication device, and the physical form of the connection is a serial port, a network port or an optical fiber.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811501874.XA CN109254925B (en) | 2018-12-10 | 2018-12-10 | Test data frame generation method and device and software test method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811501874.XA CN109254925B (en) | 2018-12-10 | 2018-12-10 | Test data frame generation method and device and software test method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109254925A CN109254925A (en) | 2019-01-22 |
CN109254925B true CN109254925B (en) | 2021-10-26 |
Family
ID=65042642
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811501874.XA Active CN109254925B (en) | 2018-12-10 | 2018-12-10 | Test data frame generation method and device and software test method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109254925B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030126517A1 (en) * | 2001-07-27 | 2003-07-03 | Accordsqa | Automated software testing and validation system |
CN101110734A (en) * | 2007-08-24 | 2008-01-23 | 福建星网锐捷网络有限公司 | Automatization test approach and system |
CN101789889A (en) * | 2010-01-14 | 2010-07-28 | 瑞斯康达科技发展股份有限公司 | Method and system for automatic testing communication equipment |
CN103279415A (en) * | 2013-05-27 | 2013-09-04 | 哈尔滨工业大学 | Embedded software test method based on combinatorial test |
-
2018
- 2018-12-10 CN CN201811501874.XA patent/CN109254925B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030126517A1 (en) * | 2001-07-27 | 2003-07-03 | Accordsqa | Automated software testing and validation system |
CN101110734A (en) * | 2007-08-24 | 2008-01-23 | 福建星网锐捷网络有限公司 | Automatization test approach and system |
CN101789889A (en) * | 2010-01-14 | 2010-07-28 | 瑞斯康达科技发展股份有限公司 | Method and system for automatic testing communication equipment |
CN103279415A (en) * | 2013-05-27 | 2013-09-04 | 哈尔滨工业大学 | Embedded software test method based on combinatorial test |
Also Published As
Publication number | Publication date |
---|---|
CN109254925A (en) | 2019-01-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109740222B (en) | Testing device and system for automobile networking scene | |
CN110493079B (en) | Production automation test method of industrial Ethernet switch | |
EP3379520A1 (en) | Method and apparatus for testing rf performance of a satellite wiring harness and signal processing units | |
CN104483959A (en) | Fault simulation and test system | |
CN107370637B (en) | Vehicle-mounted ECU communication function automatic test system and method | |
US11405302B1 (en) | Methods, systems, and computer readable media for network testing using configurable test infrastructure | |
CN106445811A (en) | SecureCRT-based automated test system and method | |
CN107861874B (en) | Full-automatic automobile electronic equipment testing system | |
CN112339796B (en) | Detection method and device for electric locomotive control circuit and mobile terminal | |
CN111610393A (en) | Automatic test system and method for multi-channel broadband microwave integrated component | |
CN105224430A (en) | A kind of test macro and method of testing | |
CN111324502A (en) | Batch test system and method thereof | |
CN103530209B (en) | A kind of code keypad automated testing method | |
CN105786695A (en) | Data test method and system | |
CN112737886A (en) | Tool testing method and system | |
CN112631937A (en) | Automatic CAN operation testing method and device for T-Box | |
CN116107893A (en) | Heterogeneous platform embedded software test verification system and method | |
CN109141588B (en) | Automatic simulation test system for gas meter | |
CN109254925B (en) | Test data frame generation method and device and software test method and device | |
CN105808422A (en) | Network-based software test method, client and to-be-tested equipment | |
CN113495842A (en) | Automatic test system and test method for mass production of satellites | |
CN105227407B (en) | A kind of protocol debugging method, apparatus and system | |
CN205864449U (en) | Charging equipment of electric automobile communication protocol consistency test device | |
CN112099453B (en) | Function verification system of nuclear power plant safety level instrument control system | |
CN113468054A (en) | Automatic test system and method for satellite interface and function test |
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 | ||
PP01 | Preservation of patent right | ||
PP01 | Preservation of patent right |
Effective date of registration: 20220729 Granted publication date: 20211026 |