CN109213671A - Method for testing software and its platform - Google Patents

Method for testing software and its platform Download PDF

Info

Publication number
CN109213671A
CN109213671A CN201710525788.1A CN201710525788A CN109213671A CN 109213671 A CN109213671 A CN 109213671A CN 201710525788 A CN201710525788 A CN 201710525788A CN 109213671 A CN109213671 A CN 109213671A
Authority
CN
China
Prior art keywords
test
input
data
software
component
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
Application number
CN201710525788.1A
Other languages
Chinese (zh)
Other versions
CN109213671B (en
Inventor
王影
刘卉
赵娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
AECC Commercial Aircraft Engine Co Ltd
Original Assignee
AECC Commercial Aircraft Engine Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by AECC Commercial Aircraft Engine Co Ltd filed Critical AECC Commercial Aircraft Engine Co Ltd
Priority to CN201710525788.1A priority Critical patent/CN109213671B/en
Publication of CN109213671A publication Critical patent/CN109213671A/en
Application granted granted Critical
Publication of CN109213671B publication Critical patent/CN109213671B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics

Abstract

The present invention provides a kind of method for testing software and platforms.The method for testing software includes: a. to inject test case by test case file, and the test case is parsed and cached;B. the input data in the test case is established into static association with tested software component input interface;C. the tested software component is packaged using predefined tested software unit container;D. it executes with controlling test period property;E. the input of tested software component, output interface are subjected to static association by data pointer and test result output buffer, and test result is stored to the test result output buffer;And f. is from the output buffer read test as a result, and the test result being recorded and being saved.The method for testing software and platform have the characteristics that can across software repeated usage, a variety of different types of data in test case can be properly read, can guarantee the event synchronization tested between inputoutput data.

Description

Method for testing software and its platform
Technical field
The invention mainly relates to software test field more particularly to a kind of method for testing software and its platform.
Background technique
Software test platform is usually by software test platform frame, tested software component (for example closed-loop system, by controlled pair Be scheduled but as model is considered as a software component not as measured piece, in the present invention to this indefinite differentiation), test it is defeated Enter and amount to four parts composition with test result interpretation, as shown in Figure 1.
The input module that software test platform scheme framework is usually injected, parses and cached by 1) being used for test case, 2) Interface for the input data (buffer area) in use-case file to be established static association with software component outer input interface closes Gang mould block, 3) test execution controls (access comprising software component and plant model) module and 4) test result record and The most of composition of preserving module four.Tested component is to be combined together test object and test platform, so that composition is complete Software test platform ontology.All module close-coupleds in a software solution (.sln/.prj), by compiling, Link forms complete software test platform, as shown in Figure 2.
In software test platform frame implementation, tested component and software test platform be usually all include initial Change and the period executes two parts.Wherein, unit under test initialization belongs to a part of software test platform initialization, unit under test Period execution part is a part for executing (master control) module in the software test platform period, as shown in Figure 3.
Existing software test platform has the disadvantages that
1. existing software test platform constructs dedicated test platform, test platform both for a designated software It with unit under test close-coupled, can not divide, lack general solution.Therefore, the test platform of each software will be single Solely building, it is difficult to realize transplanting and multiplexing of the function logics such as periodic scheduling timing control between different software test platform, Repeated construction is caused, the overall cost of software development is increased.
2. about the injection of test case, existing software test platform there are two main classes scheme: 1) a kind of scheme is logical The control of graphic user interface is crossed to receive and handle different types of input data, each control and software component input interface are straight Static binding is connect, because the data input of most controls is usually to cover old value with new value, multiple groups input data can not be saved simultaneously, It is difficult to ensure the refreshing on time of control input data, can not support the accurate control of test input beat.2) another scheme is All outsides are controllably inputted and its inputted rhythm control information and are organized into use-case input file in digital form, it is unified to provide To tested software, solve the problems, such as that former test input beat accurately controls;It is existing soft about the parsing of use-case file Part test platform requires all case datas to use identical data type, when carrying out interface conjunctionn with tested software by strong Type conversion processed is matched, and is had lost the precision of partial test input data, is influenced the accuracy of test result.
3. in closed-loop control system, portion of external input non-test use from complicated controlled device (model) Example, test output are not uniquely determined by use-case input, and the correctness of test result can not be judged automatically according only to use-case input.Cause This existing software test platform mainly uses the artificial interpretation scheme of test result, i.e., test result is directly recorded, by artificial Mode compares the relationship of input and output, carries out result interpretation.But since test case is output and input not in test result Association is established, causes the synchronized relation of input, output to be difficult to safeguard, influences the efficiency and accuracy of test result interpretation.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of method for testing software and platform, having can be multiple across software With, a variety of different types of data in test case can be properly read, can guarantee to test between inputoutput data The features such as event synchronization.
In order to solve the above technical problems, the present invention provides a kind of method for testing software comprising: a. passes through test case File injects test case, and the test case is parsed and cached;B. by the input data in the test case Static association is established with tested software component input interface;C. using predefined tested software unit container to it is described be tested it is soft Part component is packaged;D. it executes with controlling test period property;E. the input of tested software component, output interface are passed through into data Pointer and test result output buffer carry out static association, and test result is stored to the test result to export and is buffered Area;And f. is from the output buffer read test as a result, and the test result being recorded and being saved.
It in one embodiment of this invention, include the multiple normal datas arranged with row or column in the test case file Type identification, and the corresponding input data arranged with row or column is identified with the multiple data type.
It in one embodiment of this invention, include: that a1. reads the input data in a manner of row or column in step a; A2. the data type of the input data according to each input data corresponding standard data type identification (RNC-ID) analytic;And a3. The input data is cached at most type of container formula input data buffer area in the storage component of type compatibility.
In one embodiment of this invention, the tested software unit container is array of function pointer.
In one embodiment of this invention, step c includes being encapsulated into the tested software component of different dispatching cycles Different tested software unit containers.
In one embodiment of this invention, step e includes connecing for the dedicated input of each tested software component distribution, output Mouth container, the input, output interface container include the data pointer.
In one embodiment of this invention, step e includes: and completes a wheel scheduling when each tested software component to execute When, the test output that all tests input current value that the tested software component participates in calculating is generated with calculating is together, logical The data pointer is crossed, dynamically the correct data type of Auto-matching, is being cached to the test result output buffer just In true component.
In one embodiment of this invention, step f includes: when all tests in the test case file are used Example is when being completed, disposably from the output buffer read test as a result, and to the test result carry out record and It saves.
Another aspect provides a kind of software test platforms comprising: input module, for being used by test Example text part injects test case, and the test case is parsed and cached;First interface relating module, being used for will be described Input data and tested software component input interface in test case establish static association;Software component AM access module, is used for The tested software component is packaged using predefined tested software unit container;Test execution control module, is used for Execute to control test period property;Second interface relating module, for the input of tested software component, output interface to be passed through number Static association is carried out according to pointer and test result output buffer, and test result is stored to the test result to export and is buffered Area;And test result records and preserving module, for from the output buffer read test as a result, and being tied to the test Fruit is recorded and is saved.
In one embodiment of this invention, the test execution control module includes timing rhythm control numerical value, when described Sequence rhythm control numerical value is the common divisor in all tested software means schedule periods.
Compared with prior art, the invention has the following advantages that
The present invention provides a kind of method for testing software and platforms, can dispatch timing general controls mould in holding member Under the premise of group is completely constant, as long as modification initialization mould group, and creates projects (.sln/ together with tested component .prj), so that it may be conveniently generated a software full digital trigger technique unit test platform, realize test platform constructing plan base In the multiplexing of component level.If tested software upgrades, as long as its interface is constant, so that it may cover, replace tested component, directly It connects recompility and generates new version software test platform, maintenance cost is very low.It, can also be if measurand changes Tested software component is directly replaced on former test platform, is reconfigured initialization module and is reached that quickly generate new software test flat The purpose of platform saves the great amount of cost that test platform is individually developed for each software.
In addition, the present invention supports that defining each test respectively with various standard data types inputs, and to tested software Identical numerical precision is kept to carry out data type matching and parsing when component injection excitation, it is ensured that on software test platform The accuracy and validity of the test result of execution.
Finally, the test input that test is exported and generated the output by the present invention is recorded by its calculating cycle together, is cached, And be automatically logged into test result file at the end of test execution, it ensure that test input is synchronous with test, convenient for fast Speed accurately judge the correctness of test result, while can save, accumulate original test data, with support software architecture with The Continuous optimization of algorithm.
Detailed description of the invention
Fig. 1 is the basic block diagram of existing software test platform.
Fig. 2 is existing software test platform scheme configuration diagram.
Fig. 3 is that existing software test platform frame module divides schematic diagram.
Fig. 4 is the software test platform scheme configuration diagram of one embodiment of the invention.
Fig. 5 is the schematic diagram of the diversiform data container of one embodiment of the invention.
Fig. 6 is the software component test record special container form schematic diagram of one embodiment of the invention.
Fig. 7 is that the software test platform main control module of one embodiment of the invention divides schematic diagram.
Fig. 8 is the test case schematic diagram of one embodiment of the invention.
Fig. 9 is the function division schematic diagram of the software test platform of one embodiment of the invention.
Figure 10 is the basic step of the input and output initialization of one embodiment of the invention.
Figure 11 is the basic step of the test platform initialization of one embodiment of the invention.
Figure 12 is the basic step parsed to the mixed type data input in use-case file of one embodiment of the invention Suddenly.
Figure 13 is the basic step of the use-case injection rhythm control of one embodiment of the invention.
Figure 14 is the timesharing sequence scheduler of one embodiment of the invention and the basic step of input and output synchronization caching.
Figure 15 is the basic step that the test result of one embodiment of the invention automatically saves.
Figure 16 is that the automatic cycle of one embodiment of the invention executes the basic step of control.
Figure 17 is the method for testing software of one embodiment of the invention.
Specific embodiment
For the above objects, features and advantages of the present invention can be clearer and more comprehensible, below in conjunction with attached drawing to tool of the invention Body embodiment elaborates.
In the following description, numerous specific details are set forth in order to facilitate a full understanding of the present invention, but the present invention can be with It is different from other way described herein using other and implements, therefore the present invention is by the limit of following public specific embodiment System.
As shown in the application and claims, unless context clearly prompts exceptional situation, " one ", "one", " one The words such as kind " and/or "the" not refer in particular to odd number, may also comprise plural number.It is, in general, that term " includes " only prompts to wrap with "comprising" Include clearly identify the step of and element, and these steps and element do not constitute one it is exclusive enumerate, method or apparatus The step of may also including other or element.
Software test platform is divided into variable initialization mould group to the present invention and changeless means schedule timing is general Mould group two parts are controlled, wherein means schedule timing general controls mould group can be real between different software component simulation test platform The whole multiplexing of existing component-level;Mould group is initialized as connecting component and dispatches timing general controls mould group and tested software portion The tie of part erects bridge between means schedule timing general controls mould group and tested software component, by the outside of the two Interface is associated, docks, and tested software component is included in means schedule timing general controls mould group is predefined " to be tested soft In part unit container ", means schedule timing general controls mould group is realized by being somebody's turn to do " tested software unit container " to tested portion The indirect scheduling of part.
Fig. 4 is the software test platform scheme configuration diagram of one embodiment of the invention.Referring to FIG. 4, software test is flat Platform 10 includes sequentially connected input module 11, first interface relating module 12, software component AM access module 13, test execution control Molding block 14, second interface relating module 15 and test result record and preserving module 16.
Input module 11 is for test case injection, parsing and caching.In one embodiment, all test inputs are protected in advance There are in use-case text file, except first " timing rhythm control numerical value " be used to define input data variation timing node it Outside, other each column datas respectively with specified component input interface static binding.A line is determined in use-case document to define The type (such as character type, integer, long, short, floating type, type double precision) of every column data.In input mould When block 11 parses use-case file, according to the type (character string forms) of the every column data identified in use-case file, with corresponding Formatting input character string dynamically the correct data type of Auto-matching (such as in C language with format input character string " %c " matches character type, and " %d " matches integer, and " %ld " matches long, and " %hd " matches short, and " %f " matches floating-point Type, " %lf " match double), which is kept in into polymorphic type container type input data buffer area, type compatibility It stores in component, solves the problems, such as the injection of mixed type test data.For versatility, software test platform 10 is by timing section The dimension unified definition for clapping control numerical value is the common divisor in all means schedule periods, and is provided in the form of platform exterior interface It is modified to tester.Each component is known as one " diversiform data container " in polymorphic type container type input data buffer area (being realized in such as C language with union structure), referred to as " container ".It include a plurality of types of components in container, important share of institute is deposited Space is stored up, only the effective length of each component is different, representation is different;When " container " is somebody's turn to do in access every time, only one Component is effective, as shown in Figure 5.In this way, software test platform 10 realizes the solution to mixed type data in test case file Analysis and caching.
First interface relating module 12 be used for by use-case file input data (buffer area) and tested software component outside Portion's input interface establishes static association.Preferably, first interface relating module 12 be will be by use-case according to the row number of use-case file Input data (buffer area) and software component outer input interface in file establish static association.
Software component AM access module 13 is used for using the predefined tested software unit container of software test platform (such as letter Number array of pointers) called software component is packaged.In this way, software test platform 10 does not carry out software component directly Operation, but the predefined tested software unit container of software test platform is operated by array of function pointer, so that The execution of test execution control module 14 is no longer dependent on specific software component, realizes test execution control module 14 and quilt Survey object between it is decoupling, realize 10 core component of software test platform across software repeated usage.It should be noted that at this " software component " includes plant model in the context of invention.In a non-limiting embodiment, all software components Classify according to dispatching cycle, every kind of dispatching cycle corresponds to the difference that software test platform predefines " tested software unit container " In unit (software test platform is associated in the form of function pointer with the foundation of tested software unit container), " tested software component holds The effective unit number and storage location of device " are configurable as a part of platform interface.In one embodiment, each software portion When part is packaged, first judge whether it is current test object, if so, calling first interface to close before the software component executes Gang mould block 12 passes through the input interface for entering data to keep or refresh the software component in test case;If it is not, then directly It is connect using the output of the possibility of the relevant component of the software component or static initial value to keep or refresh the input of the software component Mouthful.
Test execution control module 14 is used to control the execution of test, such as periodically carries out.
Second interface relating module 15 is used to tie the input of each software component, output interface by data pointer and test Fruit output buffer carries out static association.In second interface relating module 15, it is assigned with specially for each tested software component Input, output interface " container ", the size number of output interface (input) of container and its with input, output interface It is associated with static binding during initialization.It therefore, only need to be in tested software portion in test result record and preserving module 16 When part is scheduled to run every time, pass through " polymorphic type container type " component input interface rope in " unit test record special container " Draw (in C language for data pointer) to the input of each component, output interface (from Software Architecture Design as a result, containing open loop Input, output and the input of closed loop feedback system, output interface of system) indirect operation is carried out, real-time recording-member inputs, is defeated Latest value out, so that it may which indirectly-acting realizes test input, output data in the true input of tested software, output interface Between strict time synchronization, realize test result record and preserving module 16 versatility and its with tested software component outer Interface it is decoupling.Each software component test record special container format is as shown in Figure 6.It was initialized in software test platform Cheng Zhong, the input of each component, output interface with polymorphic type container type corresponding in unit test application specific architecture body input, Output pointer static association;During the test, as soon as each unit under test completes wheel scheduling execution, which is participated in calculating All tests input current value and calculate generate test output together, by polymorphic type container type input, output pointer, move The state ground correct data type of Auto-matching is cached in the correct component of test output polymorphic type container type buffer area, works as survey All test input processings in example text this document on probation finish, and save in test result file to property again, solve survey Just whether the stringent synchronization problem between examination input and output, directly judge test execution result will pass through test result file Really, test leakage phenomenon caused by reducing because of test result interpretation inaccuracy.
Test result record and preserving module 16 are used for from test result output buffer read test as a result, and to test As a result it is recorded and is saved.
Input module 11, first interface relating module 12, software component AM access module 13, survey in software test platform 10 Examination executes control module 14, second interface relating module 15 and test result record and this six modules of preserving module 16 and initial The relationship for changing mould group and means schedule timing general controls mould group is as shown in Figure 7.Specifically, 1) initialization mould group is variable mould Group is used for configuration platform external interface comprising first interface relating module 12, software component AM access module 13 and second interface These three modules of relating module 15;2) means schedule timing general controls mould group is fixed module, with tested software component it Between without coupling, can be from a software test platform integral transplanting to another software test platform comprising input module 11, survey Examination executes control module 14 and test result record and these three modules of preserving module 16.
To sum up, for the versatility of support part scheduling timing general controls mould group, the present invention is relative to existing software Test platform has made following optimization design:
1) input module 11 increases the support to test input mixed data type, is different data class in use-case file The test and excitation Dynamic Matching of type formats the identical storage component of type in input character string and test input block.
2) existing test execution control (access containing software component) module is split into software component AM access module 13 With 14 two modules of test execution control module.In order to cooperate the generalization of test execution control module 14, test execution control " the tested software unit container " that module 14 is defined the operation that software component carries out by platform is taken over, independent of specific soft Part component realizes decoupling between test execution control module 14 and tested software component object.With different cycles tune " access of software component " that degree executes is individually positioned in the preset difference of software test platform " tested software unit container ", Corresponding to one " tested software unit container " every kind of dispatching cycle, (software test platform, which is established in the form of function pointer with container, to close Connection), effective number of " tested software unit container " depends on the total number of software component dispatching cycle, " tested software component The number and storage location of container " are configurable as a part of platform interface.
3) in order to realize test result record and preserving module generalization, increase second interface relating module 15, In the newly-increased module, dedicated input, output interface " container ", the size of container are assigned with for each tested software component The number of output interface (input) and its static binding during initialization is associated with input, output interface.Therefore, exist In test result record and preserving module 16, it is only necessary to be operated to the input of each component, output interface " container ", so that it may Indirectly-acting realizes the versatility of test result record and preserving module 16 in the true input of tested software, output interface And its it is decoupling with tested software component outer interface.
Mould group and means schedule timing general controls are initialized from the definition of use-case file format, software test platform below The relationship of mould group and respective composition, the design flow diagram of each main modular are described in detail.
1. all test inputs are pre-stored in use-case text file:
A) the rectangle like matrix that text file is formed by multirow, multi-column data forms, and is divided into data injection rhythm control Area 21, data memonic symbol area 22, dtd--data type definition area 23 and use-case input data definition 24 4 are most of, as shown in Figure 8.
I. between every row difference test data with specified single fixed character (as ", ", " ", ";" etc.) be separated, phase Belong to same row with the ipsilateral data of separator serial number, each column represents fully entering for specified interface test data, every row, each column Data amount check difference it is equal;
Ii. file first trip content is meaningless, is the memonic symbol that tester defines for all test datas, use-case is facilitated to set Timing is the correct assignment of each column data;
Iii. all test datas of the second behavior of file define standard data type (such as word to match with input interface Symbol type, integer, long, short, floating type, type double precision etc.), the data type that different lines test data represents is mutual It is independent;Dynamically Auto-matching correct data type when software test platform parses use-case file, which is kept in In the correct component of polymorphic type container type input data buffer area.This is one of innovative point of the invention, realizes mixed type The injection of test data.
It is whole such as " %c " of character type in C language in order to match the formatting input and output character string of different types of data " %d " of type, " %ld " of long, " %hd " of short, " %f " of floating type, " %lf " of double, definition is such as Lower data type inputs to assist Dynamic Matching and parsing to test according to correct data type:
According to the literary style of C language, polymorphic type container type buffer area component be can refer to as given a definition:
According to the definition of component data type, polymorphic type container type buffer definitions are as follows:
MixType ReadInput[MAXFILELINE][TESTCASE_INPUTNUM];
Wherein MAXFILELINE represents the maximum number of lines of use-case file, and TESTCASE_INPUTNUM represents use-case file Columns, this two parameters are configurable.
Iv. since the third line, every a line test data represents the primary complete refreshing to all input interfaces;
V. different software test platform is corresponding with total columns of the form matches difference use-case text file of configurable parameter The summation (containing the internal interface between different components) of all component input interfaces plus 1, in addition to first, the row number of each column exists Software test platform initializes component input interface static binding in mould group and specified.
B) timing node of input data variation is determined by first " timing rhythm control numerical value ", timing rhythm control numerical value Without fixed dimension, the time that practical dimension is refreshed by input interfaces such as tested software signal sampling period, bus communication periods Performance determines;For versatility, the dimension unified definition of timing rhythm control numerical value is all components by software test platform 10 The common divisor of dispatching cycle, and tester's modification is supplied in the form of platform exterior interface.
2. software test platform is divided into means schedule timing general controls mould group and initialization mould group two parts.Means schedule Timing general controls mould group is basis and core of the invention, can directly apply to multiple and different software components without change and survey Try the building of platform;Initialize mould group be used for configuration platform external interface, by use-case file input data (buffer area) with Software component outer input interface is associated, and the input of each component, output interface and test result output buffer are carried out Association, while calling each software component initialization module, it is ensured that each component is in determining state before execution unit is tested.Initially Change the relationship of mould group and means schedule timing general controls mould group and respectively composition is as shown in Figure 9.
Specifically, initialization mould group is by means initialization 31, input and output association initialization 32 and platform initialization 33 Three parts function composition.32 and platform initialization are initialized the following detailed description of realizing that means initialization 31, input and output are associated with The specific steps of 33 this three parts function:
(1) tested software means initialization module (means initialization 31) is called first.
(2) it then inputted, export association initialization, i.e., the input of each software component, output interface are soft with this Corresponding polymorphic type container type input, output pointer quiescent state establishment association (input and output pass in part unit test application specific architecture body Connection initialization is 32).Referring to FIG. 10, may include: in input and output association initialization 32
Step 32a: the input of polymorphic type container type, data output buffer area array are defined;
Step 32b: definition component Array for structural body, one-component of each component as array, and to representing each portion The Array for structural body component of part is initialized.The initialization step may include: 1) to distribute globally unique number for component; 2) set parts outer input data number;3) each component of set parts input structure body array is directed toward and corresponds to as pointer Input interface variable;4) set parts external data output number;5) each component of set parts export structure body array is made For pointer, it is directed toward corresponding output interface variable.
(3) test platform initialization is finally carried out, including the data elements such as the correlated variables executed to process control and array Element is initialized (platform initialization 33).The part, which is essentially consisted in, classifies all components by dispatching cycle, is every base part Dispatching cycle creates a processing function, which calls all components of corresponding dispatching cycle as container;By all portions Processing part dispatching cycle function assignment gives means schedule dedicated array of function pointer: void (* FuncPtrPeriod [NUMOFPARTS]) (void), wherein NUMOFPARTS represents the sum of all components, each component of the array of function pointer It is directed toward a means schedule period treatment function.Figure 11 is please referred to, may include: in platform initialization 33
Step 33a: initialization program cycle count cnt is 0;It is 0 that initialisation unit scheduling, which counts tskCnt,;When initialization Each component of sequence beat array timeSec [] is 0;Initializing case data total number line is 0.
Step 33b: all components being classified by dispatching cycle, create a processing function for every base part dispatching cycle, The function calls all components of corresponding dispatching cycle as container.In one embodiment, when each software component is packed, first Judge whether it is current test object, if so, calling first interface relating module 12 before the software component executes, passes through The input interface for entering data to keep or refresh the software component in test case;If it is not, the software portion that then be used directly The possibility of the relevant component of part exports or static initial value keeps or refresh the input interface of the software component.
Step 33c: give means schedule dedicated array of function pointer all means schedule period treatment function assignments: void(*FuncPtrPeriod[NUMOFPARTS])(void)。
Step 33d:1) it prompts and receives terminal input component to be tested;2) it prompts and receives terminal input test example text Part name.
Step 33e:1) input module 11 is called, test input is saved in polymorphic type container type input data buffer area; 2) from the timing control numerical value taken out in use-case in above-mentioned input data buffer area, and use first group of data as test and excitation.
During platform initialization, needing to call input module 11 as to the mixed type data input in use-case file It is parsed, and is the type that each column test data defines, Dynamic Matching file input formats appropriate according to use-case file Character string, and it is correctly stored in polymorphic type container type input data buffer area ReadInput [MAXFILELINE] In correct component in [TESTCASE_INPUTNUM].Figure 12 is please referred to, implementation process is as follows:
Step 33e1: defining and opens the file pointer fileInput for being directed toward use-case file.
Step 33e2: judge that use-case file whether there is, and if it exists, then follow the steps 33e3;If it does not exist, then terminate to hold Row.
Step 33e3:1) obtain file size inputfilestreamlen;2) file first trip is read, use-case file is obtained Each column data title;3) the second row of file is read, each column data type of use-case file is obtained, it is each for the use-case file of input Row data are arranged correct data type formatization and input character, and are stored in TestInputMode array;4) it is opened from the third line The circulation that begins reads the specific data in use-case file, and the data in use-case file are parsed according to correct type, and deposits Store up ReadInput [maximum number of lines] [maximum number of column] in polymorphic type container type input data buffer area.
Step 33e4: file pointer fileInput is closed.
Means schedule timing general controls mould group is by use-case injection rhythm control 34, timesharing sequence scheduler and input and output Synchronization caching 35, test result automatically save 36 and automatic cycle execution control 37 4 partial functions composition.The following detailed description of Realize that use-case injection rhythm control 34, timesharing sequence scheduler and input and output synchronization caching 35, test result automatically save 36 The specific steps of 37 this four partial function of control are executed with automatic cycle:
(4) during the test, the beat injected to use-case is needed to be controlled (use-case injects rhythm control 34).Due to The dimension of timing rhythm control numerical value is defined as the common divisor of all means schedule timing, therefore with " timing beat array Index Common divisor COMMONDIVISOR " and present procedure cycle count the cnt value of all means schedule timing of the value * of component whether phase Deng as whether refreshing the criterion of input data.Using new value when timing rhythm control numerical value reaches refresh node;Otherwise it keeps Preceding value.Figure 13 is please referred to, use-case injection rhythm control 34 may include:
Step 34a: case data index index is initialized as 1.
Step 34b: judging whether index is less than case data total number Line, if so, thening follow the steps 34c;If it is not, It then jumps to test result and automatically saves 36.
Step 34c: judge the common divisor of all means schedule timing of value * of timing beat array Index component Whether COMMONDIVISOR is equal to program cycle count cnt, if so, thening follow the steps 34d;If it is not, then terminating to execute.
Step 34d:1) use component index for the case data of index;2) index adds 1.
(5) the scheduling sequential relationship being tested between component passes through timesharing sequence scheduler and input and output synchronization caching mould Block is controlled (timesharing sequence scheduler and input and output synchronization caching 35).With the least common multiple in each means schedule period MINMULTIPLE is fully completed the benchmark of round-robin scheduling as all components;The period of the management and running each time of the module, etc. Valence is equal in the common divisor of all component cycles of operation, the time dimension represented with timing rhythm control numerical value in use-case file. The criterion of execution whether is dispatched using the ratio of the dispatching cycle of module execution counting tskCnt and each component i as judgement part. In current dispatching cycle, if the scheduled component executed is precisely the software component of current tested, test result is called Module is automatically saved, the current value of the component input/output interface is appended in test result output buffer.Please refer to figure 14, timesharing sequence scheduler and input and output synchronization caching 35 may include:
Step 35a: judge that scheduling counts the least common multiple whether tskCnt is less than all means schedule periods MINMULTIPLE, if so, thening follow the steps 35b;If it is not, thening follow the steps 35c.
Step 35b: scheduling is counted into tskCnt and is set as 0, then executes step 35d.
Step 35c: tskCnt is counted to scheduling and is executed from add operation, step 35d is then executed.
Step 35d: judging whether current part number i is less than total number of parts NUMOFPARTS, if so, thening follow the steps 35e;If it is not, then terminating to execute.
Step 35e: judge tskCnt whether the integral multiple of current part i dispatching cycle, if so, thening follow the steps 35f;If It is no, then follow the steps 35h.
Step 35f: current part i scheduling executes.
Step 35g: judging whether current part i is test component, if so, jumping to test result automatically saves 36, And test result automatically save 36 be finished after jump back to step 35h;If it is not, thening follow the steps 35h.
Step 35h: unit number i adds 1, and the 35d that gos to step.
(6) 36 are automatically saved using test result, is executed as soon as each unit under test completes wheel scheduling, which is participated in All tests input current value calculated exports together with the test generated is calculated, and is referred to by the input of polymorphic type container type, output Needle, dynamically the correct data type of Auto-matching, determines that it formats input and output character string (" %c ", " %d ", " %f " Deng), and be cached in the correct component of test output polymorphic type container type buffer area, when all in test case text file Test input processing finishes, and is saved in test result file to property again.In this way, solving between test input and output Stringent synchronization problem, directly judge whether test execution correct, reduces because of test result will pass through test result file Test leakage phenomenon caused by interpretation inaccuracy.Figure 15 is please referred to, test result automatically saves 36 and may include:
Step 36a:1) according to unit under test number setting destination file store path, it defines and tests in conjunction with use-case filename Destination file name;2) it defines and opens the file pointer fid for being directed toward test result file.
Step 36b: judging result file whether there is, and if it exists, then follow the steps 36c;If it does not exist, then terminate to hold Row.
Step 36c: set parts test input i, output j are from component input, output data structure body array of pointers Component.
Step 36d: input, output data number m, n are obtained.
Step 36e: according to data type (character type, integer, floating-point of a input (output) array component of i-th < m (j < n) Type etc.) number, determine that it formats input and output character string (" %c ", " %d ", " %f " etc.) and corresponding data output buffer The appropriate type of the container type storage component MixType of area testOutput testData [TSTBUFLEN] simultaneously will be corresponding defeated Enter in output data write-in test result file.
Step 36f: file pointer fileInput is closed.
(7) when all input datas of test case file are disposed, pass through automatic cycle and execute control 37 and test Personnel interact, and determination, which logs off and (terminates test), still continues to execute new unit test.If continuing to execute survey Examination then re-executes means initialization automatically, repeats above procedure.Figure 16 is please referred to, automatic cycle executes control 37 and can wrap It includes:
Step 37a: correlated variables is reinitialized.
Step 37b: the information terminated is executed to terminal output test case, and prompts to choose whether to continue to execute test.
Step 37c: judging whether to continue to execute, if it is not, thening follow the steps 37d;If so, thening follow the steps 37e.
Step 37d: it logs off.
Step 37e: platform initialization is re-executed.
Based on software test platform 10 disclosed above, the invention also provides a kind of method for testing software.Please refer to figure 17, method for testing software 40 includes:
Step 41: test case being injected by test case file, and the test case is parsed and cached.
Step 42: the input data in the test case is established into static association with tested software component input interface.
Step 43: the tested software component being packaged using predefined tested software unit container.
Step 44: executing to control test period property.
Step 45: the input of tested software component, output interface are passed through into data pointer and test result output buffer Static association is carried out, and test result is stored to the test result output buffer.
Step 46: from the output buffer read test as a result, and the test result being recorded and being saved.
It in one embodiment, may include the multiple standard data type marks arranged with row or column in test case file Know, and identifies the corresponding input data arranged with row or column with multiple data types.Step 41 may include following son Step:
Step 41a: input data is read in a manner of row or column.
Step 41b: according to the data class of the corresponding standard data type identification (RNC-ID) analytic input data of each input data Type.
Step 41c: by the storage point of type compatibility in input data caching at most type of container formula input data buffer area In amount.
At step 43, it preferably includes the tested software component of different dispatching cycles is encapsulated into different tested softwares Unit container.Preferably, tested software test container is array of function pointer.
It in one embodiment, can also include distributing dedicated input, output for each tested software component in step 45 Interface container, input, output interface container include data pointer.It in another embodiment, can also include when every in step 45 When a tested software component is completed a wheel scheduling and is executed, by tested software component participate in all tests calculated input current value with Calculate the test output generated together, by data pointer, dynamically the correct data type of Auto-matching, is cached to test knot In the correct component of fruit output buffer.
It in step 46, may include when all testing cases in test case file finish, disposably Ground is from output buffer read test as a result, and test result being recorded and being saved.
Some details of above-mentioned test method can refer to the description of aforementioned software test platform, not reinflated herein to retouch It states.
The method for testing software of one embodiment of the invention can be implemented in computer systems.Such as computer system can wrap Memory, the computer instruction of processor and storage on a memory are included, processor implements this hair when executing the computer instruction Bright described method.
Although the present invention is described with reference to current specific embodiment, those of ordinary skill in the art It should be appreciated that above embodiment is intended merely to illustrate the present invention, can also be done in the case where no disengaging spirit of that invention Various equivalent change or replacement out, therefore, as long as to the variation of above-described embodiment, change in spirit of the invention Type will all be fallen in the range of following claims.

