CN104899136A - Method and device used for generating test case - Google Patents

Method and device used for generating test case Download PDF

Info

Publication number
CN104899136A
CN104899136A CN201510251389.1A CN201510251389A CN104899136A CN 104899136 A CN104899136 A CN 104899136A CN 201510251389 A CN201510251389 A CN 201510251389A CN 104899136 A CN104899136 A CN 104899136A
Authority
CN
China
Prior art keywords
test case
code
constitutional diagram
case
interface
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.)
Pending
Application number
CN201510251389.1A
Other languages
Chinese (zh)
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.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201510251389.1A priority Critical patent/CN104899136A/en
Publication of CN104899136A publication Critical patent/CN104899136A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention aims to provide a method and a device used for generating a test case. The method comprises the following steps: obtaining a business state diagram constructed by a user; according to the business state diagram, generating a corresponding state diagram code; and carrying out traversal on the state diagram code to generate the corresponding test case. Compared with the prior art, the method abstracts the business of a web system as the business state diagram, automatically generates the state diagram code, carries out the traversal on the state diagram code to automatically generate an executable test case code and converts the manual writing of the test case code into the manual writing of a business mode, so that a process that the business model is converted into the test case is automated, manpower cost is greatly lowered, test efficiency is improved, and use experience is improved. Furthermore, a process that a business operation scene is manually covered is converted into the fully-automatic combined traversal of an input parameter and the graph traversal of an operation path, and a test coverage rate is guaranteed.

Description

