Summary of the invention
In view of this, the present invention is in conjunction with the feature of automated test tool and test and management instrument and the technology of the multithreading communications field, a kind of distributed application program test macro and method of controlling based on operation flow is provided, improves test coverage, increase test mass, reduce testing cost.The invention provides a kind of applied program testing method of controlling based on operation flow, described method comprises:
Definition test case: application testing management tool, according to the operation flow of tested application program, is each service node difference design test case in described flow process, and described test case is stored in database;
Realize automatic test script: for described test case, write respectively the automatic test script corresponding with each test case, and described automatic test script is stored in database;
Set up corresponding relation: application testing management tool, in described database, set up the corresponding relation of described automatic test script and described test case, described corresponding relation is man-to-man mapping relations;
Definition testing process: application testing management tool, the logical order according to service node in the operation flow of tested application program, is combined into one or more protos test suite PROTOSs by described test case;
Definition test plan: in test and management instrument, select one or more described protos test suite PROTOSs, and selected one with automated test tool and the test machine in idle condition as the object of carrying out test assignment; Described test assignment is the combination of the corresponding automatic test script of test case in protos test suite PROTOS;
Carry out test assignment: chosen test machine starts automated test tool, in loading of databases, all test cases that comprise with protos test suite PROTOS have the automatic test script of corresponding relation, and carry out described script according to the built-up sequence of the test case defining in the step of described definition testing process.
Further, the step of described definition test plan is: in test and management instrument, select one or more described protos test suite PROTOSs, and selected a plurality of with automated test tool and the test machine in idle condition as the object of executing the task; And by the test assignment of artificially specifying each test machine to carry out.
Further, in the described step of setting up corresponding relation, the method of setting up the corresponding relation of automatic test script and test case is: in test and management instrument, the abstract fields of each test case is input as to the automatized script title corresponding with this test case.
Further, the step of described execution test assignment also comprises following sub-step:
Upgrade automatic test script: before loading and carrying out automatic test script, in database, utilize Version to upgrade the code of automatic test script.
Further, described method also comprises the steps:
Maintenance test data: after the step of described definition test plan, the test data that application testing management tool relates to the test case in protos test suite PROTOS increases or replaces.
Further, described method also comprises the steps:
Feedback Task Progress: described test machine generates at set intervals tasks carrying progress report in the process of carrying out test assignment.
Further, described method also comprises the steps:
Discharge test machine resource: test machine, after test assignment will be finished, discharges the resource of described test machine, makes described test machine again in idle condition.
Further, described method also comprises the steps:
Generate test report: test machine will be after test assignment will be finished, and described test machine generates test report and is sent to the E-mail address of appointment.
Accordingly, the invention provides a kind of Application testing system of controlling based on operation flow, described system comprises:
Data storage cell, for building database;
Workflow management unit, for setting up protos test suite PROTOS and test case and the corresponding relation of the two, for setting up the corresponding relation of test script and test case;
Task creation unit, for defining test plan, creating test assignment;
Task executing units, for carrying out test assignment;
Described workflow management unit is set up protos test suite PROTOS and test case and the corresponding relation of the two, is set up the corresponding relation of test script and test case according to the data in data storage cell; The content-defined test plan that described task creation unit is set up according to workflow management unit, establishment test assignment; The information that described task executing units sends according to task creation unit the data of reading out data storage unit are carried out test assignment.
Further, the task executing units of described system comprises at least one server.
Further, the task executing units of described system comprises at least one test machine.
Further, when task executing units comprises a server and at least one test machine, described at least one test machine is connected with described server.
Further, when task executing units comprises a plurality of servers and a plurality of test machine, each server connects to form some tasks carrying subelements with an arbitrarily individual test machine.
Further, the operating system of described a plurality of test machines is not identical.
Further, described system also comprises:
Data Management Unit, for maintenance test data; Described Data Management Unit is safeguarded the test data used of the test case in the protos test suite PROTOS of setting up in workflow management unit.
Further, described system also comprises:
Mission Monitor unit, for progress and the result of feedback test machine execution test assignment; The data that described Mission Monitor unit produces according to task executing units are fed back.
Method and system provided by the invention, by each service node is distinguished to design test case, and sets up the corresponding relation of test case and test script and the definition to whole testing process, has improved test coverage, increases test mass; Reduce testing cost.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.Be understandable that, specific embodiment described herein is only for explaining the present invention, but not limitation of the invention.It also should be noted that, for convenience of description, in accompanying drawing, only show part related to the present invention but not full content.
Embodiment mono-
As shown in Figure 1, the present embodiment provides a kind of applied program testing method of controlling based on operation flow, it is example that the present embodiment be take a tested application program, the operation flow of tested application program comprises four service nodes 1,2,3,4, the present embodiment test and management instrument used is Testlink, automated test tool is QTP or Selenium, QTP is HP QuickTest Professional software, and apply method of the present invention and any embodiment, all need Testlink to carry out secondary development, increase some functional modules.Described method of testing comprises the following steps:
Definition test case 101: application testing management tool, according to the operation flow of tested application program, is each service node difference design test case in described flow process, and described test case is stored in database; First apply Testlink definition and four 4 test case A, B, C, D that service node is corresponding, A is to be that use-case, C for node 2 is that use-case, D for node 3 is the use-case for node 4 for the use-case of node 1, B, and four test cases are stored in database.
Realize automatic test script 102: for described test case, write respectively the automatic test script corresponding with each test case, and described automatic test script is stored in database; According to 4 test cases, write corresponding with it automatic test script, by four script names difference called after TestCase_A, TestCase_B, TestCase_C, TestCase_D, and four automatic test scripts are stored in database.
Set up corresponding relation 103: application testing management tool, in described database, set up the corresponding relation of described automatic test script and described test case, described corresponding relation is man-to-man mapping relations; In database, set up the corresponding relation of test case A, B, C, D and automatic test script TestCase_A, TestCase_B, TestCase_C, TestCase_D.
Definition testing process 104: application testing management tool, the logical order according to service node in the operation flow of tested application program, is combined into one or more protos test suite PROTOSs by described test case; Suppose that operation flow has multiple logical order, comprising 124,234, application Testlink sets up a protos test suite PROTOS that comprises ABD flow process, and called after TestSuite_ABD adds A, B, tri-use-cases of D in this protos test suite PROTOS; And can set up a plurality of protos test suite PROTOSs, as set up the protos test suite PROTOS that another comprises BCD flow process, called after TestSuite_BCD, and in this protos test suite PROTOS, add B, C, tri-use-cases of D.
Definition test plan 105: in test and management instrument, select one or more described protos test suite PROTOSs, and selected one with automated test tool and the test machine in idle condition as the object of carrying out test assignment; Described test assignment is the combination of the corresponding automatic test script of test case in protos test suite PROTOS;
Because the testing process in actual conditions is more, need a plurality of test machines jointly to complete test assignment, as a kind of preferred scheme, in the present embodiment, in test and management instrument, select one or more described protos test suite PROTOSs, and selected a plurality of with automated test tool and the test machine in idle condition as the object of executing the task; And the test assignment of artificially specifying each test machine to carry out.
In Testlink, define test plan, called after " regression test plan ", B, C under A, B, D use-case and TestSuite_BCD under protos test suite PROTOS TestSuite_ABD, D use-case are added in " regression test plan ", use-case B, the C, the D that add are optional herein, protos test suite PROTOS TestSuite_BCD for example, if as long as carry out C, D use-case, add C, D use-case, in the time of follow-up execution protos test suite PROTOS TestSuite_BCD, actual motion be exactly the test case of herein adding.
The present embodiment adopts the system shown in Fig. 3 to realize the function that a plurality of test machines complete test assignment jointly, in the step of definition test plan, need in testlink, fill in the ip address of server in certain tasks carrying subelement and select a test machine under this server, and test machine nominative testing task for this reason; If there are a plurality of protos test suite PROTOSs, i.e. representative has a plurality of test assignments, can realize the function of distributed execution for a plurality of test machines distribute different test assignments.For example choose after " regression test plan ", system is taken protos test suite PROTOS TestSuite_ABD automatically out of, and TestSuite_BCD, then chooses the test machine 1 under server 1, by the encapsulation of TestSuite_ABD mission bit stream, sends socket and asks to server 1; Choose the test machine 4 under server 2, by the encapsulation of TestSuite_BCD mission bit stream, send socket and ask to server 2.
Carry out test assignment 106: chosen test machine starts automated test tool, in loading of databases, all test cases that comprise with protos test suite PROTOS have the automatic test script of corresponding relation, and carry out described script according to the built-up sequence of the test case defining in the step of " definition testing process ".Server 1 in tasks carrying subelement or server 2 receive after protos test suite PROTOS TestSuite_ABD or TestSuite_BCD, server is inquired about test case A, B, D and test case B, C, D from database, and test case is sent to chosen test machine 1 and test machine 4, chosen test machine receives after test case, according to the corresponding relation of the title of test case and automatic test script, from database, load the automatic test script corresponding with test case, automatically start test assignment after getting all test cases and script.Test machine 1 and test machine 4 have been realized the function of distributed execution test assignment.
Embodiment bis-
The method that the present embodiment provides, is a kind of improvement proposing on embodiment mono-basis, and the hardware environment in the present embodiment is identical with embodiment mono-.In the step of setting up corresponding relation of the method providing at the present embodiment, the method of setting up the corresponding relation of automatic test script and test case is: in test and management instrument, the abstract fields of each test case is input as to the automatized script title corresponding with this test case.Same operation flow of take embodiment mono-is example, for test case A, in the Testlink test case summary input frame in test event management server, fills in TestCase_A; Similarly, for test case B, in summary input frame, input TestCase_B, is input as the abstract fields of test case C, D automatic test script title TestCase_C, the TestCase_D corresponding with this test case in this manner.
The step of the execution test assignment of the method providing at the present embodiment also comprises following sub-step:
Upgrade automatic test script: before loading and carrying out automatic test script, in database, utilize Version to upgrade the code of automatic test script.The present embodiment adopts Version SVN, be subversion, code to automatic test script upgrades, and the test machine in system of the present invention, when loading automatic test script, utilizes Version from database, to pull up-to-date scripted code.This step can guarantee that system code used is latest edition, and is automatically to carry out, and can reduce the cost of environment maintenance.
The method method that the present embodiment provides also comprises the steps:
Maintenance test data: after the step of definition test plan, the test data that application testing management tool relates to the test case in protos test suite PROTOS increases or replaces.
In the present embodiment, for protos test suite PROTOS TestSuite_ABD and the TestSuite_BCD in Testlink, if need to use type of merchandize data in ABD flow process for " common ", choose TestSuite_ABD, add " type of merchandize " value for the data of " common "; If need to use type of merchandize data in BCD flow process for " luxury goods ", choose TestSuite_BCD, add " type of merchandize " value for the data of " luxury goods ".This step can make tester change test data data used in testing process, and the method has very strong adaptability.
The method that the present embodiment provides also comprises the steps:
Feedback Task Progress: described test machine in carrying out the process of test assignment at set intervals by software control Report Tasks implementation progress.
Automated test tool QTP on test machine in the present embodiment is in carrying out the process of test assignment, data and middle achievement that test process is produced periodically send to the server corresponding with it, these data of server stores, test event management server reads described data from this server, and the test event management server of mentioning in the present embodiment is a server that Testlink is housed.This step can make tester check the progress of task, and achievement in the middle of can reading, and has effectively improved work efficiency.
The method method that the present embodiment provides also comprises the steps:
Discharge test machine resource: test machine, after test assignment will be finished, discharges the resource of described test machine by software control, makes described test machine again in idle condition.Automated test tool QTP on test machine in the present embodiment executes after test assignment, the notice server task corresponding with it completes, described server discharges the resource of this test machine, make this test machine again become upstate idle condition in other words, so that this test machine can be selected in creating test assignment step.This step can make system resource recycle, and has further saved resource, has improved the efficiency of system.
The method method that the present embodiment provides also comprises the steps:
Generate test report: test machine, after test assignment will be finished, is automatically generated test report and is sent to the E-mail address of appointment by software control.In the present embodiment, in test event management server, can specify some E-mail address, the automated test tool QTP on test machine executes after test assignment, and meeting automatically generates test report and is sent to the E-mail address of appointment.This step can make tester see intuitively test result, has saved certain personnel cost, has improved work efficiency.
Embodiment tri-
As shown in Figure 2 and Figure 3, the present embodiment provides a kind of Application testing system of controlling based on operation flow, native system application testing management tool Testlink and automated function test instrument QTP, be HP QuickTest Professional, and the JAVA multithreading Sockect communication technology realize each unit in system and their annexation.
The system that the present embodiment provides comprises:
Data storage cell 201, for building database; The database that the present embodiment adopts foundation to be exclusively used in test event is realized the function of data storage cell.
Workflow management unit 202, for setting up protos test suite PROTOS and test case and the corresponding relation of the two, for setting up the corresponding relation of test script and test case; The present embodiment adopts test case management functional module and the testing requirement management function module realization flow administrative unit in test event management tool Testlink.
Task creation unit 203, for defining test plan, creating test assignment;
The execution Implement of Function Module task creation unit of test case in the present embodiment employing test event management tool Testlink to the formulation functional module of the overlay management functional module of testing requirement, test plan, test case.
Because workflow management unit 202 and task creation unit 203 are all to utilize the existing functional module of test event management tool Testlink to realize function separately, so the present embodiment is used test event management server 207 integrated flow administrative units 202 and task creation unit 203, Testlink is installed on described test event management server 207 and Testlink is carried out to secondary development.
Task executing units 204, for carrying out test assignment; The present embodiment adopts the JAVA multithreading Sockect communication technology of automated function test instrument QTP and server and terminal to realize the function of task executing units.In the present embodiment, task executing units comprises a server and a plurality of test machine, and each test machine is connected with same server; Concrete connected mode be use Java language design a set of software be arranged on server and test machine on, on server, specify this serverless backup and the connectivity port of test machine and the connectivity port of book server and test event management server, on test machine, for each test machine name, server ip and connectivity port that appointment will connect.
Further, the task executing units that the present embodiment provides, as shown in Figure 3, the task executing units of the present embodiment system comprises a plurality of servers and a plurality of test machine, each server connects to form some tasks carrying subelements with an arbitrarily individual test machine.Test machine 1, test machine 2, test machine 3 totally 3 test machines and server 1 have been connected to form first task and have carried out subelement 301; Test machine 4, test machine 5 totally 2 test machines and server 2 have connected to form the second tasks carrying subelement 302.Between server in the present embodiment and test machine, adopt the JAVA multithreading Sockect communication technology to communicate.A plurality of tasks carrying subelements of native system can be shared test assignment effectively, further improve the efficiency of system, reduce the time that implementation spends.
Described workflow management unit is set up protos test suite PROTOS and test case and the corresponding relation of the two, is set up the corresponding relation of test script and test case according to the data in data storage cell; The content-defined test plan that described task creation unit is set up according to workflow management unit, establishment test assignment; The information that described task executing units sends according to task creation unit the data of reading out data storage unit are carried out test assignment.That summarizes says, the distributed application program test macro of controlling based on operation flow that the present embodiment provides, comprises a test event management server 207, and described test event management server 207 comprises workflow management unit 202 and task creation unit 203; Test event management server 207 is connected with data storage cell 201, reads or store data; Described test event management server 207 is also connected with task executing units 204, sends or accept data; Described task executing units 204 comprises a server and a plurality of test machine.
Further, in the system providing at the present embodiment, the operating system of a plurality of test machines is not identical.The operating system of test machine can be windows operating system, iOS handheld equipment operating system etc.; Accordingly, the kind of test machine is not identical yet, and test machine can be fixed terminal, mobile terminal, handheld device etc.; For different test machine environment, the automated test tool of applying on test machine is not identical yet.Native system can cross-platform test multiple systems application program, the extendability of system is strengthened.
Further, the system that embodiment provides also comprises:
Data Management Unit 205, for maintenance test data; Described Data Management Unit is safeguarded the test data used of the test case in the protos test suite PROTOS of setting up in workflow management unit.The present embodiment adopts the test case management Implement of Function Module Data Management Unit of test and management instrument Testlink, identical with task creation unit 203 with workflow management unit 202, the present embodiment is integrated in Data Management Unit 205 on test event management server 207.
Further, the system that the present embodiment provides also comprises:
Mission Monitor unit 206, for progress and the result of feedback test machine execution test assignment; The data that described Mission Monitor unit produces according to task executing units are fed back.The present embodiment adopts the software of Java language design to be arranged on the function that realizes Mission Monitor unit in test event management server and task executing units.
Above are only preferred embodiment of the present invention and institute's application technology principle.Skilled person in the art will appreciate that and the invention is not restricted to specific embodiment described here, can carry out for a person skilled in the art various obvious variations, readjust and substitute and can not depart from protection scope of the present invention.Therefore, although the present invention is described in further detail by above embodiment, the present invention is not limited only to above embodiment, in the situation that not departing from the present invention's design, can also comprise more other equivalent embodiment, and scope of the present invention is determined by appended claim scope.