Claims (10)

1. a kind of method for testing software comprising:
A. test case is injected by test case file, and the test case is parsed and cached;
B. the input data in the test case is established into static association with tested software component input interface;
C. the tested software component is packaged using predefined tested software unit container;
D. it executes with controlling test period property;
E. the input of tested software component, output interface are subjected to static pass by data pointer and test result output buffer Connection, and test result is stored to the test result output buffer;And
F. from the output buffer read test as a result, and the test result being recorded and being saved.
2. according to the method described in claim 1, it is characterized by: including being arranged with row or column in the test case file Multiple standard data type marks, and the corresponding input arranged with row or column is identified with the multiple data type Data.
3. according to the method described in claim 2, it is characterized by: including: in step a
A1. the input data is read in a manner of row or column;
A2. the data type of the input data according to each input data corresponding standard data type identification (RNC-ID) analytic;With And
A3. the input data is cached at most type of container formula input data buffer area in the storage component of type compatibility.
4. according to the method described in claim 1, it is characterized by: the tested software unit container is array of function pointer.
5. according to the method described in claim 1, it is characterized by: step c include by different dispatching cycles it is described be tested it is soft Part component is encapsulated into different tested software unit containers.
6. according to the method described in claim 1, it is characterized by: step e includes being that the distribution of each tested software component is dedicated Input, output interface container, it is described input, output interface container include the data pointer.
7. according to the method described in claim 1, it is characterized by: step e includes: when each tested software component is completed When one wheel scheduling executes, the tested software component is participated in into all tests calculated input current value and calculates the test generated Together, by the data pointer, dynamically the correct data type of Auto-matching, is cached to the test result output for output In the correct component of buffer area.
8. according to the method described in claim 1, it is characterized by: step f includes: when all in the test case file Testing case when finishing, disposably from the output buffer read test as a result, and being tied to the test Fruit is recorded and is saved.
9. a kind of software test platform comprising:
Input module for injecting test case by test case file, and is parsed and is cached to the test case;
First interface relating module, for establishing the input data in the test case with tested software component input interface Static association;
Software component AM access module, for being sealed using predefined tested software unit container to the tested software component Dress;
Test execution control module, for executing with controlling test period property;
Second interface relating module, for the input of tested software component, output interface to be passed through data pointer and test result Output buffer carries out static association, and test result is stored to the test result output buffer;And
Test result record and preserving module, for from the output buffer read test as a result, and to the test result It is recorded and is saved.
10. platform according to claim 9, it is characterised in that: the test execution control module includes timing beat control Numerical value processed, the timing rhythm control numerical value are the common divisor in all tested software means schedule periods.
CN201710525788.1A 2017-06-30 2017-06-30 Software testing method and platform thereof Active CN109213671B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710525788.1A CN109213671B (en) 2017-06-30 2017-06-30 Software testing method and platform thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710525788.1A CN109213671B (en) 2017-06-30 2017-06-30 Software testing method and platform thereof