A kind of method and apparatus for generating test use case
Technical field
The present invention relates to software testing technology field, particularly relate to a kind of technology for generating test use case.
Background technology
After Software Development completes, in order to ensure that software systems can complete the function of anticipated demand, need to test software.
Automatic test by the analysis to system requirements documents, need be write code call system interface analog subscriber courses of action, specifies input parameter, operation steps and expected results in code file.But existing this automated testing method is write for tester carries out automatic test cases code and safeguards, human cost is high, and there is the problem that coverage cannot ensure.
Summary of the invention
The object of this invention is to provide a kind of method and apparatus for generating test use case.
According to an aspect of the present invention, provide a kind of method for generating test use case, wherein, the method comprises the following steps:
Obtain the service condition figure constructed by user;
According to described service condition figure, generate corresponding constitutional diagram code;
Travel through described constitutional diagram code, generate corresponding test case.
According to another aspect of the present invention, additionally provide a kind of device for generating test use case, wherein, this device comprises:
For obtaining the device of the service condition figure constructed by user;
For according to described service condition figure, generate the device of corresponding constitutional diagram code;
For traveling through described constitutional diagram code, generate the device of corresponding test case.
Compared with prior art, the present invention by by abstract for the business of web system be service condition figure, automatic generation constitutional diagram code, ergodic state figure generates executable test case code automatically, manual compiling test case code is converted into manual compiling business model, and business model to the process of test case is become robotization, greatly reduce human cost, improve testing efficiency, improve experience.Further, the present invention will manually carry out the covering of business operation scene, changes into and automatically input parameter is carried out to combination traversal, carries out figure traversal to courses of action, ensured test coverage.
Further, robotization concurrence performance test case of the present invention, realizes the automatic test to web system.
Further, the present invention is versatility platform, can be applied to the automatic test scene of web system, user-friendly.
Further, user without the need to generating direct executable code, and only needs to submit to testing service interface, simplifies operation and the flow process of user, improves testing efficiency, improve the experience of user.
Further, the present invention adopts monolateral intersection traversal, polygon intersection ergodic state figure code, generates corresponding monolateral cross-beta use-case, polygon cross-beta use-case, has more effectively ensured test coverage.
Accompanying drawing explanation
By reading the detailed description done non-limiting example done with reference to the following drawings, other features, objects and advantages of the present invention will become more obvious:
Fig. 1 is the structural representation of the device for generating test use case according to one aspect of the invention;
Fig. 2 is according to an embodiment of the invention for the schematic diagram of generating test use case;
Fig. 3 is in accordance with another embodiment of the present invention for the schematic diagram of generating test use case;
Fig. 4 is the schematic flow sheet of the method for generating test use case according to a further aspect of the present invention.
In accompanying drawing, same or analogous Reference numeral represents same or analogous parts.
Embodiment
Before in further detail exemplary embodiment being discussed, it should be mentioned that some exemplary embodiments are described as the process or method described as process flow diagram.Although operations is described as the process of order by process flow diagram, many operations wherein can be implemented concurrently, concomitantly or simultaneously.In addition, the order of operations can be rearranged.Described process can be terminated when its operations are completed, but can also have the additional step do not comprised in the accompanying drawings.Described process can correspond to method, function, code, subroutine, subroutine etc.
Within a context alleged " computer equipment ", also referred to as " computer ", refer to the intelligent electronic device that can be performed the predetermined process such as numerical evaluation and/or logical calculated process by operation preset program or instruction, it can comprise processor and storer, the survival instruction that prestores in memory is performed to perform predetermined process process by processor, or perform predetermined process process by the hardware such as ASIC, FPGA, DSP, or combined by said two devices and realize.Computer equipment includes but not limited to server, PC, notebook computer, panel computer, smart mobile phone etc.
Described computer equipment comprises subscriber equipment and the network equipment.Wherein, described subscriber equipment includes but not limited to computer, smart mobile phone, PDA etc.; The described network equipment includes but not limited to the server group that single network server, multiple webserver form or the cloud be made up of a large amount of computing machine or the webserver based on cloud computing (Cloud Computing), wherein, cloud computing is the one of Distributed Calculation, the super virtual machine be made up of a group loosely-coupled computing machine collection.Wherein, described computer equipment isolated operation can realize the present invention, also accessible network by realizing the present invention with the interactive operation of other computer equipments in network.Wherein, the network residing for described computer equipment includes but not limited to internet, wide area network, Metropolitan Area Network (MAN), LAN (Local Area Network), VPN etc.
It should be noted that; described subscriber equipment, the network equipment and network etc. are only citing; other computer equipments that are existing or that may occur from now on or network, as being applicable to the present invention, within also should being included in scope, and are contained in this with way of reference.
Method (some of them are illustrated by process flow diagram) discussed below can be implemented by hardware, software, firmware, middleware, microcode, hardware description language or its combination in any.When implementing by software, firmware, middleware or microcode, program code or code segment in order to implement necessary task can be stored in machine or computer-readable medium (such as storage medium).(one or more) processor can implement necessary task.
Concrete structure disclosed herein and function detail are only representational, and are the objects for describing exemplary embodiment of the present invention.But the present invention can carry out specific implementation by many replacement forms, and should not be construed as only being limited to the embodiments set forth herein.
Should be understood that, although may have been used term " first ", " second " etc. here to describe unit, these unit should not limit by these terms.These terms are used to be only used to a unit and another unit to distinguish.For example, when not deviating from the scope of exemplary embodiment, first module can be called as second unit, and second unit can be called as first module similarly.Here used term "and/or" comprise one of them or more any and all combinations of listed associated item.
Should be understood that, when a unit is called as " connection " or " coupling " to another unit, it can directly connect or be coupled to another unit described, or can there is temporary location.On the other hand, " when being directly connected " or " directly coupled " to another unit, then there is not temporary location when a unit is called as.Should explain in a comparable manner the relation be used between description unit other words (such as " and be in ... between " compared to " and be directly in ... between ", " with ... contiguous " compared to " and with ... be directly close to " etc.).
Here used term is only used to describe specific embodiment and be not intended to limit exemplary embodiment.Unless context refers else clearly, otherwise singulative used here " ", " one " are also intended to comprise plural number.It is to be further understood that, the existence of the feature that term used here " comprises " and/or " comprising " specifies to state, integer, step, operation, unit and/or assembly, and do not get rid of and there is or add other features one or more, integer, step, operation, unit, assembly and/or its combination.
Also it should be mentioned that and to replace in implementation at some, the function/action mentioned can according to being different from occurring in sequence of indicating in accompanying drawing.For example, depend on involved function/action, in fact the two width figure in succession illustrated can perform simultaneously or sometimes can perform according to contrary order substantially.
Below in conjunction with accompanying drawing, the present invention is described in further detail.
Fig. 1 is the structural representation of the device for generating test use case according to one aspect of the invention.
This device (hereinafter referred to as " test case device 1 ") being used for generating test use case comprises device (hereinafter referred to as " service condition figure construction device 101 ") for obtaining the service condition figure constructed by user, for according to described service condition figure, generate corresponding constitutional diagram code device (hereinafter referred to as " figure code generating unit 102 ") and for traveling through described constitutional diagram code, generate the device (hereinafter referred to as " Test cases technology device 103 ") of corresponding test case.
Wherein, service condition figure construction device 101 obtains the service condition figure constructed by user.
Particularly, the mode of service condition figure that service condition figure construction device 101 obtains constructed by user includes but not limited to:
1) user has built service condition figure, by carrying out alternately with this test case device 1, upload the service condition figure constructed by it, service condition figure construction device 101 such as by calling the modes such as API (application programming interfaces), obtains the service condition figure constructed by this user.
2) test case device 1 provides service condition figure construction platform, edited by figure and realize visualized operation, user directly builds service condition figure on the platform, such as, user directly can drag key element leveling off on platform, realizes the structure of service condition figure, editor; Service condition figure construction device 101, according to the operation of user, obtains the service condition figure that this user builds.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the implementation of any other service condition figure constructed by acquisition user that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
Preferably, the key element of described service condition figure comprises state, behavior and rule.
Particularly, the editor of the state key element of service condition figure is such as needed to the interface of designated state name, acquisition or verification state; Editor for the behavioral primitive of service condition figure such as needs appointment behavior input, output parameter or triggers the interface of behavior; Editor for the regular key element of service condition figure such as needs the annexation between designated state.
For Fig. 2, it is a music services constitutional diagram.In this figure, circle " non-VIP ", " common VIP " and " platinum VIP " represent the state key element of this service condition figure; " 1, place an order platinum VIP ", " 2, pay platinum list ", " 3, place an order common VIP ", " 4, pay common list " then represent the behavioral primitive of this service condition figure; With the limit of arrow points, limit, the limit of " common VIP " sensing " platinum VIP ", " platinum VIP " that the limit of such as " non-VIP " sensing " common VIP ", the limit of " non-VIP " sensing " platinum VIP ", " common VIP " point to self point to self limit etc., then represent the regular key element of this service condition figure.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the key element of any other service condition figure that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
Preferably, service condition figure construction device 101 also comprises the device (hereinafter referred to as " testing service interface acquisition device " (not shown)) for obtaining the testing service interface that described user provides.
Particularly, user is when building service condition figure, can by encapsulating the service that can call, the testing service interface of correspondence is uploaded, such as, will obtain the interface of described state, the interface verifying described state, the interface triggering described behavior or the interface etc. that verifies described behavior is uploaded, this testing service interface acquisition device obtains the testing service interface that this user provides, for subsequent calls, and generate corresponding constitutional diagram code.
At this, user without the need to generating direct executable code, and only needs to submit to testing service interface, simplifies operation and the flow process of user, improves testing efficiency, improve the experience of user.
Preferably, described testing service interface comprises following at least any one:
-obtain the interface of described state;
-verify the interface of described state;
-trigger the interface of described behavior;
-verify the interface of described behavior.
Such as, for Fig. 2, when state " non-VIP " arrives state " common VIP " by behavior " place an order common VIP ", " paying common list ", then this test case device 1 is by calling the interface of the described state of above-mentioned acquisition, obtains state " non-VIP "; Triggering the interface of described behavior by calling appeal, triggering above-mentioned behavior " place an order common VIP ", " paying common list "; By calling the interface of the described state of above-mentioned verification, whether the state that the verification behavior reaches is state " common VIP "; By calling the interface of the described behavior of above-mentioned verification, verifying above-mentioned behavior " place an order common VIP ", whether " paying common list " be correct.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; any other testing service interface that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
Figure code generating unit 102, according to described service condition figure, generates corresponding constitutional diagram code.
Particularly, the service condition figure that the user that figure code generating unit 102 obtains according to service condition figure construction device 101 builds, generates corresponding constitutional diagram code, calls for Test cases technology device 103.
At this, test case device 1 generates corresponding constitutional diagram code automatically according to service condition figure, manual maintenance test case code is converted into manual maintenance business model, and business model to the process of test case is become robotization, greatly reduce human cost, improve testing efficiency, improve experience.
Test cases technology device 103 travels through described constitutional diagram code, generates corresponding test case.
Particularly, Test cases technology device 103 travels through the constitutional diagram code that this figure code generating unit 102 generates, and such as, travels through limit and the input parameter of this constitutional diagram code, generates corresponding test case.At this, the mode of this Test cases technology device 103 ergodic state figure code includes but not limited to:
1) this constitutional diagram code of monolateral traversal, generates corresponding one-sided test use-case.
Such as, as shown in the picture left above of Fig. 3, Test cases technology device 103 to state " common VIP ", namely completes the once monolateral traversal to this constitutional diagram from state " non-VIP ".This Test cases technology device 103 respectively from the different state of service condition figure, can traverse through on one " limit ", to another state of this service condition figure, to realize the monolateral traversal to this constitutional diagram code, generates corresponding one-sided test use-case.
At this, a dotted state for this traversal can be consistent with terminal state.Such as, as shown in the picture left above of Fig. 3, state " common VIP " can get back to self state through behavior " 3, place an order common VIP " or " 4, pay common list ", namely, Test cases technology device 103 is from state " common VIP ", through behavior " 3, place an order common VIP " or " 4, pay common list ", complete the once monolateral traversal to this constitutional diagram, and get back to state " common VIP ".
At this, this Test cases technology device 103 can also adopt algorithm of becoming a partner, and explodes to prevent use-case quantity.
2) this constitutional diagram code of polygon traversal, generates corresponding polygon test case.
Such as, as shown in the top right plot of Fig. 3, Test cases technology device 103 first from state " non-VIP " to state " common VIP ", then from state " common VIP " to state " platinum VIP ", namely complete the once polygon traversal to this constitutional diagram.This Test cases technology device 103 can respectively from the different state of service condition figure, order traversal is through two or more " limit ", to another state of this service condition figure, by covering the multiple path of this constitutional diagram, realize the polygon traversal to this constitutional diagram code, generate corresponding polygon test case.
At this, this Test cases technology device 103 can also adopt orthogonal algorithm, explodes to prevent use-case quantity.
3) monolateral intersection travels through this constitutional diagram code, generates corresponding monolateral cross-beta use-case.
4) polygon intersection travels through this constitutional diagram code, generates corresponding polygon cross-beta use-case.
We will hereafter specifically describe monolateral intersection ergodic state figure code and polygon intersection ergodic state figure code.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the mode of any other ergodic state figure code that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
At this, test case device 1 by by abstract for the business of web system be service condition figure, automatic generation constitutional diagram code, ergodic state figure generates executable test case code automatically, manual compiling test case code is converted into manual compiling business model, and business model to the process of test case is become robotization, greatly reduce human cost, improve testing efficiency, improve experience.Further, test case device 1 will manually carry out the covering of business operation scene, changes into and automatically input parameter is carried out to combination traversal, carries out figure traversal to courses of action, ensured test coverage.
Preferably, described Test cases technology device 103 also comprises and travels through described constitutional diagram code for monolateral intersection, generates the device (hereinafter referred to as " monolateral cross-beta use-case generating apparatus " (not shown)) of corresponding monolateral cross-beta use-case.
Particularly, the constitutional diagram code that monolateral cross-beta use-case generating apparatus monolateral intersection traversing graph code generating unit 102 generates, such as, monolateral intersection travels through limit and the input parameter of this constitutional diagram code, generates corresponding monolateral cross-beta use-case.
As shown in the lower-left figure of Fig. 3, monolateral cross-beta use-case generating apparatus sets out from state " non-VIP ", first call behavior " place an order common VIP ", namely lower first is single, then the behavior of calling " place an order common VIP " is continued, namely lower second is single, behavior of calling again " pays common list ", namely pay the first list, then continue the behavior of calling and " pay common list ", namely pay the second list, and to state " common VIP ", namely complete the once monolateral intersection traversal to this constitutional diagram, subsequently, generate corresponding monolateral cross-beta use-case.
At this, monolateral cross-beta use-case is carry out cross-call to the behavior on single limit, and simulation web system user repeats the scene calling a systemic-function.
Preferably, described Test cases technology device 103 also comprises and travels through described constitutional diagram code for polygon intersection, generates the device (hereinafter referred to as " polygon cross-beta use-case generating apparatus " (not shown)) of corresponding polygon cross-beta use-case.
Particularly, the constitutional diagram code that polygon cross-beta use-case generating apparatus polygon intersection traversing graph code generating unit 102 generates, such as, polygon intersection travels through limit and the input parameter of this constitutional diagram code, generates corresponding polygon cross-beta use-case.
As shown in the bottom-right graph of Fig. 3, polygon cross-beta use-case generating apparatus sets out from state " non-VIP ", first call behavior " place an order common VIP ", i.e. lower first single common list, then the behavior of calling " place an order platinum VIP " is continued, i.e. lower second single platinum list, behavior of calling again " pays common list ", namely first single common list is paid, then continue the behavior of calling and " pay platinum list ", namely second single platinum list is paid, and respectively to state " common VIP " and " platinum VIP ", namely the once polygon intersection traversal to this constitutional diagram is completed, subsequently, generate corresponding polygon cross-beta use-case.
At this, polygon cross-beta use-case is that same state is set out the cross-call of behavior on two limits that different conditions terminates, and simulation web system user performs the scene of two kinds of system difference in functionalitys under a state.
At this, test case device 1 adopts monolateral intersection traversal, polygon intersection ergodic state figure code, generates corresponding monolateral cross-beta use-case, polygon cross-beta use-case, has more effectively ensured test coverage.
Preferably, this test case device 1 also comprises for calling described test case, resolves and preserves the device (hereinafter referred to as " test case calling device " (not shown)) of generated test result.
Particularly, test case calling device calls the test case that this Test cases technology device 103 generates, and such as, for these test cases load web system user ID, these test cases of concurrent invocation, resolve and preserve generated test result.
At this, test case device 1 robotization concurrence performance test case, realizes the automatic test to web system.Further, this test case device 1 is versatility platform, can be applied to the automatic test scene of web system, user-friendly.
Fig. 4 is the schematic flow sheet of the method for generating test use case according to a further aspect of the present invention.
In step S401, test case device 1 obtains the service condition figure constructed by user.
Particularly, in step S401, the mode of the service condition figure that test case device 1 obtains constructed by user includes but not limited to:
1) user has built service condition figure, by carrying out alternately with this test case device 1, upload the service condition figure constructed by it, in step S401, test case device 1 such as by calling the modes such as API (application programming interfaces), obtains the service condition figure constructed by this user.
2) test case device 1 provides service condition figure construction platform, edited by figure and realize visualized operation, user directly builds service condition figure on the platform, such as, user directly can drag key element leveling off on platform, realizes the structure of service condition figure, editor; In step S401, test case device 1, according to the operation of user, obtains the service condition figure that this user builds.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the implementation of any other service condition figure constructed by acquisition user that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
Preferably, the key element of described service condition figure comprises state, behavior and rule.
Particularly, the editor of the state key element of service condition figure is such as needed to the interface of designated state name, acquisition or verification state; Editor for the behavioral primitive of service condition figure such as needs appointment behavior input, output parameter or triggers the interface of behavior; Editor for the regular key element of service condition figure such as needs the annexation between designated state.
For Fig. 2, it is a music services constitutional diagram.In this figure, circle " non-VIP ", " common VIP " and " platinum VIP " represent the state key element of this service condition figure; " 1, place an order platinum VIP ", " 2, pay platinum list ", " 3, place an order common VIP ", " 4, pay common list " then represent the behavioral primitive of this service condition figure; With the limit of arrow points, limit, the limit of " common VIP " sensing " platinum VIP ", " platinum VIP " that the limit of such as " non-VIP " sensing " common VIP ", the limit of " non-VIP " sensing " platinum VIP ", " common VIP " point to self point to self limit etc., then represent the regular key element of this service condition figure.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the key element of any other service condition figure that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
Preferably, step S401 also comprises the sub-step (hereinafter referred to as " sub-step S4011 " (not shown)) for obtaining the testing service interface that described user provides.
Particularly, user is when building service condition figure, can by encapsulating the service that can call, the testing service interface of correspondence is uploaded, such as, will the interface of described state, the interface verifying described state, the interface triggering described behavior be obtained or the interface etc. that verifies described behavior is uploaded, in step S4011, test case device 1 obtains the testing service interface that this user provides, and for subsequent calls, and generates corresponding constitutional diagram code.
At this, user without the need to generating direct executable code, and only needs to submit to testing service interface, simplifies operation and the flow process of user, improves testing efficiency, improve the experience of user.
Preferably, described testing service interface comprises following at least any one:
-obtain the interface of described state;
-verify the interface of described state;
-trigger the interface of described behavior;
-verify the interface of described behavior.
Such as, for Fig. 2, when state " non-VIP " arrives state " common VIP " by behavior " place an order common VIP ", " paying common list ", then this test case device 1 is by calling the interface of the described state of above-mentioned acquisition, obtains state " non-VIP "; Triggering the interface of described behavior by calling appeal, triggering above-mentioned behavior " place an order common VIP ", " paying common list "; By calling the interface of the described state of above-mentioned verification, whether the state that the verification behavior reaches is state " common VIP "; By calling the interface of the described behavior of above-mentioned verification, verifying above-mentioned behavior " place an order common VIP ", whether " paying common list " be correct.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; any other testing service interface that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
In step S402, test case device 1, according to described service condition figure, generates corresponding constitutional diagram code.
Particularly, in step S402, the service condition figure that test case device 1 builds according to the user obtained in step S401, generates corresponding constitutional diagram code, calls for subsequent step.
At this, test case device 1 generates corresponding constitutional diagram code automatically according to service condition figure, manual maintenance test case code is converted into manual maintenance business model, and business model to the process of test case is become robotization, greatly reduce human cost, improve testing efficiency, improve experience.
In step S403, test case device 1 travels through described constitutional diagram code, generates corresponding test case.
Particularly, in step S403, test case device 1 travels through the constitutional diagram code generated in step S402, such as, travels through limit and the input parameter of this constitutional diagram code, generates corresponding test case.At this, in step S403, the mode of test case device 1 ergodic state figure code includes but not limited to:
1) this constitutional diagram code of monolateral traversal, generates corresponding one-sided test use-case.
Such as, as shown in the picture left above of Fig. 3, in step S403, test case device 1 to state " common VIP ", namely completes the once monolateral traversal to this constitutional diagram from state " non-VIP ".In step S403, test case device 1 respectively from the different state of service condition figure, can traverse through on one " limit ", to another state of this service condition figure, to realize the monolateral traversal to this constitutional diagram code, generates corresponding one-sided test use-case.
At this, a dotted state for this traversal can be consistent with terminal state.Such as, as shown in the picture left above of Fig. 3, state " common VIP " can get back to self state through behavior " 3, place an order common VIP " or " 4, pay common list ", namely, test case device 1 is from state " common VIP ", through behavior " 3, place an order common VIP " or " 4, pay common list ", complete the once monolateral traversal to this constitutional diagram, and get back to state " common VIP ".
At this, this test case device 1 can also adopt algorithm of becoming a partner, and explodes to prevent use-case quantity.
2) this constitutional diagram code of polygon traversal, generates corresponding polygon test case.
Such as, as shown in the top right plot of Fig. 3, in step S403, test case device 1 first from state " non-VIP " to state " common VIP ", then from state " common VIP " to state " platinum VIP ", namely complete the once polygon traversal to this constitutional diagram.In step S403, test case device 1 can respectively from the different state of service condition figure, order traversal is through two or more " limit ", to another state of this service condition figure, by covering the multiple path of this constitutional diagram, realize the polygon traversal to this constitutional diagram code, generate corresponding polygon test case.
At this, this test case device 1 can also adopt orthogonal algorithm, explodes to prevent use-case quantity.
3) monolateral intersection travels through this constitutional diagram code, generates corresponding monolateral cross-beta use-case.
4) polygon intersection travels through this constitutional diagram code, generates corresponding polygon cross-beta use-case.
We will hereafter specifically describe monolateral intersection ergodic state figure code and polygon intersection ergodic state figure code.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the mode of any other ergodic state figure code that is existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
At this, test case device 1 by by abstract for the business of web system be service condition figure, automatic generation constitutional diagram code, ergodic state figure generates executable test case code automatically, manual compiling test case code is converted into manual compiling business model, and business model to the process of test case is become robotization, greatly reduce human cost, improve testing efficiency, improve experience.Further, test case device 1 will manually carry out the covering of business operation scene, changes into and automatically input parameter is carried out to combination traversal, carries out figure traversal to courses of action, ensured test coverage.
Preferably, described step S403 also comprises and travels through described constitutional diagram code for monolateral intersection, generates the sub-step (hereinafter referred to as " sub-step S4031 " (not shown)) of corresponding monolateral cross-beta use-case.
Particularly, in sub-step S4031, the monolateral intersection of test case device 1 travels through the constitutional diagram code generated in step S402, and such as, monolateral intersection travels through limit and the input parameter of this constitutional diagram code, generates corresponding monolateral cross-beta use-case.
As shown in the lower-left figure of Fig. 3, in the sub-S4031 of step, test case device 1 sets out from state " non-VIP ", first call behavior " place an order common VIP ", namely lower first is single, then the behavior of calling " place an order common VIP " is continued, namely lower second is single, then behavior of calling " pays common list ", namely pays the first list, then continue the behavior of calling and " pay common list ", namely pay the second list, and to state " common VIP ", namely complete the once monolateral intersection traversal to this constitutional diagram, subsequently, corresponding monolateral cross-beta use-case is generated.
At this, monolateral cross-beta use-case is carry out cross-call to the behavior on single limit, and simulation web system user repeats the scene calling a systemic-function.
Preferably, described step S403 also comprises and travels through described constitutional diagram code for polygon intersection, generates the sub-step (hereinafter referred to as " sub-step S4032 " (not shown)) of corresponding polygon cross-beta use-case.
Particularly, in step S4032, the polygon intersection of test case device 1 travels through the constitutional diagram code generated in step S402, and such as, polygon intersection travels through limit and the input parameter of this constitutional diagram code, generates corresponding polygon cross-beta use-case.
As shown in the bottom-right graph of Fig. 3, in sub-step S4032, test case device 1 sets out from state " non-VIP ", first call behavior " place an order common VIP ", i.e. lower first single common list, then the behavior of calling " place an order platinum VIP " is continued, i.e. lower second single platinum list, behavior of calling again " pays common list ", namely first single common list is paid, then continue the behavior of calling and " pay platinum list ", namely second single platinum list is paid, and respectively to state " common VIP " and " platinum VIP ", namely the once polygon intersection traversal to this constitutional diagram is completed, subsequently, generate corresponding polygon cross-beta use-case.
At this, polygon cross-beta use-case is that same state is set out the cross-call of behavior on two limits that different conditions terminates, and simulation web system user performs the scene of two kinds of system difference in functionalitys under a state.
At this, test case device 1 adopts monolateral intersection traversal, polygon intersection ergodic state figure code, generates corresponding monolateral cross-beta use-case, polygon cross-beta use-case, has more effectively ensured test coverage.
Preferably, the method also comprises for calling described test case, resolves and preserves the step (hereinafter referred to as " step S404 " (not shown)) of generated test result.
Particularly, in step s 404, test case device 1 is invoked at the test case generated in step S403, and such as, for these test cases load web system user ID, these test cases of concurrent invocation, resolve and preserve generated test result.
At this, test case device 1 robotization concurrence performance test case, realizes the automatic test to web system.Further, this test case device 1 is versatility platform, can be applied to the automatic test scene of web system, user-friendly.
It should be noted that the present invention can be implemented in the assembly of software and/or software restraint, such as, each device of the present invention can adopt special IC (ASIC) or any other similar hardware device to realize.In one embodiment, software program of the present invention can perform to realize step mentioned above or function by processor.Similarly, software program of the present invention (comprising relevant data structure) can be stored in computer readable recording medium storing program for performing, such as, and RAM storer, magnetic or CD-ROM driver or flexible plastic disc and similar devices.In addition, steps more of the present invention or function can adopt hardware to realize, such as, as coordinating with processor thus performing the circuit of each step or function.
To those skilled in the art, obviously the invention is not restricted to the details of above-mentioned one exemplary embodiment, and when not deviating from spirit of the present invention or essential characteristic, the present invention can be realized in other specific forms.Therefore, no matter from which point, all should embodiment be regarded as exemplary, and be nonrestrictive, scope of the present invention is limited by claims instead of above-mentioned explanation, and all changes be therefore intended in the implication of the equivalency by dropping on claim and scope are included in the present invention.Any Reference numeral in claim should be considered as the claim involved by limiting.In addition, obviously " comprising " one word do not get rid of other unit or step, odd number does not get rid of plural number.Multiple unit of stating in system claims or device also can be realized by software or hardware by a unit or device.First, second word such as grade is used for representing title, and does not represent any specific order.

