Movatterモバイル変換


[0]ホーム

URL:


CN103995781B - A kind of component testing case generation method based on model - Google Patents

A kind of component testing case generation method based on model
Download PDF

Info

Publication number
CN103995781B
CN103995781BCN201410252163.9ACN201410252163ACN103995781BCN 103995781 BCN103995781 BCN 103995781BCN 201410252163 ACN201410252163 ACN 201410252163ACN 103995781 BCN103995781 BCN 103995781B
Authority
CN
China
Prior art keywords
platform
data object
node
data
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410252163.9A
Other languages
Chinese (zh)
Other versions
CN103995781A (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.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software 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 Inspur General Software Co LtdfiledCriticalInspur General Software Co Ltd
Priority to CN201410252163.9ApriorityCriticalpatent/CN103995781B/en
Publication of CN103995781ApublicationCriticalpatent/CN103995781A/en
Application grantedgrantedCritical
Publication of CN103995781BpublicationCriticalpatent/CN103995781B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

The invention discloses a kind of component testing case generation method based on model, it is adaptable to the generation of member unit, regression test case on the basis of designing a model, belongs to software testing technology field.This method mainly includes:1) the member function logical sum data object description based on XML;2) the platform independent form of data object is created to the mapping table of platform correlation form;3) completed based on mapping table from the unrelated test case of platform to the automatic conversion and generating process of platform dependence test use-case.Compared with prior art, the method of the present invention with data object map based on designing a model by realizing Test cases technology, improve the tracking of test case " on demand " generating process, backdating capability in software test, and the automaticity of Test cases technology process, reach and improve the purpose that ability that software requirement frequently changes and efficiency are flexibly tackled in software test, with good application value.

Description