Publications (2)

Publication Number Publication Date
CN109213671A true CN109213671A (en) 2019-01-15
CN109213671B CN109213671B (en) 2021-08-03

Family

ID=64961313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710525788.1A Active CN109213671B (en) 2017-06-30 2017-06-30 Software testing method and platform thereof

Country Status (1)

Country Link
CN (1) CN109213671B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990252A (en) * 2019-10-22 2020-04-10 北京计算机技术及应用研究所 Method for testing quality and efficiency of embedded flight control software
CN112650556A (en) * 2020-12-25 2021-04-13 芜湖雄狮汽车科技有限公司 Multitask concurrent testing method and device for vehicle
CN113360363A (en) * 2020-03-04 2021-09-07 腾讯科技(深圳)有限公司 Test method, device, equipment and computer storage medium for micro service system
CN114625359A (en) * 2022-05-16 2022-06-14 西安数道航空技术有限公司 Multi-machine no-coupling digital development platform connected through synchronous concurrent network

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010052089A1 (en) * 2000-04-27 2001-12-13 Microsoft Corporation Automated testing
CN101212357A (en) * 2006-12-31 2008-07-02 亿阳信通股份有限公司 Interface testing method and device
CN102033806A (en) * 2010-12-14 2011-04-27 北京航空航天大学 Method for generating reliability test data of real time embedded software
CN102243608A (en) * 2010-05-13 2011-11-16 方兴 Software security test method based on global data structure description
CN104182335A (en) * 2014-05-09 2014-12-03 中国光大银行 Software testing method and device
CN104239070A (en) * 2014-10-11 2014-12-24 浪潮电子信息产业股份有限公司 Software development method based on living documentation
CN104268073A (en) * 2014-09-05 2015-01-07 北京广利核系统工程有限公司 Method for generating test cases in batch mode
CN104298592A (en) * 2014-09-09 2015-01-21 南京国电南自电网自动化有限公司 Object-oriented relay protection test case template instantiation method
CN104407971A (en) * 2014-11-18 2015-03-11 中国电子科技集团公司第十研究所 Method for automatically testing embedded software
CN105260191A (en) * 2015-11-03 2016-01-20 中国电子科技集团公司第四十一研究所 Configuration-based test program and operator interface data interaction method
US20160140026A1 (en) * 2014-11-14 2016-05-19 Mastercard International Incorporated Systems and Methods for Selection of Test Cases for Payment Terminals
CN105630685A (en) * 2016-01-29 2016-06-01 广州酷狗计算机科技有限公司 Method and device for testing program interface
US20160342501A1 (en) * 2015-05-18 2016-11-24 Hcl Technologies Limited Accelerating Automated Testing
CN106528418A (en) * 2016-10-28 2017-03-22 广东浪潮大数据研究有限公司 Test method and device
CN106528395A (en) * 2015-09-09 2017-03-22 阿里巴巴集团控股有限公司 Test case generation method and apparatus
CN106557412A (en) * 2015-09-25 2017-04-05 腾讯科技(深圳)有限公司 A kind of method and device of fuzz testing

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010052089A1 (en) * 2000-04-27 2001-12-13 Microsoft Corporation Automated testing
CN101212357A (en) * 2006-12-31 2008-07-02 亿阳信通股份有限公司 Interface testing method and device
CN102243608A (en) * 2010-05-13 2011-11-16 方兴 Software security test method based on global data structure description
CN102033806A (en) * 2010-12-14 2011-04-27 北京航空航天大学 Method for generating reliability test data of real time embedded software
CN104182335A (en) * 2014-05-09 2014-12-03 中国光大银行 Software testing method and device
CN104268073A (en) * 2014-09-05 2015-01-07 北京广利核系统工程有限公司 Method for generating test cases in batch mode
CN104298592A (en) * 2014-09-09 2015-01-21 南京国电南自电网自动化有限公司 Object-oriented relay protection test case template instantiation method
CN104239070A (en) * 2014-10-11 2014-12-24 浪潮电子信息产业股份有限公司 Software development method based on living documentation
US20160140026A1 (en) * 2014-11-14 2016-05-19 Mastercard International Incorporated Systems and Methods for Selection of Test Cases for Payment Terminals
CN104407971A (en) * 2014-11-18 2015-03-11 中国电子科技集团公司第十研究所 Method for automatically testing embedded software
US20160342501A1 (en) * 2015-05-18 2016-11-24 Hcl Technologies Limited Accelerating Automated Testing
CN106528395A (en) * 2015-09-09 2017-03-22 阿里巴巴集团控股有限公司 Test case generation method and apparatus
CN106557412A (en) * 2015-09-25 2017-04-05 腾讯科技(深圳)有限公司 A kind of method and device of fuzz testing
CN105260191A (en) * 2015-11-03 2016-01-20 中国电子科技集团公司第四十一研究所 Configuration-based test program and operator interface data interaction method
CN105630685A (en) * 2016-01-29 2016-06-01 广州酷狗计算机科技有限公司 Method and device for testing program interface
CN106528418A (en) * 2016-10-28 2017-03-22 广东浪潮大数据研究有限公司 Test method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ZHENG WANG: "Test Data Generation for Derived Types in C Program", 《 2009 THIRD IEEE INTERNATIONAL SYMPOSIUM ON THEORETICAL ASPECTS OF SOFTWARE ENGINEERING》 *
袁宁翔: "基于微软Coded UI技术的自动化测试系统的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990252A (en) * 2019-10-22 2020-04-10 北京计算机技术及应用研究所 Method for testing quality and efficiency of embedded flight control software
CN113360363A (en) * 2020-03-04 2021-09-07 腾讯科技(深圳)有限公司 Test method, device, equipment and computer storage medium for micro service system
CN113360363B (en) * 2020-03-04 2024-04-02 腾讯科技(深圳)有限公司 Method, device, equipment and computer storage medium for testing micro service system
CN112650556A (en) * 2020-12-25 2021-04-13 芜湖雄狮汽车科技有限公司 Multitask concurrent testing method and device for vehicle
CN114625359A (en) * 2022-05-16 2022-06-14 西安数道航空技术有限公司 Multi-machine no-coupling digital development platform connected through synchronous concurrent network
CN114625359B (en) * 2022-05-16 2022-08-05 西安数道航空技术有限公司 Multi-machine no-coupling digital development platform connected through synchronous concurrent network