Claims (14)

1. for a method for generating test use case, wherein, the method comprises the following steps:
Obtain the service condition figure constructed by user;
According to described service condition figure, generate corresponding constitutional diagram code;
Travel through described constitutional diagram code, generate corresponding test case.
2. method according to claim 1, wherein, the described constitutional diagram code of described traversal, the step generating corresponding test case also comprises:
-monolateral intersection travels through described constitutional diagram code, generates corresponding monolateral cross-beta use-case.
3. method according to claim 1, wherein, the described constitutional diagram code of described traversal, the step generating corresponding test case also comprises:
-polygon intersection travels through described constitutional diagram code, generates corresponding polygon cross-beta use-case.
4. method according to claim 1, wherein, the method also comprises:
-call described test case, resolve and preserve generated test result.
5. method according to claim 1, wherein, the key element of described service condition figure comprises state, behavior and rule.
6. method according to any one of claim 1 to 5, wherein, the step of the service condition figure of described acquisition constructed by user also comprises:
-obtain the testing service interface that described user provides.
7. method according to claim 6, wherein, described testing service interface comprises following at least any one:
-obtain the interface of described state;
-verify the interface of described state;
-trigger the interface of described behavior;
-verify the interface of described behavior.
8. for a device for generating test use case, wherein, this device comprises:
For obtaining the device of the service condition figure constructed by user;
For according to described service condition figure, generate the device of corresponding constitutional diagram code;
For traveling through described constitutional diagram code, generate the device of corresponding test case.
9. device according to claim 8, wherein, described for traveling through described constitutional diagram code, the device generating corresponding test case also comprises:
-travel through described constitutional diagram code for monolateral intersection, generate the device of corresponding monolateral cross-beta use-case.
10. device according to claim 8, wherein, described for traveling through described constitutional diagram code, the device generating corresponding test case also comprises:
-travel through described constitutional diagram code for polygon intersection, generate the device of corresponding polygon cross-beta use-case.
11. devices according to claim 8, wherein, this device also comprises:
-for calling described test case, resolve and preserve the device of generated test result.
12. devices according to claim 8, wherein, the key element of described service condition figure comprises state, behavior and rule.
Device according to any one of 13. according to Claim 8 to 12, wherein, the described device for obtaining the service condition figure constructed by user also comprises:
-for obtaining the device of the testing service interface that described user provides.
14. devices according to claim 13, wherein, described testing service interface comprises following at least any one:
-obtain the interface of described state;
-verify the interface of described state;
-trigger the interface of described behavior;
-verify the interface of described behavior.
CN201510251389.1A 2015-05-15 2015-05-15 Method and device used for generating test case Pending CN104899136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510251389.1A CN104899136A (en) 2015-05-15 2015-05-15 Method and device used for generating test case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510251389.1A CN104899136A (en) 2015-05-15 2015-05-15 Method and device used for generating test case