A kind of component testing case generation method based on model
Technical field
The present invention relates to software testing technology field, specifically a kind of component based on model(Unit)Test caseGeneration method.
Background technology
In recent ten years, software size constantly expands, and the complexity of software is continuously increased, the Application development environ-ment of software,Development scheme etc. is all widely used in change such as component technology.Under the overall background of this " change ", user is for software matterThe requirement of amount is also being improved.Therefore, as a kind of effective means for improving software quality, software testing technology is also required to adapt to simultaneouslyContinue to develop.Statistics shows:In software test expense, about 40% puts into test data, including test case generation andThe inspection of test result.In addition, the automaticity of test process also has direct influence for the efficiency of the practice of test.
With modeling technique(Especially UML)Application it is ripe, model-based testing turns into extensively should in practiceA kind of method.Here " model " can be the test model for designing a model or specially creating.In this methodIn, the description information based on model(Generally include workflow and traffic flow information)Test case data is produced, and by performingTest case is to check/assess test result to find potential trouble point in software.
Test cases technology is the basis of Experience of Software Testing Work, and no matter which kind of method of testing is directed to this problem.At present,Although existing many kinds method for generating test case, they still have very big distance apart from practical application.This is also current systemOne of principal element that about software testing technology develops.And in the world in some advanced Software Testing Tools, generally all avoidTest data auto generation problem, or a kind of automanual Test cases technology mode is at most provided.Therefore, both at home and abroad fromIn the enterprise of thing software test, mostly using artificial or computer-assisted way generation test case, their shortcoming is:
(1) Test cases technology needs to spend a large amount of expenses(Personnel, time etc.), and automaticity and efficiency are low;
(2) change of software logic can not be directly reflected into the renewal of test use cases, realize " on demand " safeguard intoThis height;
(3) although some Core Generators have reached a certain degree of automation, but realize excessively complexity, for userProfessional technique require it is higher.
In recent decades, as software quality problem becomes increasingly conspicuous, software test and the cost more and more higher safeguarded, workAmount is also increasing.Statistics shows that at home and abroad, test substantially achieves the 50% of software development total cost, sometimes even highUp to more than 80%, and wherein quite a few is an artificially generated the expense with maintenance work.
Test data auto generation is always one of target that software testing technology is pursued.Although domestic and international many sectionsScholar pays very big effort for this, still, and correlative study achievement is to smoothly practical application can also having relatively large distance.SeparatelyOutside, with the development of component technology, if it is possible to which the change " on demand " for component version generates test case, for improving structurePart regression test efficiency, quality of the software systems of Component- Based Development etc. all have highly important theoretical and realistic meaning.
The content of the invention
The technical assignment of the present invention is that there is provided a kind of component testing use based on model for above-mentioned the deficiencies in the prior artExample generation method.This method can carry out semantic automatic point according to given Software Design Model for the expression of its function logicAnalysis, and satisfactory test case set is generated by the model conversion method of data object, improve in software test and testThe tracking of use-case " on demand " generating process, backdating capability, can increase substantially the efficiency and automaticity of Test cases technology.
The invention is intended to by realizing Test cases technology with data object map based on designing a model,
The technical assignment of the present invention is realized in the following manner:A kind of component testing use-case generation side based on modelMethod, is characterized in comprising the following steps:
Step one:Designed a model according to selected UML, establishment can describe member function logic(Workflow)XML textShelves;
Step 2:In analysis workflow the status data that includes and its comprising data object, create data object semanticTable is described, the unrelated semantic feature of platform of data object is determined;
Step 3:According to the target platform of determination, the grammer for the data object analyzed and clearly bound with target platform is specialLevy, semantic span and constraint;The unrelated data object value mapping table related to platform of platform is created on this basis;
Step 4:The XML document of traversal description member function logic, automatically generates the workflow of counterpart member function logicSet;
Step 5:Based on the data object semantic description table created in step 2, change and generated in spread step fourWorkflow set, the unrelated test case set of generating platform;
Step 6:Based on the unrelated data object value mapping table related to platform of the platform created in step 3, forThe unrelated test case set of platform generated in step 5 carries out the conversion of data object, generates the test related to target platformUse-case set.
Preferably, step one, based on the uml diagram created, the XML description texts of manual creation reflection member function logicShelves:
When creating XML documents, according to each single item workflow in correspondence uml diagram, entered using semantic clearly XML tagRow translation and description:Using the respective element in predefined tag element descriptive model, including start node, end node,Intermediate node, branch node, cyclic node, aggregation node and parallel node, and recorded by Label_Config documentsAnd semantic annotations.
The tag element can be by user's self-defining and extension.
The component design model can be that third party creates, or the self-designed uml diagram of user, to clearGround describes the function logic of some section of component --- the different uml diagram of correspondence.
Step 2, each single item workflow in uml diagram clearly marks the state that each node is includedData, and the semantic description table NodeDescribeTable of manual creation data object:
The Expressive Features of the node state data include:State before node NodeNo, executionStatesBeforeExecution, input data set InputData and anticipated output data set ExpectOutputData;
Based on the Expressive Features of node state data, the set of data objects included in each status data is determinedDataObjectSet, wherein, each data object DataObject Expressive Features are:Data object nameObjectName, characteristic attribute set ObjectAttributes.
Obtained set of data objects is analyzed in step 3, object-oriented platform and step 2, the data pair based on determinationAs codomain and about beam analysis and the specific mapping state values of data object under target platform are automatically generated, and created on this basisData object is built by the unrelated value mapping table PItoPSMapTable related to platform of platform:
Wherein, the platform association attributes feature of data object includes:Parameter list paraList, parameter value domainValueDomain, state valid data state(Including bool types, true:Valid data;false:Invalid data), lead toCross the codomain of data object and about beam analysis, the corresponding mapping object of generation, and record its abnormal value set under target platformWith normal value set.
Step 4, program pass describes the XML document of member function logic, the corresponding test path set of generation workflowTestPaths, its basic implementation procedure is:
(1)Start node set Starts non-NULLs, then obtain a start node, and the method traveled through according to level obtains itChild nodes, and the start node is generated to the set of paths of child nodes;
(2)If a child nodes are end nodes, turn to(5);If the non-end node of child nodes, Ze Gai roadsFootpath out to be temporarily stored in Temps set;Until all child nodes of current start node are disposed;
(3)If temporary path set Temps is not sky, each temporary path in gathering Temps obtains its periproctThe child nodes of point, are then turned to(2);Otherwise, under steering(4);
(4)The workflow traversal that current start node starts is finished, if start node combination Starts is sky, is turned toUnder(5), otherwise, in steering(1), continue executing with;
(5)Respective path deposit TestPaths set, that is, generate test path set TestPaths.
Step 5, table is described based on the data object created in step 2(Including perform before state, input data set andAnticipated output data acquisition system), each executable path in test path set TestPaths is changed and extended,The unrelated test case set PiTestCases of generating platform, basic implementation procedure is as follows:
(1)If test path set TestPaths non-NULLs, an executable path is obtained;
(2)Obtain the node semantics created in the start node in current executable path, query steps two and describe tableNodeDescribeTable, with its corresponding status data Expressive Features(State before including performing, input data set and pre-Phase output data set)Replace the node;
(3)Order obtains the node semantics created in the next node in path, query steps two and describes tableNodeDescribeTable, with its corresponding status data Expressive Features(State before including performing, input data set and pre-Phase output data set)Replace the node;
Repeat(3), subsequent node is continued with, until all subsequent nodes are disposed, and the test of conversion generationUse-case deposit set PITestCases;
Repeat(1)-(3), until all paths are finished by conversion process in test path set TestPaths, andUltimately generate platform-independent test case set PITestCases.
Step 6, based on the unrelated data object value mapping table related to platform of the platform created in step 3PItoPSMapTable, the platform-independent test case set PITestCases generated successively in process step five, passes through numberAccording to the related test case set PSTestCases of transfer process automatic Generation Platform, basic implementation procedure is as follows:
(1)If set PITestCases non-NULLs, obtain under the unrelated test case PiTC of a platform, and steering(2);Otherwise, it is disposed;
(2)Obtain the unrelated number related to platform of the platform created in the first data object in PiTC, query steps threeAccording to object value mapping table PItoPSMapTable, with its corresponding platform relevant state data Expressive Features(State, defeated before performingEnter data acquisition system and anticipated output data acquisition system)The data object in PiTC is replaced,
(2)Step, which can be refined, to be described as:
A)Obtain first data object in PiTC;If without data object to be processed, turned to(3);
B)PItoPSMapTable is inquired about, its normal value set and abnormal value set is obtained, recording exceptional value number NUM,Normal value number only remembers 1;
C)NUM+1 PiTC backup is replicated, replaces first in NUM backup PiTC respectively with NUM abnormal Value DataData object, and NUM test case PiTC ' deposit set PSTestCases after replacing;
D)Normal value is randomly choosed from normal value set and replaces a backup PiTC, and this replace after test useExample PiTC ' out to be temporarily stored in PsTemp set;
E)Appoint from PsTemp and take a PiTC ', if getting next data object, PiTC ' replaces currentPiTC, and turn to A);If PsTemp is sky, turn to(3);
(3)Turn to(1), continue with next PiTC;
Repeat(1)-(3), finished until the unrelated test case of all platforms is processed in set PITestCases,And ultimately generate the related test case set PSTestCases of platform.
The method of the present invention is on the basis of component design model, member function logical description form and number based on XMLAccording to the platform of object is unrelated, platform associated description form mapping of refining, the automatic life of member unit test case data is realizedInto.There is beneficial effect following prominent compared with prior art:
(One)Same data object is the unrelated description form related to platform of platform under different phase, and between themRefine and be mapping through database bivariate table and be described and configure, process realize it is simple, should be readily appreciated that and use.
(Two)Platform-independent test case and executable road can inversely be traced back to by the related test case of platformFootpath source, this correctness for helping to implement test case validation verification and model based on feedback is assessed.
(Three)Only need to the renewal of XML content and related tables easy to use, you can different for component to completeThe Test cases technology work of version.Effectively increase component regression test, the efficiency of different editions component testing.
Brief description of the drawings
Fig. 1 is platform-independent data object meta-model in the inventive method;
Fig. 2 is the data object meta-model of platform correlation in the inventive method;
Fig. 3 is the unrelated generation schematic diagram to platform dependence test use-case of platform in the inventive method.
Embodiment
With reference to Figure of description with a kind of component testing use-case generation side based on model of the specific embodiment to the present inventionMethod is described in detail below.
Embodiment:
In the component testing case generation method based on model of the present invention, platform-independent data object meta-model is for example attachedShown in Fig. 1, the related data object meta-model of platform as shown in Figure 2, the data of the unrelated two kinds of forms related to platform of platformConversion generating process between object is as shown in Figure 3.It implements process and comprised the following steps:
Step one:Based on the uml diagram created, the XML of manual creation reflection member function logic describes document:
When creating XML documents, according to each single item workflow in correspondence uml diagram, entered using semantic clearly XML tagRow translation and description.Using predefined tag element correspondence descriptive model in element, including start node, end node,Intermediate node, branch node, cyclic node, aggregation node, parallel node etc..Tag element can be by user's self-defining and expansionExhibition.All tag elements are recorded and semantic tagger by Label_Config documents.
Step 2:Each single item workflow in uml diagram, clearly marks the state that each node is includedData, and the semantic description table NodeDescribeTable of manual creation data object:
The Expressive Features of the node state data include:State before node NodeNo, executionStatesBeforeExecution, input data set InputData and anticipated output data set ExpectOutputData;
Based on the Expressive Features of node state data, the set of data objects included in each status data is determinedDataObjectSet, wherein, each data object DataObject Expressive Features are:Data object nameObjectName, characteristic attribute set ObjectAttributes.
Step 3:Obtained set of data objects is analyzed in object-oriented platform and step 2, the data pair based on determinationAs codomain and about beam analysis and the specific mapping state values of data object under target platform are automatically generated, and created on this basisData object is built by the unrelated value mapping table PItoPSMapTable related to platform of platform:
Wherein, the platform association attributes feature of data object includes:Parameter list paraList, parameter value domainValueDomain, state valid data state(Including bool types, true:Valid data;false:Invalid data), lead toCross the codomain of data object and about beam analysis, the corresponding mapping object of generation, and record its abnormal value set under target platformWith normal value set.
Step 4:The XML document of traversal description member function logic, automatically generates the workflow of counterpart member function logicSet
Its basic implementation procedure is:
(1)Start node set Starts non-NULLs, then obtain a start node, and the method traveled through according to level obtains itChild nodes, and the start node is generated to the set of paths of child nodes;
(2)If a child nodes are end nodes, turn to(5);If the non-end node of child nodes, Ze Gai roadsFootpath out to be temporarily stored in Temps set;Until all child nodes of current start node are disposed;
(3)If temporary path set Temps is not sky, each temporary path in gathering Temps obtains its periproctThe child nodes of point, are then turned to(2);Otherwise, under steering(4);
(4)The workflow traversal that current start node starts is finished, if start node combination Starts is sky, is turned toUnder(5), otherwise, in steering(1), continue executing with;
(5)Respective path deposit TestPaths set, that is, generate test path set TestPaths.
Step 5:Table is described based on the data object created in step 2(Including perform before state, input data set andAnticipated output data acquisition system), each executable path in test path set TestPaths is changed and extended,The unrelated test case set PiTestCases of generating platform.
Basic implementation procedure is as follows:
(1)If test path set TestPaths non-NULLs, an executable path is obtained;
(2)Obtain the node semantics created in the start node in current executable path, query steps two and describe tableNodeDescribeTable, with its corresponding status data Expressive Features(State before including performing, input data set and pre-Phase output data set)Replace the node;
(3)Order obtains the node semantics created in the next node in path, query steps two and describes tableNodeDescribeTable, with its corresponding status data Expressive Features(State before including performing, input data set and pre-Phase output data set)Replace the node;
Repeat(3), subsequent node is continued with, until all subsequent nodes are disposed, and the test of conversion generationUse-case deposit set PITestCases;
Repeat(1)-(3), until all paths are finished by conversion process in test path set TestPaths, andUltimately generate platform-independent test case set PITestCases.
Step 6:Based on the unrelated data object value mapping table related to platform of the platform created in step 3PItoPSMapTable, the platform-independent test case set PITestCases generated successively in process step five, passes through numberAccording to the related test case set PSTestCases of transfer process automatic Generation Platform, basic implementation procedure is as follows:
(1)If set PITestCases non-NULLs, obtain under the unrelated test case PiTC of a platform, and steering(2);Otherwise, it is disposed;
(2)Obtain the unrelated number related to platform of the platform created in the first data object in PiTC, query steps threeAccording to object value mapping table PItoPSMapTable, with its corresponding platform relevant state data Expressive Features(State, defeated before performingEnter data acquisition system and anticipated output data acquisition system)The data object in PiTC is replaced,
(2)Step, which can be refined, to be described as:
A)Obtain first data object in PiTC;If without data object to be processed, turned to(3);
B)PItoPSMapTable is inquired about, its normal value set and abnormal value set is obtained, recording exceptional value number NUM,Normal value number only remembers 1;
C)NUM+1 PiTC backup is replicated, replaces first in NUM backup PiTC respectively with NUM abnormal Value DataData object, and NUM test case PiTC ' deposit set PSTestCases after replacing;
D)Normal value is randomly choosed from normal value set and replaces a backup PiTC, and this replace after test useExample PiTC ' out to be temporarily stored in PsTemp set;
E)Appoint from PsTemp and take a PiTC ', if getting next data object, PiTC ' replaces currentPiTC, and turn to A);If PsTemp is sky, turn to(3);
(3)Turn to(1), continue with next PiTC;
Repeat(1)-(3), finished until the unrelated test case of all platforms is processed in set PITestCases,And ultimately generate the related test case set PSTestCases of platform.