Also Published As

Publication number Publication date
CN109213671B (en) 2021-08-03

Similar Documents

Publication Publication Date Title
CN109213671A (en) Method for testing software and its platform
CN104965750B (en) Rapidio switch logical simulation verification platforms and method based on Python
CN101814039B (en) GPU-based Cache simulator and spatial parallel acceleration simulation method thereof
CN109643273A (en) The program tracking debugged and analyzed for time travel
CN102521123B (en) A kind of embedded software test pile pitching method of logic-based execution block
CN107273286A (en) For the scene automatic test platform and method of task application
CN106326107B (en) Non-intrusion type embedded software abnormal based on simulated environment handles verification method
CN103955398B (en) Virtual machine coexisting scheduling method based on processor performance monitoring
CN107807878A (en) Automatic test engine based on keyword
CN102902834A (en) Verification method and verification system of SOC (System on Chip)
CN108491319A (en) Web automated testing methods and system based on this method
CN104573287B (en) The Digital Simulation frame design method of unified model is bound based on interface
CN110187988A (en) Static function calling figure construction method suitable for Virtual Function and function pointer
CN105302115B (en) Train network application layer control software automated testing method
CN106295809B (en) The embedded real-time diagnosis reasoning algorithm pilot system of aircraft
CN110083535A (en) A kind of method for testing software and device
CN106528425A (en) Platform plug-in automatically testing method for microprocessor
CN108985459A (en) The method and apparatus of training pattern
CN109542731B (en) A kind of performance monitoring method of the progressive lower brill of level towards GPU
CN108897686A (en) It is complete to record separately automated testing method and device
Cuomo et al. Process-oriented Discrete-event Simulation in Java with Continuations-Quantitative Performance Evaluation.
CN106295808B (en) The embedded real-time diagnosis reasoning algorithm test method of aircraft
CN109932588A (en) A kind of Aerial Electronic Equipment validation test engine
CN109871237A (en) A kind of CPU based on machine learning and GPU isomery SoC performance depicting method
CN107656738A (en) Model structural design method and device in a kind of Android

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