Publications (1)

Publication Number Publication Date
CN104899136A true CN104899136A (en) 2015-09-09

Family

ID=54031811

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510251389.1A Pending CN104899136A (en) 2015-05-15 2015-05-15 Method and device used for generating test case

Country Status (1)

Country Link
CN (1) CN104899136A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681903A (en) * 2015-11-11 2017-05-17 阿里巴巴集团控股有限公司 Method and device for generating test case
CN106681927A (en) * 2017-01-09 2017-05-17 郑州云海信息技术有限公司 Method and device for generating test case
CN106708720A (en) * 2015-11-13 2017-05-24 航天信息股份有限公司 Test case generation method and test case generation system
CN106776324A (en) * 2016-12-19 2017-05-31 广州酷狗计算机科技有限公司 Interface test method and device
CN106980571A (en) * 2016-01-15 2017-07-25 阿里巴巴集团控股有限公司 The construction method and equipment of a kind of test use cases
CN107273297A (en) * 2017-06-28 2017-10-20 百度在线网络技术(北京)有限公司 Method and apparatus for generating test case
CN107783893A (en) * 2016-08-26 2018-03-09 上海计算机软件技术开发中心 A kind of Auto-Test System and its implementation based on scene description
CN108459967A (en) * 2018-03-21 2018-08-28 东南大学 Web application method for generating test case based on user interface state flow-chart
CN109189666A (en) * 2018-08-02 2019-01-11 腾讯科技(北京)有限公司 Interface test method, device and computer equipment
CN110825577A (en) * 2018-08-13 2020-02-21 成都鼎桥通信技术有限公司 Frozen screen testing method and device for terminal equipment
US10776251B1 (en) 2016-07-22 2020-09-15 Amdocs Development Limited System, method, and computer program for automatically converting manual test cases to automated test structures in a software testing project
CN112256591A (en) * 2020-11-12 2021-01-22 北京联创信安科技股份有限公司 Test case generation method and device, test equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968769A (en) * 2010-10-22 2011-02-09 中国人民解放军理工大学 Behavioral model-based software security test case generation method
CN102915242A (en) * 2012-09-26 2013-02-06 北京广利核***工程有限公司 Method for implementing code programming by graphical operations
CN103064787A (en) * 2012-12-21 2013-04-24 清华大学 Embedded assembly modeling and testing method based on expansion interface automata model
CN103336742A (en) * 2013-07-18 2013-10-02 北京航空航天大学 Automation software black box testing system and method based on Android

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968769A (en) * 2010-10-22 2011-02-09 中国人民解放军理工大学 Behavioral model-based software security test case generation method
CN102915242A (en) * 2012-09-26 2013-02-06 北京广利核***工程有限公司 Method for implementing code programming by graphical operations
CN103064787A (en) * 2012-12-21 2013-04-24 清华大学 Embedded assembly modeling and testing method based on expansion interface automata model
CN103336742A (en) * 2013-07-18 2013-10-02 北京航空航天大学 Automation software black box testing system and method based on Android

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681903B (en) * 2015-11-11 2020-05-12 阿里巴巴集团控股有限公司 Method and device for generating test case
CN106681903A (en) * 2015-11-11 2017-05-17 阿里巴巴集团控股有限公司 Method and device for generating test case
CN106708720A (en) * 2015-11-13 2017-05-24 航天信息股份有限公司 Test case generation method and test case generation system
CN106980571B (en) * 2016-01-15 2020-09-08 阿里巴巴集团控股有限公司 Method and equipment for constructing test case suite
CN106980571A (en) * 2016-01-15 2017-07-25 阿里巴巴集团控股有限公司 The construction method and equipment of a kind of test use cases
US10776251B1 (en) 2016-07-22 2020-09-15 Amdocs Development Limited System, method, and computer program for automatically converting manual test cases to automated test structures in a software testing project
CN107783893A (en) * 2016-08-26 2018-03-09 上海计算机软件技术开发中心 A kind of Auto-Test System and its implementation based on scene description
CN106776324A (en) * 2016-12-19 2017-05-31 广州酷狗计算机科技有限公司 Interface test method and device
CN106681927A (en) * 2017-01-09 2017-05-17 郑州云海信息技术有限公司 Method and device for generating test case
CN107273297A (en) * 2017-06-28 2017-10-20 百度在线网络技术(北京)有限公司 Method and apparatus for generating test case
CN107273297B (en) * 2017-06-28 2023-10-13 百度在线网络技术(北京)有限公司 Method and device for generating test cases
CN108459967A (en) * 2018-03-21 2018-08-28 东南大学 Web application method for generating test case based on user interface state flow-chart
CN108459967B (en) * 2018-03-21 2021-04-06 东南大学 Web application test case generation method based on user interface state flow diagram
CN109189666A (en) * 2018-08-02 2019-01-11 腾讯科技(北京)有限公司 Interface test method, device and computer equipment
CN110825577A (en) * 2018-08-13 2020-02-21 成都鼎桥通信技术有限公司 Frozen screen testing method and device for terminal equipment
CN110825577B (en) * 2018-08-13 2023-07-04 成都鼎桥通信技术有限公司 Frozen screen testing method and device for terminal equipment
CN112256591A (en) * 2020-11-12 2021-01-22 北京联创信安科技股份有限公司 Test case generation method and device, test equipment and storage medium