Claims (7)

CN201410252163.9A2014-06-102014-06-10A kind of component testing case generation method based on modelActiveCN103995781B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201410252163.9ACN103995781B (en)2014-06-102014-06-10A kind of component testing case generation method based on model

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201410252163.9ACN103995781B (en)2014-06-102014-06-10A kind of component testing case generation method based on model

Publications (2)

Publication NumberPublication Date
CN103995781A CN103995781A (en)2014-08-20
CN103995781Btrue CN103995781B (en)2017-08-25

Family

ID=51309953

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201410252163.9AActiveCN103995781B (en)2014-06-102014-06-10A kind of component testing case generation method based on model

Country Status (1)

CountryLink
CN (1)CN103995781B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104317721A (en)*2014-11-122015-01-28大连交通大学Regression test case selection method based on improved harmony search algorithm
CN105701002B (en)*2014-11-262019-02-12阿里巴巴集团控股有限公司A kind of recording method and device of the execution route based on test
CN104536897B (en)*2015-01-162018-02-13安一恒通(北京)科技有限公司Automatic test approach and system based on keyword
CN104660696B (en)*2015-02-102018-04-27上海创景信息科技有限公司Parallel transceiving construction system and construction method thereof
WO2017035812A1 (en)*2015-09-022017-03-09Hewlett Packard Enterprise Development LpReplicating chain of agents
US20190018765A1 (en)*2016-02-242019-01-17Mitsubishi Electric CorporationTest case generation apparatus and computer readable medium
CN106227667B (en)*2016-07-282019-03-19南京大学A kind of method for generating test case of the mobile application of the IFML based on extension
CN107391529B (en)*2017-03-282020-12-08创新先进技术有限公司Method and device for realizing Object Relation Mapping (ORM)
CN109542753B (en)*2017-09-212021-08-03中国航发商用航空发动机有限责任公司Software integration test method and platform
CN107678953A (en)*2017-09-222018-02-09深圳航天科技创新研究院Path generating method, system and storage medium based on uml diagram shape
EP3722942B1 (en)*2019-04-102023-03-22The Boeing CompanyRunning integration tests using unit tests
CN111679991B (en)*2020-06-232021-04-13武汉光庭信息技术股份有限公司Method and system for generating test case by utilizing big data
CN112085201B (en)*2020-09-222021-05-18广州医药信息科技有限公司Logic deduction method based on micro-service application
CN112363923B (en)*2020-11-092024-05-14中国平安人寿保险股份有限公司Testing method and device based on questionnaire system, computer equipment and medium
CN112965909B (en)*2021-03-192024-04-09湖南大学Test data, test case generation method and system and storage medium
CN116090183B (en)*2022-12-122023-11-17南京航空航天大学Digital simulation method and system for SCR demand model

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101464797A (en)*2008-12-092009-06-24北京星网锐捷网络技术有限公司Method and system for automatically generating test use case based on unified modeling language activity graph
CN102591779A (en)*2012-01-122012-07-18王轶辰Establishing method for workflow-based universal software testing process model
CN103412853A (en)*2013-08-052013-11-27北京信息科技大学Method for automatically generating test cases aiming at document converters

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8161459B2 (en)*2009-01-152012-04-17Infosys Technologies LimitedMethod and system for generating functional test cases

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101464797A (en)*2008-12-092009-06-24北京星网锐捷网络技术有限公司Method and system for automatically generating test use case based on unified modeling language activity graph
CN102591779A (en)*2012-01-122012-07-18王轶辰Establishing method for workflow-based universal software testing process model
CN103412853A (en)*2013-08-052013-11-27北京信息科技大学Method for automatically generating test cases aiming at document converters

