CN112506759A - Automatic testing method and device for servo system control software and storage medium - Google Patents
Automatic testing method and device for servo system control software and storage medium Download PDFInfo
- Publication number
- CN112506759A CN112506759A CN202011320815.XA CN202011320815A CN112506759A CN 112506759 A CN112506759 A CN 112506759A CN 202011320815 A CN202011320815 A CN 202011320815A CN 112506759 A CN112506759 A CN 112506759A
- Authority
- CN
- China
- Prior art keywords
- instruction
- test
- character string
- sub
- steering engine
- 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.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 378
- 238000000034 method Methods 0.000 claims abstract description 60
- 238000006243 chemical reaction Methods 0.000 claims abstract description 52
- 230000008569 process Effects 0.000 claims description 26
- 238000012545 processing Methods 0.000 claims description 19
- 230000004044 response Effects 0.000 claims description 11
- 238000007493 shaping process Methods 0.000 claims description 8
- 238000009825 accumulation Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010998 test method Methods 0.000 claims description 6
- 238000002789 length control Methods 0.000 claims description 5
- 238000013501 data transformation Methods 0.000 claims description 4
- 230000006870 function Effects 0.000 description 21
- 238000010586 diagram Methods 0.000 description 17
- 238000004364 calculation method Methods 0.000 description 5
- 238000013461 design Methods 0.000 description 5
- 230000003993 interaction Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
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
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- 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
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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)
- Combined Controls Of Internal Combustion Engines (AREA)
Abstract
The application discloses an automatic testing method and device for servo system control software and a computer readable storage medium. The method for operating on the labview platform comprises the following steps: and creating a test case generation template comprising a front panel and a plurality of sub-VIs, wherein the sub-VIs are steering engine signal conversion sub-VIs, generation check sum sub-VIs, instruction type identification sub-VIs or table generation sub-VIs. Filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling a character string connection tool of labview and each sub VI to automatically generate a test case instruction based on the instruction type; the instruction types include a regular instruction, a patrol instruction, and a splice instruction. When a test request is detected, the corresponding test case read from the test case table is automatically sent to the controller, and a test result is automatically generated according to the test data fed back by the controller and the corresponding expected result, so that the full-automatic test of the servo system control software is realized, and the test efficiency of the servo system control software is effectively improved.
Description
Technical Field
The present disclosure relates to the field of software testing technologies, and in particular, to an automated testing method and apparatus for servo system control software, and a computer-readable storage medium.
Background
The servo system is used for accurately following or reproducing a feedback control system of a certain process, and the servo system enables the output controlled quantity of the position, the direction, the state and the like of an object to follow the automatic control system of any change of an input target or a set value. In a servo system, functions of whether a steering engine can move according to a command specified action, whether an error command can be actively identified and the like are mainly controlled through control software of the steering engine, and whether a control software code can meet task requirements is important. Therefore, testing of software functions is indispensable, testing of software functions usually requires designing test cases, which roughly classify the test cases into three types according to different functions of the test: conventional instruction, inspection instruction and concatenation instruction, conventional instruction again contains: frame header error, type ID error, checksum error, instruction interference, and over-travel instruction. The designed test cases are then tested on a case-by-case basis.
In the related technology, in the process of testing software of servo system control software, a software test engineer is required to design test cases according to test functions, and then a serial assistant is used for testing one by one. Due to the fact that the test cases are various in variety, the compiling time of the test cases is long, the test process is repeatedly operated, the operation is complex, the labor consumption is increased, the efficiency is low, and in the process of compiling the test cases, calculation errors can occur, the test cases are inaccurate, and the code functions cannot be normally tested.
In view of this, how to improve the testing efficiency of the servo system control software test and effectively control the cost is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The application provides an automatic test method and device for servo system control software and a computer readable storage medium, which realize the full-automatic test of the servo system control software, improve the test efficiency of the servo system control software and effectively control the cost.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
the embodiment of the invention provides an automatic test method of servo system control software on one hand, which runs on a labview virtual instrument engineering platform, and comprises the following steps:
pre-creating a test case generation template comprising a front panel and a plurality of sub-VI;
filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling a character string connection tool and each sub VI of the labview to automatically generate a test case instruction based on the instruction type; the instruction types comprise a conventional instruction, a patrol instruction and a splicing instruction;
when a test request is detected, automatically sending the corresponding test case read from the test case table to the controller, and automatically generating a test result according to the test data fed back by the controller and the corresponding expected result;
the sub VI is a steering engine signal conversion sub VI, a generated check sum sub VI, an instruction type identification sub VI or a table generation sub VI; the steering engine signal conversion sub VI calls a labview control to convert the actual stroke number of each steering engine into a corresponding hexadecimal character string; the generated checksum sub VI calls a labview control to generate a checksum according to the character string to be calculated; and the table generator VI calls a labview control to generate a test case table according to the item to be tested.
Optionally, the front panel includes a plurality of steering engine position information input frames, and the steering engine position information is an actual stroke number of a corresponding steering engine represented in decimal; the process that the steering engine signal conversion sub VI calls the labview control to convert the actual stroke number of each steering engine into the corresponding hexadecimal character string comprises the following steps:
acquiring precision information for carrying out data transformation on an actual position, wherein the precision information is that 000-ZZZ represents 0-M degrees, and XXX-YY represents-N-0 degrees;
calling a positive and negative value judgment control to judge whether the actual stroke number of the current steering engine is a positive number or a negative number for the actual stroke number of each steering engine;
if the actual stroke number of the current steering engine is a positive number, calling a formula control to calculate l s1Obtaining an initial decimal numerical value by the aid of the/M, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; if the actual stroke number of the current steering engine is a negative number, calling a formula control to calculate XXX-l × s2Obtaining an initial decimal numerical value by the aid of the/N, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; wherein l is the actual stroke number of the current steering engine, Z, X, Y is any hexadecimal numerical value, M is the stroke corresponding to the ZZZ numerical value, N is the stroke corresponding to the XXX numerical value, XXX is ZZZ +001, s1Decimal character string, s, for ZZZ conversion2Decimal string converted for XXX-YYY.
Optionally, the process of generating the checksum by the checksum generating sub VI invoking the labview control according to the character string to be calculated includes:
converting the character string to be calculated into a byte array by utilizing the character string to byte array conversion control of the labview;
converting the byte array into a decimal array by using a forced conversion control, and converting the decimal array into unsigned double-byte shaping;
adding elements in the unsigned double-byte shaping array by using an array element addition control to obtain an element sum;
splitting the element sum into eight upper bits and eight lower bits by using a data splitting control;
and converting the split element sums into hexadecimal character strings by using the forced conversion control, and connecting the converted hexadecimal character strings according to requirements to generate a checksum.
Optionally, the process of the table generator VI calling the labview control to generate the test case table according to the to-be-tested item includes:
generating an instruction character string by using each test parameter through the character string connection tool;
calling the instruction type identifier VI to judge whether the generated instruction type is a splicing instruction type or a patrol instruction type;
if the test splicing instruction format is adopted, splitting the instruction character string into two sub-instruction character strings as a test splicing instruction; if the command string is in the patrol command format, splitting the command string into two sub-command strings, and then integrating the two sub-command strings with the command string to generate a new command string as a test patrol command; if the command is in a conventional command format, the command character string is directly output without processing;
generating an instruction array by the instruction character string or the test splicing instruction or the test patrol instruction or the conventional instruction and corresponding test conditions and expected results, and inserting the instruction array into a two-dimensional array corresponding to data to be displayed so as to display a currently generated test case instruction in the front panel;
and when a report form storage request is received, storing each test case instruction in the front panel into the test case table.
Optionally, after the currently generated test case instruction is displayed in the front panel, the method further includes:
when a request for removing the previous data is received, an array element deleting control is called to delete the last row of data in the two-dimensional array and generate a new two-dimensional array;
and when a request for clearing all data is received, initializing the two-dimensional array so as to clear all data in the two-dimensional array.
Optionally, the automatically sending the corresponding test case read from the test case table to the controller includes:
reading a storage path and each test condition of the test case table from the front panel, wherein the test condition is a sending interval condition or a power-on operation condition;
reading each test case instruction from the test case table according to the storage path call table data reading control;
if the sending interval condition is that the instructions are sent continuously, the instructions of the test cases are sequentially sent to the controller through a VISA write-in control;
if the sending interval condition is a discontinuous sending instruction, judging whether the power-on operation condition is the condition needing power-on again, if the power-on operation condition needs power-on again, displaying power-on operation reminding information to a user, and when power-on completion indicating information is received, sending a current test case instruction to the controller through the VISA writing tool; and if the power-on is not required again, when instruction sending instruction information is received, sending the current test case instruction to the controller through the VISA writing tool.
Optionally, the automatically generating a test result according to the test data fed back by the controller and the corresponding expected result includes:
reading feedback result data of each steering engine after the steering engine executes the test case instruction from the controller through a VISA reading control, and reading effective data of each piece of feedback result data according to a preset feedback format;
the test condition is that an instruction is continuously sent, if the expected result is that the steering engine does not respond and no feedback exists, the character string length control is used for judging whether the data length of the effective data of the current feedback result data is 0, if the data length is 0, the data containing the steering engine does not respond and no feedback is output, and a normal character string constant is tested; if not, outputting a character string constant containing test abnormity and steering engine feedback content;
if the expected result is a steering engine response instruction and feedback exists, determining a frame header of a current test case instruction by using a search/split character string control, and intercepting a character string with a preset instruction length from the current test case instruction by using a character string intercepting control to obtain a target character string; converting the target character string into a target byte array by utilizing a character string-to-byte array conversion control; performing algebraic sum accumulation on all elements before the last two-bit element of the target byte array, and separating an accumulated result according to high-low 8-bit data by using a digital splitting control; and if the split high-low data is consistent with the last two bit elements of the target byte array, connecting the steering engine response normal content and the steering engine feedback content with the target character string by using a connection character string tool to form a new character string for outputting.
In another aspect, an embodiment of the present invention provides an automatic testing apparatus for control software of a servo system, which runs on a labview, and includes:
the test case generation template creation module is used for creating a test case generation template comprising a front panel and a plurality of child VI; the sub VI is a steering engine signal conversion sub VI, a generated check sum sub VI, an instruction type identification sub VI or a table generation sub VI; the steering engine signal conversion sub VI calls a labview control to convert the actual stroke number of each steering engine into a corresponding hexadecimal character string; the generated checksum sub VI calls a labview control to generate a checksum according to the character string to be calculated; the table generator VI calls a labview control to generate a test case table according to the item to be tested;
the test case automatic generation module is used for filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling the character string connection tool of the labview and each sub VI to automatically generate test case instructions based on the instruction types; the instruction types comprise a conventional instruction, a patrol instruction and a splicing instruction;
and the automatic test module is used for automatically sending the corresponding test case read from the test case table to the controller when the test request is detected, and automatically generating a test result according to the test data fed back by the controller and the corresponding expected result.
The embodiment of the invention also provides an automatic testing device of the servo system control software, which comprises a processor, wherein the processor is used for realizing the steps of the automatic testing method of the servo system control software when executing the computer program stored in the memory.
Finally, an embodiment of the present invention provides a computer-readable storage medium, where an automatic test program of servo system control software is stored on the computer-readable storage medium, and when the automatic test program of the servo system control software is executed by a processor, the step of implementing the method for automatically testing the servo system control software is implemented as any one of the foregoing steps.
The technical scheme has the advantages that the test case is automatically generated according to the test requirements of the test items, the test case data is read and automatically issued to the controller for testing, the data fed back by the controller is analyzed to obtain a conclusion, and the test report is automatically generated.
In addition, the embodiment of the invention also provides a corresponding implementation device and a computer readable storage medium for the automatic test method of the servo system control software, so that the method has higher practicability, and the device and the computer readable storage medium have corresponding advantages.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the related art, the drawings required to be used in the description of the embodiments or the related art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of a front panel structure of an automated test tool implementing servo control software according to an exemplary embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating an automated testing method for servo system control software according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another method for automatically testing servo system control software according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a front panel structure of a test case generation template according to an exemplary embodiment of the present invention;
FIG. 5 is a block diagram illustrating the organization of test instruction types in accordance with one illustrative embodiment of the present invention;
FIG. 6 is a diagram illustrating a test case instruction generator according to an exemplary embodiment of the present invention;
FIG. 7 is a flow diagram illustrating another test case instruction generation process in accordance with an illustrative embodiment of the present invention;
FIG. 8 is a flowchart illustrating an automatic read test case instruction in accordance with an illustrative embodiment of the present invention;
FIG. 9 is a flowchart illustrating test result generation in accordance with an exemplary embodiment of the present invention;
FIG. 10 is a schematic diagram of a test case test front panel structure according to an exemplary embodiment of the present invention;
FIG. 11 is a schematic diagram illustrating a steering engine signal conversion routine in accordance with an exemplary embodiment of the present invention;
FIG. 12 is a signal processing diagram illustrating a table generator sub-VI in accordance with an exemplary embodiment of the present invention;
FIG. 13 is a signal processing diagram illustrating another table generator sub-VI in accordance with an exemplary embodiment of the present invention;
FIG. 14 is a diagram illustrating a test case instruction data fetch process in accordance with an illustrative embodiment of the present invention;
FIG. 15 is a diagram illustrating an instruction intercept window in accordance with an illustrative embodiment of the present invention;
FIG. 16 is a block diagram of an embodiment of an automatic testing apparatus for servo control software according to an embodiment of the present invention;
fig. 17 is a structural diagram of another embodiment of an automatic testing apparatus for servo system control software according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may include other steps or elements not expressly listed.
Having described the technical solutions of the embodiments of the present invention, various non-limiting embodiments of the present application are described in detail below.
The technical scheme provided by the application runs on a laboratory virtual instrument engineering platform labview and is applicable to all RS422/RS485 communication-based electric servo control systems, a person skilled in the art can increase or delete tests of a certain model according to actual needs, and in the actual application process, the technical scheme provided by the application can be an automatic test tool of servo system control software built on the labview, and the automatic test tool of the servo system control software has a human-computer interaction interface which can contain basic parameter setting options, test case generation options, test case test options and stop options, as shown in figure 1. The user clicks the test case generation option, and can automatically generate the test case according to the related parameters of the test item and store the test case in the specified file path; a user clicks a test case test option, automatic test can be performed on the servo system control software according to test items and test conditions, and a test result is generated; and the user clicks the stop option to stop the operation of the automatic test tool of the whole servo system control software. The method corresponding to the functions of the modules of the automatic test tool for implementing the servo system control software, as shown in the flowchart of fig. 2, can be described in the following embodiments. Referring to fig. 3, fig. 3 is a schematic flow chart of an automated testing method for servo system control software according to an embodiment of the present invention, where the embodiment of the present invention includes the following steps:
s301: and creating a test case generation template in advance.
The test case generation template of the embodiment includes a front panel and a plurality of child VIs. The front panel is equivalent to a human-computer interaction interface, and the sub-VI is equivalent to program support behind realizing a certain function of the interaction interface. For example, as shown in fig. 4, the front panel of the test case generation template may be configured to set parameters related to a test case through the front panel when the test case is generated, where the parameters to be set include test parameters, test conditions, and corresponding expected results, and the test parameters include, but are not limited to, a product model, a test name, a steering engine position signal, and a specific format of an instruction. The specific format of the instruction comprises frame header, interference before the instruction, interference after the instruction, type ID, verification generation and the like. Considering that a user uses a conventional decimal number, in order to be convenient for the user to use, information input at the position signal of the steering engine is a stroke value actually required to be taken by the steering engine, the stroke value does not need to be calculated into a corresponding 16-system character string in advance, and the conversion of the decimal number and the hexadecimal character string is realized by calling a steering engine signal conversion sub VI. The test conditions include, but are not limited to, whether the test is continuously sent, whether the power needs to be re-applied, the steering engine is in place, and the expected result is the result of the experiment expected by the user for each test command, or the expected experimental phenomenon. Of course, the front panel may also include an area for displaying instructions for generating each test case, a setup completion option, an instruction generation option, an instruction removal option, a save to report option, and an exit option.
The sub-VI in the test case generation template includes, but is not limited to, a steering engine signal conversion sub-VI, a generation checksum sub-VI, an instruction type identification sub-VI, or a table generation sub-VI. And the steering engine signal conversion sub VI calls the labview control to convert the actual stroke number of each steering engine into a corresponding hexadecimal character string. And the generated checksum sub-VI calls the labview control to generate a checksum according to the character string to be calculated. And the table generating sub VI calls the labview control to generate a test case table according to the item to be tested. Based on the name, it is clear that the instruction type identifier VI is used to identify the type of the test case instruction, and the instruction type of the test case includes a normal instruction, a patrol instruction, and a splice instruction, as shown in fig. 5. The conventional instruction is formed by adding interference instructions before and after a normal instruction format, wherein the conventional instruction comprises interference before the instruction, a frame header, a type ID, other signals, a steering engine position signal, other signals, standby signals and interference after the instruction. When an interference command is required, such as pre-command interference or post-command interference, data is filled in the position of the corresponding character string box shown in fig. 4 to generate a corresponding interference command, and the interference command is not filled in when the interference command is not required. The patrol command is formed by inserting a correct command into the correct command, inputting the correct command by the front panel, splitting the correct command into a first half command A and a second half command B, and then inserting the correct command between the commands A, B to combine into a new patrol command. The splicing instruction is mainly used for testing whether the controller can identify the correct instruction when the instruction is not connected, so that the correct instruction needs to be divided into two instructions to be sent to the controller, the program processing divides the correct instruction into an instruction A and an instruction B, and the instruction splicing is different from the patrol instruction in that the correct instruction only needs to be divided into two instructions without integrating other instructions. Based on the format of the conventional instruction, the conventional instruction test may include a frame header error test, a type ID error test, a checksum error test, an instruction interference test, and an over-travel instruction test. As shown in fig. 4, for frame header error test: if the correct test case instruction is AABB +0000+0101+0101+ checksum and AABB is an instruction frame header, when a test case with a wrong frame header needs to be generated, only a non-AABB instruction needs to be input into a frame header control, and if other inputs are unchanged, if the frame header is changed into AACC, the instruction AACC +0000+0101+0101+ checksum is generated after click setting is completed and the instruction is generated. For type ID errors: the control instruction of the servo system control software is generally divided into a flight instruction, a self-check instruction and the like according to different functions, different bytes are set in a certain byte to distinguish the function which needs to be realized currently, if the function is distinguished by one byte behind a frame header, the function is flight data if the function is 0A, and the function is the self-check instruction if the function is 0B. When the byte signal is judged not to be the command in the required range, the rudder system can identify the wrong command, at the moment, only an incorrect command needs to be filled in the control shown by the type ID of the front panel shown in FIG. 4 when the parameters are filled in, other bytes are not changed, and if 0C is filled in, the generated data is the checksum AACC +0C00+0101+0101 +. For the checksum error test, a complete instruction is until the checksum is finished, the checksum is regarded as a valid frame when being correct, otherwise, the checksum is regarded as an invalid frame, the error is designed to judge whether the control software can judge whether the instruction is valid or not, when the checksum error is designed, two numbers between 0 and 1 are randomly generated by using a random number control according to requirements, and then are multiplied by 15 by using a multiplying control, then, the characters are converted into two hexadecimal single-byte character strings by force, the two single-byte character strings are connected into a 16-bit double-byte character string by utilizing a character string connecting control, meanwhile, the correct checksum is calculated through the checksum calculation sub VI, whether the generated random data is the same as the correct checksum or not is judged, and if the error is different, the generated random data is used as the error checksum, and if the error is the same, the random data is regenerated until the generated data is different from the correct data. For instruction disturb testing: instruction disturbs are divided into pre-disturbs, i.e. a series of incorrect instructions before the correct instruction, and post-disturbs, i.e. a series of incorrect instructions after the correct instruction. The design of instruction interference verifies whether a control system can correctly identify when an interference instruction exists, two controls, namely an instruction front interference option and an instruction rear interference option, are arranged in front of and behind the instruction on a human-computer interaction interface generated by the instruction, when the instruction interference needs to be generated, any character string of an incorrect instruction can be input into the two controls, for example, 0102AABB is written into the instruction front interference, and the generated instruction is '0102 + AABB + AACC +0C00+0101+0101+ 0101+ checksum'. For the over-travel instruction test, the over-travel instruction is used for controlling the position signal of the steering engine to exceed the limited travel of the steering engine. The value exceeding the travel is only required to be filled in at the position of the steering engine signal to be measured, and if the limited travel of the steering engine is 30, a value of 35 or more can be input at the corresponding position. The patrol command is formed by inserting a correct command in the middle of the correct command, inputting the correct command by the front panel, splitting the correct command into a first half command A and a second half command B by using a character string splitting control, and then inserting the correct command between the command A and the command B by using the character string inserting control to form a new patrol command. The implementation mode of the splicing instruction is as follows: the instruction splicing is mainly used for testing whether the controller can recognize a correct instruction when the instruction is sent inconsecutively, the correct instruction needs to be divided into two instructions to be sent to the controller, the program processing divides the correct instruction into an instruction A and an instruction B through a character string dividing control, the instruction splicing is different from the patrol instruction in that the correct instruction only needs to be divided into two instructions without integrating other instructions, and the two divided instructions form a character string array by utilizing a created array control to be inserted into an array used for generating a table.
S302: and filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling a character string connection tool of labview and each sub VI to automatically generate a test case instruction based on the instruction type.
In this step, the explanation of the test parameters, test conditions and expected results can refer to the explanation of the corresponding positions in the previous step, and will not be described herein again. For test parameters, the position information of the steering engine needs to be converted into character strings, and other parts do not need to be converted, so before a test instruction is generated, a steering engine signal conversion sub VI needs to be called to convert the actual stroke number of each steering engine into corresponding hexadecimal character strings, and then the character strings which do not need to be converted and the converted character strings are connected to generate a test case instruction by using a character string connecting tool of labview, namely a character string connecting control of labview, based on the instruction type, namely a conventional instruction, a patrol instruction or a splicing instruction.
In the actual application process, the implementation process of this step can be shown in fig. 7 and fig. 6, the event structure, the condition structure, and the while loop can be used to determine the event that should be executed currently, the queue control is used to implement the "input" of the condition structure, the program initialization is to set the queue element to be idle, that is, to be in the default state, when no event occurs, the queue outputs "idle", and the whole program is in the idle state and does not perform any processing. When the 'event structure' identifies that an event occurs through the change of the Boolean values of the controls, for example, the Boolean values of the controls such as 'set completion' and 'generation instruction' are changed, elements of the queue are modified into corresponding conditions and input into the input port of the 'condition structure', and the 'condition structure' of the program judges the current condition and runs the corresponding program. Data which does not need to be calculated and processed are directly connected into a first character string by using a character string connecting control, a signal of a steering engine which needs to be calculated is input into a steering engine signal conversion sub VI for calculation, and the converted signal is converted into a corresponding hexadecimal character string which can be called as a second character string. Inputting the newly generated character strings, namely the first character string and the second character string, the interference before the instruction, the interference after the instruction and the test name into a generated checksum sub VI to calculate a checksum, if the test name is wrong, randomly generating an incorrect checksum, if the test name is other test types, calculating a correct checksum, and finally connecting the control by using the character strings according to the sequence of the interference before the instruction, the newly generated character strings, the checksum and the interference after the instruction to form a complete test instruction. As an optional implementation manner, for convenience of use by a user, the generated complete test instruction may be input into the table generation sub VI for data processing to generate a two-dimensional array, and the generated two-dimensional array may be displayed on a front panel through an XY diagram control for a designer to check whether the generated instruction is correct. If the instruction is incorrect, the user or operator may invoke "clear the last piece of data" by checking the option in the front panel? The "Boolean controls and" clear previous instruction "control program clears the previous instruction from the generated two-dimensional array. If a new test case table is regenerated, the operator can "clear all data" by checking "is the operator clear of all data? And the 'Boolean control' is clicked, and then the operation of the 'clear all instructions' control calls a background program to clear all the generated data. After all test cases are generated, a user can call a background program by clicking a front panel option of 'save to report' to save the generated test cases to a specified path through an 'appended table to report' control of a labVIEW report tool. The generated test instruction can be displayed on the front panel in real time, when the instruction design error is found, the user clicks 'delete last' to delete the wrong test case, then redesigns the instruction, after the test case design is completed, clicks 'save to report' to save the generated test case to the selected path, clicks 'quit' to quit the test case generation process, and returns to the main program.
S203: and when the test request is detected, automatically sending the corresponding test case read from the test case table to the controller, and automatically generating a test result according to the test data fed back by the controller and the corresponding expected result.
As shown in fig. 8 and fig. 9, in this step, the test cases in the test case table are automatically read and sent to the controller through the serial port, data fed back by the controller is received, the data is analyzed, and finally, the analysis result is written into the last column of the test case table as the test result, or written into the table for recording the test result alone, which does not affect the implementation of the present application. The controller is a control system of the servo system control software, the instructions are issued to the servo system control software, the servo system control software controls the steering engine to execute the instructions, then the steering engine feeds back the results after the instructions are executed to the controller, and the controller feeds back the test data. In this step, a test case test front panel may also be set, as shown in fig. 10, the front panel may include a current test instruction option, a total test number option, a tested instruction number option, and a remaining untested instruction option, and through the display of the front panel, when the step S201, that is, the test case automatic test stage, is performed, the system may pop up the front panel shown in fig. 10, and the interface may reflect the instruction of the current test, the total instruction number to be tested, the tested number, and the number to be tested, so that an operator or a user may clearly know the current test progress, and it is convenient for the operator to perform the judgment of time, etc.
According to the technical scheme provided by the embodiment of the invention, the test case is automatically generated according to the test requirement of the test project, the test case data is read and automatically sent to the controller for testing, the data fed back by the controller is analyzed to obtain a conclusion, and the test report is automatically generated.
It should be noted that, in the present application, there is no strict sequential execution order among the steps, and as long as a logical order is met, the steps may be executed simultaneously or according to a certain preset order, and fig. 2 and fig. 3 are only schematic manners, and do not represent only such an execution order.
In the foregoing embodiment, the implementation process of the steering engine signal conversion sub VI is not limited, and a data conversion manner of the steering engine signal conversion sub VI in an implementation manner is provided in this embodiment, as shown in fig. 11, the data conversion method may include the following steps:
the front panel comprises a plurality of steering engine position information input frames, and the steering engine position information is the actual stroke number of the corresponding steering engine represented by decimal system; the process that the steering engine signal conversion sub VI calls the labview control to convert the actual stroke number of each steering engine into the corresponding hexadecimal character string comprises the following steps:
acquiring precision information for data transformation of the actual position, wherein the precision information is that 000-ZZZ represents 0-M degrees, and XXX-YYY represents-N-0 degrees; calling a positive and negative value judgment control to judge whether the actual stroke number of the current steering engine is a positive number or a negative number for the actual stroke number of each steering engine; if the actual stroke number of the current steering engine is a positive number, calling a formula control to calculate l s1the/M obtains an initial decimal value, pairSplitting and forcibly converting the initial decimal value to obtain a corresponding hexadecimal character string; if the actual stroke number of the current steering engine is negative, calling a formula control to calculate XXX-l s2Obtaining an initial decimal numerical value by the aid of the/N, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; wherein, l is the actual stroke number of the current steering engine, Z, X, Y is any value in hexadecimal, M is the stroke corresponding to the ZZZ digital value, N is the stroke corresponding to the XXX digital value, XXX is ZZZ +001, s1Decimal character string, s, for ZZZ conversion2Decimal string converted for XXX-YYY.
By way of example in conjunction with fig. 11, the steering engine signal conversion sub VI implements the calculation: and performing data transformation on the actual position according to a certain precision according to the task book, if the precision required by the task book is 000-AAA representing 0-30 degrees, BBB-CCC representing-30-0 degrees, and if a character string corresponding to 25 degrees is calculated, performing calculation: and judging whether the value is greater than 0 by using a positive and negative value judgment control which is the control whether greater than 0, if greater than 0, calculating 25A '/30 ' by using a formula control, wherein A ' is a decimal character string corresponding to AAA, splitting and forcibly converting the data to generate a steering engine signal character string. If the value is less than 0, and the value is-25 degrees, calculating 'CCC-25X D/30' in the 'formula' control, wherein D is a decimal character string for the CCC-BBB pair.
In the foregoing embodiment, an implementation manner of how to generate the checksum by using the checksum sub VI to call the labview control according to the character string to be calculated to generate the checksum is not limited, and an implementation manner of generating the checksum by using the checksum sub VI to call the labview control according to the character string to be calculated to generate the checksum may include the following steps:
converting the character string to be calculated into a byte array by utilizing a character string to byte array conversion control of labview;
converting the byte array into a decimal array by using a forced conversion control, and converting the decimal array into unsigned double-byte shaping;
adding elements in the unsigned double-byte shaping array by using an array element addition control to obtain an element sum;
splitting the element sum into eight upper bits and eight lower bits by using a data splitting control;
and converting the split element sums into hexadecimal character strings by using the forced conversion control, and connecting the converted hexadecimal character strings according to requirements to generate a checksum.
In the above embodiment, how the table generating sub VI invokes the labview control to generate the test case table according to the item to be tested is not limited, but an embodiment of the table generating sub VI invoking the labview control to generate the test case table according to the item to be tested is provided in this embodiment, referring to fig. 12 and 13, the method may include the following steps:
and generating a command character string by using a character string connection tool according to the specific format of each test parameter such as the product model, the test name, the steering engine position signal and the command.
And calling the instruction type identifier VI to judge whether the generated instruction type is a splicing instruction type or a patrol instruction type. If the to-be-generated instruction is a conventional instruction, namely a splicing instruction and a patrol instruction, the to-be-generated instruction is not processed, and for the splicing instruction and the patrol instruction, the data are processed as follows:
if the test splicing instruction format is adopted, splitting the instruction character string into two sub-instruction character strings as a test splicing instruction; if the command is in the patrol command format, splitting the command character string into two sub-command character strings, and then integrating the two sub-command character strings with the command character string to generate a new command character string as a test patrol command; if the command is in a conventional command format, the obtained original command character string is directly output without any processing;
and (3) generating an instruction array by the instruction character string or the test splicing instruction or the test patrol instruction or the conventional instruction and the corresponding test conditions, such as whether the instruction character string or the test splicing instruction or the test patrol instruction or the conventional instruction is continuously sent or not, whether the power needs to be supplied again or not, the in-place situation of the steering engine and the expected result, inserting the instruction array into the two-dimensional array firstly, then outputting the two-dimensional array into the adding array, and finally inserting the instruction array into the two-dimensional array corresponding to the data to be displayed so as to display the currently.
Optionally, as an optional implementation manner of the present application, when a report saving request is received, each test case instruction in the front panel is stored in the test case table. And when a request for clearing the previous data is received, calling an array element deleting control to delete the last row of data in the two-dimensional array and generating a new two-dimensional array. When a request for clearing all data is received, the two-dimensional array is initialized so as to clear all data in the two-dimensional array.
In this embodiment, the two-dimensional array is displayed on the front panel through the XY diagram control, so that the user or the operator can see the generated test case in time. If the input is to remove the previous data, the last row of data can be deleted by the array element deleting control, and then a new two-dimensional array is output.
In the foregoing embodiment, how to automatically read the test case instruction in step S303 is not limited, and an implementation manner of reading the test instruction is provided in this embodiment, as shown in fig. 14, that is, a process of automatically sending the corresponding test case read from the test case table to the controller may include the following steps:
and reading the storage path of the test case table and each test condition from the front panel of the test case generation template, wherein the test condition is a sending interval condition or a power-on operation condition.
Reading each test case instruction from the test case table according to the storage path call table data reading control;
if the sending interval condition is that the instructions are sent continuously, the instructions of the test cases are sequentially sent to the controller through the VISA write-in control;
if the sending interval condition is a discontinuous sending instruction, judging whether the power-on operation condition is the condition needing power-on again, if the power-on operation condition needs power-on again, displaying power-on operation reminding information to a user, and sending the current test case instruction to the controller through a VISA writing tool when power-on completion indicating information is received; and if the power-on is not required again, when instruction sending indication information is received, sending the current test case instruction to the controller through the VISA writing tool.
In this embodiment, data in the test case table may be read by using the "excel get data.vi control, a table path is consistent with a report path selected in the parameter setting, and then the read data is judged, mainly to judge whether to continuously send the data or not, and whether to need to power on again. At this time, a 'condition structure' is adopted to perform branch processing judgment, judgment data of data read out from the extraction table is used as an input port of a judgment condition input 'condition structure', whether instructions need to be sent continuously or not and whether power needs to be supplied again in the test process or not needs to be judged, and a corresponding program is executed. If the command is sent continuously, labview sends the command to the controller through the VISA write tool in turn. If the data is not transmitted continuously, the process is judged whether to need to be powered up again according to the read data, the condition structure is still used for judging the process, the judgment condition for use is input into the condition structure input port, and a corresponding program is executed according to the judgment result. If the power needs to be powered on again, a dialog box tool is used for popping up a dialog box to remind an operator of carrying out power on operation again, the user clicks 'continue' after the power on operation is completed again, and the labview immediately sends the instruction to the controller through the 'VISA write-in' control. And if the power is not required to be powered on again, popping up a window of 'whether to continue', clicking 'continue' when an operator judges that the instruction needs to be continuously sent, and immediately sending the instruction to the controller by the labview.
Correspondingly, the application also provides an implementation method for automatically generating a test result according to the test data fed back by the controller and the corresponding expected result, which can comprise the following steps:
reading feedback result data after each steering engine executes the test case instruction from the controller through the VISA reading control, and reading effective data of each piece of feedback result data according to a preset feedback format;
the test condition is that the command is continuously sent, if the expected result is that the steering engine does not respond and no feedback exists, the character string length control is used for judging whether the data length of the effective data of the current feedback result data is 0, if the data length is 0, the output data contains the steering engine which does not respond and no feedback exists, and a normal character string constant is tested; if not, outputting a character string constant containing test abnormity and steering engine feedback content;
if the expected result is a steering engine response instruction and feedback exists, determining a frame header of a current test case instruction by using a search/split character string control, and intercepting a character string with a preset instruction length from the current test case instruction by using a character string intercepting control to obtain a target character string; checking and judging the intercepted character string, namely the target character string, and converting the target character string into a target byte array by using a character string-to-byte array conversion control; performing algebraic sum accumulation on all elements before the last two-bit element of the target byte array, and separating the accumulated result according to high-low 8-bit data by using a digital splitting control; converting the split high-low bit data and the last two-bit element of the target byte array into hexadecimal data by using a forced conversion control; if the split high-low data is consistent with the last two bit elements of the target byte array, a connection character string tool is used for connecting the steering engine response normality and the steering engine feedback content with the target character string to form a new character string for outputting.
In this embodiment, after the system sends the test instruction, it needs to read the feedback data of the controller to determine whether the controller can normally respond to the test instruction, at this time, the data fed back by the controller is read through the "VISA read" control, the read data is analyzed and determined, and if the data is normal, the "test normal" and the read data are written into a column of the "test result" in the table; if the data is abnormal, the test exception and the read-back data are written into a column of a table test result. Data reading and processing may be as follows:
the data fed back by the steering engine is read out by using a VISA reading control and is input to an instruction interception sub VI, and the function realized by the instruction interception sub VI is as follows: extracting effective data from the read data according to a task book feedback instruction format, and judging whether the data is the same as an expected result, wherein the program is implemented as follows:
for continuously transmitted data:
if the expected result is that the rudder system does not respond and has no feedback, the character string length control is used for judging whether the read data length is 0, if so, the rudder system has normal function, a character string constant is output, if so, the rudder system does not respond, has no feedback and is tested normally, if so, the character string constant is not 0, and if so, the character string constant is tested abnormally, and the rudder system feeds back: and connecting the read character string with a connection character string control to form a new character string for output, wherein if the test is abnormal, the feedback of the rudder system is as follows: AABB CCD … … "
If the expected result is a rudder system response instruction and feedback exists, finding a frame head by utilizing a 'searching/splitting character string' control, intercepting a correct instruction length by utilizing an 'intercepting character string', checking and judging the intercepted character string, converting the character string into a byte array by utilizing a 'character string-to-byte array conversion' control, carrying out algebraic sum accumulation on each element before the last two elements of the byte array, and using the accumulated result: the ' digital splitting ' control separates the high-low 8-bit data, then the ' forced conversion ' control converts the split high-low data and the last two elements of the array into hexadecimal data, judges whether the split data is consistent with the last two bits of the array element, if so, the split data is a frame of effective data, at the moment, a ' connection character string tool ' is utilized to normally respond the ' rudder system, and the feedback is as follows: and connecting the intercepted character string into a new character string and outputting the new character string.
Test for discontinuous transmission:
for the test of discontinuous transmission, the test displays the instruction through a pop-up window after reading the instruction, the tester autonomously selects the instruction to intercept, and the pop-up serial port is shown in fig. 15.
The tests for discontinuous transmission are: and the rudder system moves from a zero position to a given instruction position, and the time domain, the frequency domain, the rated rotating speed, the self-checking and the like of the rudder system are instructed.
When the test control steering wheel walked to a certain position, whether the instruction that needs to judge feedback was the instruction of steering wheel position of walking, at this moment, treat that the steering wheel draws out last frame feedback data when the assigned position is motionless, reachs the feedback position through calculating, if the feedback position is in assigned position error range, then will "test result is normal, and the normal response of rudder system, the feedback is: and connecting the intercepted character string with a 'connection character string' tool to form a new character string and outputting the new character string. If the steering engine does not respond or the feedback is not within the error range any more, outputting 'test abnormity, steering engine does not respond' or 'deviation of control precision of a steering system'.
When the time domain, the frequency domain, the rated rotating speed and the self-checking instruction of the rudder system are tested, after the steering engine finishes the specified action, a part of character strings are intercepted in the popped dialog box, and the corresponding result is output.
After all the instructions are tested, the for loop outputs the output character string conclusion in a character string array form, after the test is finished, the test result is inserted into the last column of the two-dimensional array read from the table by using an array insertion function to form a new two-dimensional array, and finally the conclusion is written into the corresponding path statement through an 'appended table to report' control.
The embodiment of the invention also provides a corresponding device running on a labview of a laboratory virtual instrument engineering platform aiming at the automatic test method of the servo system control software, thereby further ensuring that the method has higher practicability. Wherein the means can be described separately from the functional module point of view and the hardware point of view. The following describes an automatic testing device of servo system control software according to an embodiment of the present invention, and the automatic testing device of servo system control software described below and the automatic testing method of servo system control software described above may be referred to in correspondence with each other.
Referring to fig. 16, based on the angle of the functional module, fig. 16 is a structural diagram of an automatic testing apparatus for servo system control software according to an embodiment of the present invention, in an embodiment, the apparatus may include:
a test case generation template creation module 161, configured to create a test case generation template including a front panel and multiple child VIs; the sub VI is a steering engine signal conversion sub VI, a generated check sum sub VI, an instruction type identification sub VI or a table generation sub VI; the steering engine signal conversion sub VI calls a labview control to convert the actual stroke number of each steering engine into a corresponding hexadecimal character string; the generated check sum sub VI calls a labview control to generate a check sum according to the character string to be calculated; and the table generating sub VI calls the labview control to generate a test case table according to the item to be tested.
The test case automatic generation module 162 is used for filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling a character string connection tool of labview and each sub VI to automatically generate a test case instruction based on the instruction type; the instruction types include a regular instruction, a patrol instruction, and a splice instruction.
The automatic test module 163 is configured to, when a test request is detected, automatically send the corresponding test case read from the test case table to the controller, and automatically generate a test result according to the test data and the corresponding expected result fed back by the controller.
Optionally, in some embodiments of this embodiment, the steering engine signal converter VI may include:
the precision acquisition unit is used for acquiring precision information for carrying out data conversion on the actual position, wherein the precision information is that 000-ZZZ represents 0-M degrees, and XXX-YYY represents-N-0 degrees;
the numerical value judging unit is used for calling the positive and negative value judging control to judge whether the actual stroke number of the current steering engine is a positive number or a negative number for the actual stroke number of each steering engine;
a numerical value conversion unit for calling a formula control to calculate l s if the actual stroke number of the current steering engine is a positive number1Obtaining an initial decimal numerical value by the aid of the/M, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; if the actual stroke number of the current steering engine is negative, calling a formula control to calculate XXX-l s2Obtaining an initial decimal numerical value by the aid of the/N, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; wherein, l is the actual stroke number of the current steering engine, Z, X, Y is any value in hexadecimal, M is the stroke corresponding to the ZZZ digital value, N is the stroke corresponding to the XXX digital value, XXX is ZZZ +001, s1Decimal character string, s, for ZZZ conversion2Decimal string converted for XXX-YYY.
As an optional implementation manner of this embodiment, generating the checksum sub-VI may include:
the array conversion unit is used for converting the character string to be calculated into a byte array by utilizing a character string to byte array conversion control of labview; converting the byte array into a decimal array by using a forced conversion control, and converting the decimal array into unsigned double-byte shaping;
the element accumulation unit is used for adding the elements in the unsigned double-byte shaping array by using the array element addition control to obtain an element sum;
the data splitting unit is used for splitting the element sum into eight upper bits and eight lower bits by using the data splitting control;
and the checksum generation unit is used for converting the split element sums into hexadecimal character strings by using the forced conversion control and connecting the converted hexadecimal character strings according to requirements to generate a checksum.
As another optional implementation manner of this embodiment, the table generator VI may include:
the character string generating unit is used for generating the instruction character string by using each test parameter through a character string connecting tool;
the instruction identification unit is used for calling the instruction type identifier VI to judge whether the generated instruction type is a splicing instruction type or a patrol instruction type;
the data processing unit is used for splitting the instruction character string into two sub-instruction character strings as a test splicing instruction if the instruction is in a splicing instruction format; if the command is in the patrol command format, splitting the command character string into two sub-command character strings, and then integrating the two sub-command character strings with the command character string to generate a new command character string as a test patrol command; if the command is in a conventional command format, the command character string is directly output without processing;
the instruction display unit is used for generating an instruction array by the instruction character string or the test splicing instruction or the test patrol instruction or the conventional instruction and the corresponding test condition and expected result, and inserting the instruction array into the two-dimensional array corresponding to the data to be displayed so as to display the currently generated test case instruction in the front panel;
and the instruction storage unit is used for storing each test case instruction in the front panel into the test case table when receiving the report form storage request.
In some embodiments of this embodiment, the table generating sub-VI may further include:
the instruction deleting unit is used for calling the array element deleting control to delete the last row of data in the two-dimensional array and generate a new two-dimensional array when a request for removing the previous data is received; when a request for clearing all data is received, the two-dimensional array is initialized so as to clear all data in the two-dimensional array.
As some other optional embodiments of the present application, the automatic test module 163 may include:
the data acquisition submodule is used for reading a storage path of the test case table and each test condition from the front panel, and the test condition is a sending interval condition or a power-on operation condition;
the instruction reading submodule is used for reading each test case instruction from the test case table according to the storage path call table data reading control;
the instruction sending submodule is used for sequentially sending the test case instructions to the controller through the VISA write-in control if the sending interval condition is that the instructions are sent continuously; if the sending interval condition is a discontinuous sending instruction, judging whether the power-on operation condition is the condition needing power-on again, if the power-on operation condition needs power-on again, displaying power-on operation reminding information to a user, and sending the current test case instruction to the controller through a VISA writing tool when power-on completion indicating information is received; and if the power-on is not required again, when instruction sending indication information is received, sending the current test case instruction to the controller through the VISA writing tool.
As some other optional embodiments of the present application, the automatic test module 163 may include, for example:
the feedback data reading sub-module is used for reading feedback result data after the test case instructions are executed by each steering engine from the controller through the VISA reading control, and reading effective data of each piece of feedback result data according to a preset feedback format;
the test data analysis processing submodule is used for continuously sending instructions under the test condition, judging whether the data length of effective data of current feedback result data is 0 or not by using a character string length control if an expected result is that the steering engine does not respond and no feedback exists, and outputting a character string constant which contains no response of the steering engine and no feedback and is tested normally if the data length of the effective data of the current feedback result data is 0; if not, outputting a character string constant containing test abnormity and steering engine feedback content; if the expected result is a steering engine response instruction and feedback exists, determining a frame header of a current test case instruction by using a search/split character string control, and intercepting a character string with a preset instruction length from the current test case instruction by using a character string intercepting control to obtain a target character string; converting the target character string into a target byte array by using a character string-to-byte array conversion control; performing algebraic sum accumulation on all elements before the last two-bit element of the target byte array, and separating the accumulated result according to high-low 8-bit data by using a digital splitting control; if the split high-low data is consistent with the last two bit elements of the target byte array, a connection character string tool is used for connecting the steering engine response normality and the steering engine feedback content with the target character string to form a new character string for outputting.
The functions of the functional modules of the automatic testing device for the servo system control software according to the embodiment of the present invention can be specifically implemented according to the method in the embodiment of the method, and the specific implementation process may refer to the description related to the embodiment of the method, which is not described herein again.
Therefore, the embodiment of the invention realizes the full-automatic test of the servo system control software and effectively improves the test efficiency of the servo system control software.
The above mentioned automatic testing device for servo system control software is described from the perspective of functional modules, and further, the present application also provides an automatic testing device for servo system control software, which is described from the perspective of hardware. Fig. 17 is a structural diagram of another automatic testing apparatus for servo system control software according to an embodiment of the present application. As shown in fig. 17, the apparatus includes a memory 170 for storing a computer program;
the processor 171 is configured to execute the computer program to implement the steps of the automatic testing method for the servo system control software according to any one of the above embodiments.
The processor 171 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 171 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 171 may also include a main processor and a coprocessor, the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 171 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 171 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
The memory 170 may include one or more computer-readable storage media, which may be non-transitory. Memory 170 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 170 is at least used for storing the computer program 1701, wherein after the computer program is loaded and executed by the processor 171, the relevant steps of the automatic testing method of the servo system control software disclosed in any of the foregoing embodiments can be implemented. In addition, the resources stored by the memory 170 may include, inter alia, an operating system 1702 and data 1703, which may be stored as transient or persistent storage. Operating system 1702 may include Windows, Unix, Linux, and the like. Data 1703 may include, but is not limited to, data corresponding to test results, and the like.
In some embodiments, the automatic testing device of the servo system control software may further include a display 172, an input/output interface 173, a communication interface 174, a power supply 175, and a communication bus 176, such as the sensor 57.
Those skilled in the art will appreciate that the configuration shown in FIG. 17 does not constitute a limitation of an automated testing apparatus for servo system control software, and may include more or fewer components than those shown, such as sensors 177.
The functions of the functional modules of the automatic testing device for the servo system control software according to the embodiment of the present invention can be specifically implemented according to the method in the embodiment of the method, and the specific implementation process may refer to the description related to the embodiment of the method, which is not described herein again.
Therefore, the embodiment of the invention realizes the full-automatic test of the servo system control software and effectively improves the test efficiency of the servo system control software.
It is understood that, if the automatic testing method of the servo system control software in the above embodiments is implemented in the form of a software functional unit and sold or used as a stand-alone product, it may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be substantially or partially implemented in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods of the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), an electrically erasable programmable ROM, a register, a hard disk, a removable magnetic disk, a CD-ROM, a magnetic or optical disk, and other various media capable of storing program codes.
Based on this, the embodiment of the present invention further provides a computer readable storage medium, in which an automatic test program of servo system control software is stored, and the steps of the method for automatically testing servo system control software according to any one of the above embodiments are executed by a processor.
The functions of the functional modules of the computer-readable storage medium according to the embodiment of the present invention may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Therefore, the embodiment of the invention realizes the full-automatic test of the servo system control software and effectively improves the test efficiency of the servo system control software.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The present application provides a method, an apparatus and a computer readable storage medium for automatically testing servo system control software. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present application.
Claims (10)
1. An automatic test method for servo system control software is characterized in that the method runs on a labview virtual instrument engineering platform, and comprises the following steps:
pre-creating a test case generation template comprising a front panel and a plurality of sub-VI;
filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling a character string connection tool and each sub VI of the labview to automatically generate a test case instruction based on the instruction type; the instruction types comprise a conventional instruction, a patrol instruction and a splicing instruction;
when a test request is detected, automatically sending the corresponding test case read from the test case table to the controller, and automatically generating a test result according to the test data fed back by the controller and the corresponding expected result;
the sub VI is a steering engine signal conversion sub VI, a generated check sum sub VI, an instruction type identification sub VI or a table generation sub VI; the steering engine signal conversion sub VI calls a labview control to convert the actual stroke number of each steering engine into a corresponding hexadecimal character string; the generated checksum sub VI calls a labview control to generate a checksum according to the character string to be calculated; and the table generator VI calls a labview control to generate a test case table according to the item to be tested.
2. The automatic test method of the servo system control software according to claim 1, wherein the front panel comprises a plurality of steering engine position information input frames, and the steering engine position information is the actual stroke number of the corresponding steering engine represented by decimal; the process that the steering engine signal conversion sub VI calls the labview control to convert the actual stroke number of each steering engine into the corresponding hexadecimal character string comprises the following steps:
acquiring precision information for carrying out data transformation on an actual position, wherein the precision information is that 000-ZZZ represents 0-M degrees, and XXX-YY represents-N-0 degrees;
calling a positive and negative value judgment control to judge whether the actual stroke number of the current steering engine is a positive number or a negative number for the actual stroke number of each steering engine;
if the actual stroke number of the current steering engine is a positive number, calling a formula control to calculate l s1Obtaining an initial decimal numerical value by the aid of the/M, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; if the actual stroke number of the current steering engine is a negative number, calling a formula control to calculate XXX-l × s2Obtaining an initial decimal numerical value by the aid of the/N, and splitting and forcibly converting the initial decimal numerical value to obtain a corresponding hexadecimal character string; wherein l is the actual stroke number of the current steering engine, Z, X, Y is any hexadecimal numerical value, M is the stroke corresponding to the ZZZ numerical value, N is the stroke corresponding to the XXX numerical value, XXX is ZZZ +001, s1Decimal character string, s, for ZZZ conversion2Decimal string converted for XXX-YYY.
3. The method for automatically testing servo system control software according to claim 1, wherein the process of generating the checksum, calling the labview control to generate the checksum according to the character string to be calculated by the checksum sub VI comprises:
converting the character string to be calculated into a byte array by utilizing the character string to byte array conversion control of the labview;
converting the byte array into a decimal array by using a forced conversion control, and converting the decimal array into unsigned double-byte shaping;
adding elements in the unsigned double-byte shaping array by using an array element addition control to obtain an element sum;
splitting the element sum into eight upper bits and eight lower bits by using a data splitting control;
and converting the split element sums into hexadecimal character strings by using the forced conversion control, and connecting the converted hexadecimal character strings according to requirements to generate a checksum.
4. The method for automatically testing servo system control software according to claim 1, wherein the process of the table generator VI invoking labview control to generate test case table according to the item to be tested comprises:
generating an instruction character string by using each test parameter through the character string connection tool;
calling the instruction type identifier VI to judge whether the generated instruction type is a splicing instruction type or a patrol instruction type;
if the test splicing instruction format is adopted, splitting the instruction character string into two sub-instruction character strings as a test splicing instruction; if the command string is in the patrol command format, splitting the command string into two sub-command strings, and then integrating the two sub-command strings with the command string to generate a new command string as a test patrol command; if the command is in a conventional command format, the command character string is directly output without processing;
generating an instruction array by the instruction character string or the test splicing instruction or the test patrol instruction or the conventional instruction and corresponding test conditions and expected results, and inserting the instruction array into a two-dimensional array corresponding to data to be displayed so as to display a currently generated test case instruction in the front panel;
and when a report form storage request is received, storing each test case instruction in the front panel into the test case table.
5. The method according to claim 4, further comprising, after displaying the currently generated test case commands on the front panel:
when a request for removing the previous data is received, an array element deleting control is called to delete the last row of data in the two-dimensional array and generate a new two-dimensional array;
and when a request for clearing all data is received, initializing the two-dimensional array so as to clear all data in the two-dimensional array.
6. The method of claim 1, wherein automatically sending the corresponding test cases read from the test case table to the controller comprises:
reading a storage path and each test condition of the test case table from the front panel, wherein the test condition is a sending interval condition or a power-on operation condition;
reading each test case instruction from the test case table according to the storage path call table data reading control;
if the sending interval condition is that the instructions are sent continuously, the instructions of the test cases are sequentially sent to the controller through a VISA write-in control;
if the sending interval condition is a discontinuous sending instruction, judging whether the power-on operation condition is the condition needing power-on again, if the power-on operation condition needs power-on again, displaying power-on operation reminding information to a user, and when power-on completion indicating information is received, sending a current test case instruction to the controller through the VISA writing tool; and if the power-on is not required again, when instruction sending instruction information is received, sending the current test case instruction to the controller through the VISA writing tool.
7. The method for automatically testing servo system control software according to any one of claims 1 to 6, wherein the automatically generating test results according to the test data fed back by the controller and the corresponding expected results comprises:
reading feedback result data of each steering engine after the steering engine executes the test case instruction from the controller through a VISA reading control, and reading effective data of each piece of feedback result data according to a preset feedback format;
the test condition is that an instruction is continuously sent, if the expected result is that the steering engine does not respond and no feedback exists, the character string length control is used for judging whether the data length of the effective data of the current feedback result data is 0, if the data length is 0, the data containing the steering engine does not respond and no feedback is output, and a normal character string constant is tested; if not, outputting a character string constant containing test abnormity and steering engine feedback content;
if the expected result is a steering engine response instruction and feedback exists, determining a frame header of a current test case instruction by using a search/split character string control, and intercepting a character string with a preset instruction length from the current test case instruction by using a character string intercepting control to obtain a target character string; converting the target character string into a target byte array by utilizing a character string-to-byte array conversion control; performing algebraic sum accumulation on all elements before the last two-bit element of the target byte array, and separating an accumulated result according to high-low 8-bit data by using a digital splitting control; and if the split high-low data is consistent with the last two bit elements of the target byte array, connecting the steering engine response normal content and the steering engine feedback content with the target character string by using a connection character string tool to form a new character string for outputting.
8. An automatic testing device of servo system control software is characterized in that the device runs on a labview virtual instrument engineering platform, and comprises:
the test case generation template creation module is used for creating a test case generation template comprising a front panel and a plurality of child VI; the sub VI is a steering engine signal conversion sub VI, a generated check sum sub VI, an instruction type identification sub VI or a table generation sub VI; the steering engine signal conversion sub VI calls a labview control to convert the actual stroke number of each steering engine into a corresponding hexadecimal character string; the generated checksum sub VI calls a labview control to generate a checksum according to the character string to be calculated; the table generator VI calls a labview control to generate a test case table according to the item to be tested;
the test case automatic generation module is used for filling the test parameters, the test conditions and the corresponding expected results of the items to be tested to the corresponding positions of the front panel, and calling the character string connection tool of the labview and each sub VI to automatically generate test case instructions based on the instruction types; the instruction types comprise a conventional instruction, a patrol instruction and a splicing instruction;
and the automatic test module is used for automatically sending the corresponding test case read from the test case table to the controller when the test request is detected, and automatically generating a test result according to the test data fed back by the controller and the corresponding expected result.
9. An apparatus for automated testing of servo control software, comprising a processor for implementing the steps of the method for automated testing of servo control software according to any one of claims 1 to 7 when executing a computer program stored in a memory.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores thereon an automated test program of servo control software, the automated test program of servo control software being executed by a processor to implement the steps of the method for automated testing of servo control software according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011320815.XA CN112506759B (en) | 2020-11-23 | 2020-11-23 | Automatic test method and device for servo system control software and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011320815.XA CN112506759B (en) | 2020-11-23 | 2020-11-23 | Automatic test method and device for servo system control software and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112506759A true CN112506759A (en) | 2021-03-16 |
CN112506759B CN112506759B (en) | 2023-11-14 |
Family
ID=74959937
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011320815.XA Active CN112506759B (en) | 2020-11-23 | 2020-11-23 | Automatic test method and device for servo system control software and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112506759B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113189909A (en) * | 2021-04-29 | 2021-07-30 | 华人运通(上海)云计算科技有限公司 | Control method, device and equipment of vehicle control instruction block and storage medium |
CN113204447A (en) * | 2021-04-30 | 2021-08-03 | 中国科学院长春光学精密机械与物理研究所 | Calculation tool for data word message verification and calculation method thereof |
CN114089725A (en) * | 2021-11-18 | 2022-02-25 | 北京烁科精微电子装备有限公司 | Test method and device for CMP (chemical mechanical polishing) equipment control software and electronic equipment |
CN114416458A (en) * | 2022-03-30 | 2022-04-29 | 航天中认软件测评科技(北京)有限责任公司 | Test method, device, equipment and storage medium |
CN116599537A (en) * | 2023-05-18 | 2023-08-15 | 哈尔滨市科佳通用机电股份有限公司 | Unit test method of railway frequency shift signal decoding algorithm |
CN116909932A (en) * | 2023-09-12 | 2023-10-20 | 吉孚汽车技术(苏州)有限公司 | Continuous integrated automatic software testing system and method based on VT system |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103942092A (en) * | 2014-04-25 | 2014-07-23 | 中国人民解放军装备学院 | HLA co-simulation method supporting LabView graphical programming |
CN104295561A (en) * | 2014-10-15 | 2015-01-21 | 上海徽封机电设备有限公司 | Proportional servo valve testing system and testing method thereof |
CN105224447A (en) * | 2014-06-11 | 2016-01-06 | 联创汽车电子有限公司 | Engine controller software diagnosis module test method and test macro |
CN105699105A (en) * | 2016-01-29 | 2016-06-22 | 成都乐创自动化技术股份有限公司 | An ST test system and method for an alternating current servo system |
CN106294121A (en) * | 2016-07-13 | 2017-01-04 | 北京航空航天大学 | Aircraft embedded real-time diagnosis reasoning algorithm test method |
US20170010956A1 (en) * | 2014-07-11 | 2017-01-12 | University Of Electronic Science And Technology Of China | Device for automatically generating test cases for embedded software and method thereof |
CN108763076A (en) * | 2018-05-22 | 2018-11-06 | 深圳乐信软件技术有限公司 | A kind of Software Automatic Testing Method, device, equipment and medium |
CN108983640A (en) * | 2018-06-27 | 2018-12-11 | 南京理工大学 | A kind of electric linear steering gear control system and method based on LabVIEW |
CN110780597A (en) * | 2019-10-23 | 2020-02-11 | 四川航天烽火伺服控制技术有限公司 | Control method, device, equipment and medium for preventing steering engine from oscillating |
-
2020
- 2020-11-23 CN CN202011320815.XA patent/CN112506759B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103942092A (en) * | 2014-04-25 | 2014-07-23 | 中国人民解放军装备学院 | HLA co-simulation method supporting LabView graphical programming |
CN105224447A (en) * | 2014-06-11 | 2016-01-06 | 联创汽车电子有限公司 | Engine controller software diagnosis module test method and test macro |
US20170010956A1 (en) * | 2014-07-11 | 2017-01-12 | University Of Electronic Science And Technology Of China | Device for automatically generating test cases for embedded software and method thereof |
CN104295561A (en) * | 2014-10-15 | 2015-01-21 | 上海徽封机电设备有限公司 | Proportional servo valve testing system and testing method thereof |
CN105699105A (en) * | 2016-01-29 | 2016-06-22 | 成都乐创自动化技术股份有限公司 | An ST test system and method for an alternating current servo system |
CN106294121A (en) * | 2016-07-13 | 2017-01-04 | 北京航空航天大学 | Aircraft embedded real-time diagnosis reasoning algorithm test method |
CN108763076A (en) * | 2018-05-22 | 2018-11-06 | 深圳乐信软件技术有限公司 | A kind of Software Automatic Testing Method, device, equipment and medium |
CN108983640A (en) * | 2018-06-27 | 2018-12-11 | 南京理工大学 | A kind of electric linear steering gear control system and method based on LabVIEW |
CN110780597A (en) * | 2019-10-23 | 2020-02-11 | 四川航天烽火伺服控制技术有限公司 | Control method, device, equipment and medium for preventing steering engine from oscillating |
Non-Patent Citations (4)
Title |
---|
ZHAO JUNPENG; LIU XINFU: "Research on PID controller for hydraulic servo system based on LabVIEW", 2015 INTERNATIONAL CONFERENCE ON FLUID POWER AND MECHATRONICS (FPM), pages 1 - 4 * |
宫玉琳;李锐;白晓东;: "基于LabVIEW的伺服测试系统设计", 长春理工大学学报(自然科学版), no. 05, pages 91 - 96 * |
权维利;姚晓先;林凡;: "基于LabVIEW和DSP的数字舵机测控系统研究", 机床与液压, no. 04, pages 103 - 105 * |
樊留群;万德科;: "伺服系统性能测试台的研究与开发", 电机与控制应用, no. 07, pages 16 - 19 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113189909A (en) * | 2021-04-29 | 2021-07-30 | 华人运通(上海)云计算科技有限公司 | Control method, device and equipment of vehicle control instruction block and storage medium |
CN113189909B (en) * | 2021-04-29 | 2022-12-27 | 华人运通(上海)云计算科技有限公司 | Control method, device and equipment of vehicle control instruction block and storage medium |
CN113204447A (en) * | 2021-04-30 | 2021-08-03 | 中国科学院长春光学精密机械与物理研究所 | Calculation tool for data word message verification and calculation method thereof |
CN114089725A (en) * | 2021-11-18 | 2022-02-25 | 北京烁科精微电子装备有限公司 | Test method and device for CMP (chemical mechanical polishing) equipment control software and electronic equipment |
CN114089725B (en) * | 2021-11-18 | 2024-03-15 | 北京晶亦精微科技股份有限公司 | Test method and device for control software of chemical mechanical polishing equipment and electronic equipment |
CN114416458A (en) * | 2022-03-30 | 2022-04-29 | 航天中认软件测评科技(北京)有限责任公司 | Test method, device, equipment and storage medium |
CN114416458B (en) * | 2022-03-30 | 2022-08-05 | 航天中认软件测评科技(北京)有限责任公司 | Test method, device, equipment and storage medium |
CN116599537A (en) * | 2023-05-18 | 2023-08-15 | 哈尔滨市科佳通用机电股份有限公司 | Unit test method of railway frequency shift signal decoding algorithm |
CN116909932A (en) * | 2023-09-12 | 2023-10-20 | 吉孚汽车技术(苏州)有限公司 | Continuous integrated automatic software testing system and method based on VT system |
CN116909932B (en) * | 2023-09-12 | 2023-12-05 | 吉孚汽车技术(苏州)有限公司 | Continuous integrated automatic software testing system and method based on VT system |
Also Published As
Publication number | Publication date |
---|---|
CN112506759B (en) | 2023-11-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112506759A (en) | Automatic testing method and device for servo system control software and storage medium | |
US9754059B2 (en) | Graphical design verification environment generator | |
US10025696B2 (en) | System and method for equivalence class analysis-based automated requirements-based test case generation | |
US8301423B1 (en) | Verification and validation system for a graphical model | |
JP2765969B2 (en) | Schematic data-driven program development support system | |
US7895575B2 (en) | Apparatus and method for generating test driver | |
US8209158B1 (en) | Processor-in-the-loop co-simulation of a model | |
US20170083646A1 (en) | Method for modifying computer-based modeling | |
CN109614325B (en) | Method and device for determining control attribute, electronic equipment and storage medium | |
CN113835643B (en) | Data storage method and device, electronic equipment and readable storage medium | |
CN113918465A (en) | Compatibility testing method and device, electronic equipment and readable storage medium | |
CN104375934A (en) | Method for testing reliability of Android mobile phone software | |
CN108228455A (en) | A kind of software controls hazard analysis method | |
JP2002099584A (en) | System and method for verifying design and computer- readable medium with program for design verification recorded thereon | |
CN107153610A (en) | A kind of program statement error-detecting method and device | |
CN117634370A (en) | Function verification method and platform for Verilog code | |
CN116451621A (en) | Method, system, equipment and medium for generating functional coverage rate code | |
US10853532B2 (en) | Graphical modeling for accessing dynamic system states across different components | |
CN108762227B (en) | Automatic driving test system and method | |
CN112380133A (en) | Method and device for simulating instruction set simulator by using function library | |
CN118114520A (en) | Method and device for acquiring axial overload data of control body | |
CN114090454B (en) | Interface automation test method, device, equipment and storage medium | |
US20050278154A1 (en) | Systems and methods for high level simulator control | |
KR102005718B1 (en) | Situation information indexing type actual operation based script generation method for mobile device | |
US20240176926A1 (en) | Method and system for simulating a control program |
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 |