Similar Documents

Publication Publication Date Title
CN104899136A (en) Method and device used for generating test case
CN110909460B (en) V2X simulation test method, device, equipment and storage medium for Internet of vehicles
CN110019081A (en) Data persistence processing method, device, system and readable storage medium storing program for executing
CN107480893A (en) A kind of flow method of combination and device
CN111177617A (en) Web direct operation and maintenance method and device based on operation and maintenance management system and electronic equipment
CN103443763B (en) Comprise to connect the ISA Bridge of the support called rewriteeing virtual function
CN105183882A (en) Application software recommending method and device
CN104899142A (en) Remote mock testing method and device
CN109766319B (en) Compression task processing method and device, storage medium and electronic equipment
CN102779045B (en) A kind of interface creating method, interface editor and electronic equipment
CN106055692A (en) Automatic testing method and system for comparison files or folders
CN110083433A (en) Embedded software running method and device, terminal and computer readable storage medium
CN113127361A (en) Application program development method and device, electronic equipment and storage medium
CN109032617B (en) Control method and control device for automatically deleting installation package
CN102541544B (en) The processing method of Tree control, Apparatus and system
CN109976744B (en) Visual programming method, system and terminal equipment
CN106815021A (en) A kind of operation processing method of application, apparatus and system
KR102141749B1 (en) APP program execution method and device
CN112965916A (en) Page testing method, page testing device, electronic equipment and readable storage medium
CN105045595A (en) Plug-in integrating method and plug-in integrating device
CN104750239A (en) Application method and equipment based on spatial gesture access terminal equipment
CN110795143A (en) Method, apparatus, computing device, and medium for processing functional module
CN115709663A (en) Intelligent charging method and device for automobile, electronic equipment and readable storage medium
CN104765680A (en) Method and device for automatically testing software
CN111813407B (en) Game development method, game running device and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20150909