Also Published As

Publication numberPublication date
CN103995781A (en)2014-08-20

Similar Documents

PublicationPublication DateTitle
CN103995781B (en)A kind of component testing case generation method based on model
Guerra et al.Engineering model transformations with trans ML
Bollati et al.Applying MDE to the (semi-) automatic development of model transformations
US9146712B2 (en)Extensible code auto-fix framework based on XML query languages
Mehmood et al.Aspect-oriented model-driven code generation: A systematic mapping study
Debreceni et al.Automated model merge by design space exploration
CN104199664B (en)A kind of simulation code synchronization generation method based on annotation
CN114610301A (en) Front-end code generation method, device, electronic device and storage medium
Kaiser et al.Automatic verification of modeling rules in systems engineering for mechatronic systems
Reimann et al.Role-based generic model refactoring
CN102411499A (en)Directed-graph-structure-based system information extraction method for single electronic control unit (ECU)
JPWO2020254962A5 (en)
Tanhaei et al.Automating feature model refactoring: A model transformation approach
Zhang et al.Towards correct product derivation in model-driven product lines
Del Fabro et al.Model-driven tool interoperability: An application in bug tracking
Maneerat et al.Translation UML activity diagram into colored Petri net with inscription
Noll et al.Ontological traceability over the unified process
Čeliković et al.A DSL for EER data model specification
Pais et al.From SysML state machines to petri nets using ATL transformations
Kusel et al.Common pitfalls of using QVT relations-graphical debugging as remedy
Khwaja et al.A framework for evaluating software design pattern specification languages
Mlynarski et al.From design models to test models by means of test ideas
StörrleStructuring large models with MONO: Notations, templates, and case studies
Sharbaf et al.Towards automatic generation of formal specifications for UML consistency verification
Burgueno et al.TractsTool: Testing Model Transformations based on Contracts.

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp