CN102981958A - Method and device for testing software - Google Patents

Method and device for testing software Download PDF

Info

Publication number
CN102981958A
CN102981958A CN2012105570002A CN201210557000A CN102981958A CN 102981958 A CN102981958 A CN 102981958A CN 2012105570002 A CN2012105570002 A CN 2012105570002A CN 201210557000 A CN201210557000 A CN 201210557000A CN 102981958 A CN102981958 A CN 102981958A
Authority
CN
China
Prior art keywords
testing procedure
testing
information
procedure
retry
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012105570002A
Other languages
Chinese (zh)
Other versions
CN102981958B (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.)
Juhaokan Technology Co Ltd
Original Assignee
Qingdao Hisense Media Network 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 Qingdao Hisense Media Network Technology Co Ltd filed Critical Qingdao Hisense Media Network Technology Co Ltd
Priority to CN201210557000.2A priority Critical patent/CN102981958B/en
Publication of CN102981958A publication Critical patent/CN102981958A/en
Application granted granted Critical
Publication of CN102981958B publication Critical patent/CN102981958B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for testing software. The method comprises the steps: a sample script is used for analyzing during the testing process of tested software; during the process of performing each testing step in sequence according to the analysis result, if the current testing step is a step needing verification, the testing step is performed according to the step performing information of the testing step, after the performing result is obtained, a method indicated by the verification method name of the testing step is called, and the expected value and verification object information of the testing step are transmitted to the method to verify the performing result. Because a testing person can conveniently configure the corresponding verification method name in the sample script for testing according to a verification requirement; after the sample script for testing is analyzed, the corresponding method can be dynamically called according to the configured verification method to achieve the verification requirement; and during the process, the testing person does not involve programming, so that the testing person concentrates more on testing logically related contents, and efficiently and quickly finishes a complicate testing task.

Description

Method for testing software and proving installation
Technical field
The present invention relates to the software test field, relate in particular to a kind of method for testing software and proving installation.
Background technology
Software test always is that very crucial in the software development also is a very loaded down with trivial details ring; Along with the development of software company, product line constantly enlarges, and the software redaction is constantly released, and the platform of support is more and more abundanter, and how efficiently, fast software product is tested becomes the problem that software test team faces.Increasing project team is considering that the software software product is carried out Automation regression testing, considers to choose the automation tools that is fit to own project team.In the face of various, the miscellaneous automation tools of number, selection neither part thing easily.The automated test tool of increasing income has the testing tools such as Selenium, Watir, commercial testing tool such as Rational Functional Tester, Rational Robot, the QuickTest Professional of Hewlett-Packard Corporation of Hewlett-Packard, SilkTest of Borland company etc. of the IBM of International Business Machine Corporation (IBM).The Open-Source Tools use cost is lower, but function is abundant not as business tool.Business tool can provide powerful recording function, by the beginner is liked, is not the automatic test optimal case but record script.Test data and the shell script recorded in the script are mixed in together, are difficult to safeguard; In addition, when larger change occurs in test case, maintenance use case and again record the energy that use-case spends and make no distinction of rank.But no matter use that increase income or commercial automated test tool, all need the tester to be familiar with the exploitation programming language.The programming threshold greatly outstanding operational trials expert can only be stopped to automatic test look at afar.
Therefore, at the Wb(network) application software or Android(Android) field tests of application software, how increasing test macro development teams allows the professional expert who is unfamiliar with programming also can write the Automation regression testing use-case in research.The mode of operation of current trend is: the tester uses XML(ExtensiveMakeupLanguage, extensible markup language) the maintenance test use-case, only need maintenance test logic content associated with the data; The test macro developer provides the testing engine of processing XML use-case script file.Tester's use test engine is carried out XML use-case script file and is finished test process.
But under the test sight of complexity, correctly carry out in order to ensure testing procedure, need to increase various check posts.Such as, need the control on the checking Web page whether to exist, maybe need the comparison expectation value whether to equate, whether comprise with the actual characters string, whether comprise prefix, suffix, maybe need relatively to expect whether equate with real figure, whether greater than, equal, less than etc.Yet the XML-based of prior art can not provide the function that the check post is verified with the testing engine of case script; For the testing procedure execution result is verified, the tester has to carry out complicated programing work and realizes the automatic Verification of check post; This be so that the tester can't be absorbed in the relevant content of test logic, and, also can't finish efficiently, fast test assignment.
In sum, the XML-based of prior art can't provide for the tester function of validation test step execution result with the method for testing of case script, so that the tester can't finish the test assignment of more complicated efficiently, fast.
Summary of the invention
Embodiments of the invention provide a kind of method for testing software and proving installation, in order to the method for testing based on the test case script of the function with validation test step execution result to be provided, so that the tester finishes the test assignment of more complicated efficiently, fast.
According to an aspect of the present invention, provide a kind of method for testing software, having comprised:
Test case script to tested software is resolved; Put down in writing the step execution information for each testing procedure configuration in the described test case script, and be the step authorization information of the need verification step configuration in the described testing procedure, comprise in the described step authorization information: verification method title, expectation value, identifying object information;
Carrying out successively according to analysis result in the process of each testing procedure, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, after obtaining execution result, call the method that the verification method name referring of this testing procedure shows, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified.
Wherein, described identifying object information is specially variable name; And
The method that the described verification method name referring that calls this testing procedure shows, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified, be specially:
Call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure, and the identifying object information of this testing procedure is passed in the method; The method is according to described expectation value, to being verified by the value of the variable of described variable name indication in the described execution result;
Perhaps, described identifying object information is specially the locating information of identifying object; And
The method that the described verification method name referring that calls this testing procedure shows, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified, be specially:
Call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure, and the locating information of the identifying object of this testing procedure is passed in the method, from the page as execution result, locate identifying object according to the locating information of described identifying object by the method, and according to described expectation value the value of the identifying object of location is verified.
Further, described step authorization information also comprises: the number of retries setting value; And
Described expectation value with this testing procedure be passed in the method described execution result verified after, also comprise:
If the result that the method is returned is unsuccessfully, then carry out retry according to the number of retries setting value of this testing procedure:
In retry procedure, again after carrying out this testing procedure of information and executing according to the step of this testing procedure, call again the method that the verification method name referring of this testing procedure shows, again according to the expectation value of this testing procedure the execution result of this testing procedure is verified;
If determine that the result that the method is returned in this time retry procedure still is unsuccessfully, then after the number of retries setting value of number of times less than this testing procedure of determining retry, carry out next retry procedure;
If determine that the result that the method is returned in this time retry procedure is successfully, determine that then the final the result of this testing procedure is successfully.
Further, described step authorization information also comprises: the check post classification; And
After described number of retries setting value according to this testing procedure is carried out retry, also comprise:
If the final the result of this testing procedure that obtains is unsuccessfully, then:
If determine that the check post classification of this testing procedure for asserting classification, then stops the execution of described test case script, the report failure result;
Be the checking classification if determine the check post classification of this testing procedure, then carry out the next testing procedure of information and executing according to the step of next testing procedure.
Further, described step authorization information also comprises: verification tool information; And
Before the method that the described verification method name referring that calls this testing procedure shows, also comprise:
Determine the affiliated instrument of described method; And
Described test case script is extensible markup language XML form.
According to another aspect of the present invention, also provide a kind of software testing device, having comprised:
The test case parsing module is used for the test case script of tested software is resolved; Put down in writing the step execution information for each testing procedure configuration in the described test case script, and be the step authorization information of the need verification step configuration in the described testing procedure, comprise in the described step authorization information: verification method title, expectation value, identifying object information;
Testing execution module, be used in the process of carrying out successively each testing procedure according to the analysis result of described test case parsing module, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, after obtaining execution result, call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure and and identifying object information be passed in the method described execution result verified.
Further, described step authorization information also comprises: the number of retries setting value; And
Described testing execution module described expectation value with this testing procedure be passed in the method described execution result verified after, if also be used for determining that the result that the method is returned is unsuccessfully, then carry out retry according to the number of retries setting value of this testing procedure:
In retry procedure, after described testing execution module is carried out this testing procedure of information and executing according to the step of this testing procedure again, call again the method that the verification method name referring of this testing procedure shows, again according to the expectation value of this testing procedure the execution result of this testing procedure is verified;
If described testing execution module determines that the result that the method is returned in this time retry procedure still is unsuccessfully, then after the number of retries setting value of number of times less than this testing procedure of determining retry, carry out next retry procedure;
If described testing execution module determines that the result that the method is returned in this time retry procedure is successfully, determine that then the final the result of this testing procedure is successfully.
Further, described step authorization information also comprises: the check post classification; And
Described testing execution module also is used for after described number of retries setting value according to this testing procedure is carried out retry, if the final the result of this testing procedure that obtains is unsuccessfully, then: if the check post classification of definite this testing procedure is for asserting classification, then stop the execution of described test case script, the report failure result; Be the checking classification if determine the check post classification of this testing procedure, then carry out the next testing procedure of information and executing according to the step of next testing procedure.
Wherein, described testing execution module comprises: testing procedure performance element, authentication unit, retry unit;
Described testing procedure performance element is used for carrying out successively according to described analysis result the process of each testing procedure, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, obtain execution result after, send the checking notice;
Described authentication unit is used for after receiving the checking notice of described testing procedure performance element transmission, call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure and and identifying object information be passed in the method described execution result verified; And
Described authentication unit also is used for if also be used for determining that the result that the method is returned be unsuccessfully, then notifying to described retry unit transmission retry after described expectation value with this testing procedure is passed to the method described execution result is verified;
Described retry unit is used for the number of retries counting to this testing procedure, and after receiving described retry notice, if determine that the number of retries of this testing procedure is less than the number of retries setting value of this testing procedure, then determine this testing procedure is carried out retry one time, send the retry notice to described testing procedure performance element;
Described testing procedure performance element also is used for again carrying out this testing procedure of information and executing according to the step of this testing procedure after receiving described retry notice, and after obtaining execution result, sends described checking notice; And
Described retry unit also is used for after receiving described retry notice, be equal to or greater than the number of retries setting value of this testing procedure if determine the number of retries of this testing procedure, then: if the check post classification of determining this testing procedure for asserting classification, then sends to described testing execution module and stops notice; Be the checking classification if determine the check post classification of this testing procedure, then send to described testing execution module and continue notice; And
Described testing procedure performance element also is used for stopping the execution of described test case script, the report failure result according to described termination notice; Or according to the next testing procedure of described continuation notice execution.
Further, described device also comprises:
The test case generation module is used for receiving the tester and carries out information for the step of each testing procedure configuration, and the step authorization information of the need verification step in the testing procedure; Generate described test case script according to the information that receives by predetermined format;
The test case memory module is used for storing the test case script that described test case generation module generates; And
Described test case parsing module also is used for obtaining described test case script according to test instruction from described test case memory module.
In the technical scheme of the embodiment of the invention, because the tester can be according to the checking demand, the corresponding verification method title of configuration in the test case script; After the test case script is resolved, utilize the characteristic of Java reflex mechanism capable of dynamic call method, class, realize calling the respective party the function of the law according to the verification method title of configuration, thereby realize the checking demand; In this process, the tester need not relate to programming, and only need understand the title that some can realize the method for the demand of verifying, so that the tester more is absorbed in the relevant content of test logic, can finish efficiently, fast the test assignment of more complicated.
Further, the tester also can dispose the number of retries predetermined value in the test case script; Control the number of times of checking retry according to the number of retries predetermined value of configuration, the tester can realize the repeatedly retry verified easily; Further help the tester to finish efficiently, fast the test assignment of more complicated.
Description of drawings
Fig. 1 is the method flow diagram that tested software is tested of the embodiment of the invention;
Fig. 2 is the inner structure block diagram of the software testing device of the embodiment of the invention;
Fig. 3 is the inner structure block diagram of the testing execution module of the embodiment of the invention.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, referring to accompanying drawing and enumerate preferred embodiment, the present invention is described in more detail.Yet, need to prove that many details of listing in the instructions only are in order to make the reader to one or more aspects of the present invention a thorough understanding be arranged, even if there are not these specific details also can realize these aspects of the present invention.
The terms such as " module " used in this application, " system " are intended to comprise the entity relevant with computing machine, such as but not limited to hardware, firmware, combination thereof, software or executory software.For example, module can be, but be not limited in: the thread of the process of moving on the processor, processor, object, executable program, execution, program and/or computing machine.For instance, the application program of moving on the computing equipment and this computing equipment can be modules.One or more modules can be positioned at an executory process and/or thread, and module also can be on the computing machine and/or be distributed between two or more the computing machines.
The present inventor finds that checking demands different in the test process needs different power functions to realize; And most checking demands can be by utilizing Java(object oriented program language) power function that provides of reflex mechanism dynamic call realizes.
For example, the checking demand that whether exists for Confirmation Controls, take the automated test tool Selenium of open source code as example, the method that can call comprises as follows:
IsElementPresent (String arg0) is used for judging whether certain page elements exists;
IsAlertPresent (String arg0) is used for judging whether certain prompted dialog frame exists;
IsConfirmationPresent () (String arg0) is used for judging whether certain affirmation dialog box exists;
IsTextPresent (String arg0) is used for judging whether certain the text field exists.
For the checking demand of character string, then can utilize the unit testing framework of JUnit(Java language) assertThat assert grammer, its method that can call comprises as follows:
AssertThat (testedString, containsString (" expected value ")) is used for judging whether character string comprises;
AssertThat (testedString, endsWith (" suffix ")) is used for judging whether character string comprises certain suffix;
AssertThat (testedString, startsWith (" prefix ")) is used for judging whether character string comprises certain prefix;
AssertThat (testedValue, equalToIgnoringCase (expectedValue)) is used for judging whether character string equates, and ignorecase.
For the checking demand of numerical value, the method for calling of utilizing JUnit assertThat to assert that grammer provides comprises:
AssertThat (testedNumber, greaterThan (16.0)) is used for judging that whether numerical value is greater than certain numeric ratio such as numerical value 16.0;
AssertThat (testedNumber, lessThan (16.0)) is used for judging that whether numerical value is less than certain numeric ratio such as numerical value 16.0;
AssertThat (testedNumber, greaterThanOrEqualTo (16.0)) is used for judging that whether numerical value is more than or equal to certain numeric ratio such as numerical value 16.0;
AssertThat (testedNumber, lessThanOrEqualTo (16.0)) is used for judging whether numerical value is less than or equal to certain numeric ratio such as numerical value 16.0;
JUnit assertThat asserts that the method called that grammer provides can also support other checking demands, such as set and tabulation etc.
The method with better readability of utilizing Java reflex mechanism dynamic call Selenium, JUnit etc. to provide, the tester just can recognize the general function of the method according to the method name of certain method; If the tester calls these methods according to checking demand coding code, can not significantly improve testing efficiency; Yet, if allow the tester can realize that the method name of the method for the demand of verifying is configured in the test case script; And after the test case script resolved, utilize the characteristic of Java reflex mechanism capable of dynamic call method, class, realize calling the respective party the function of the law according to the method name of configuration, thereby realize the checking demand.Like this, the tester only needs the corresponding method name of configuration in the test case script, and need not relate to programming when realizing the checking demand; So that the tester more is absorbed in the relevant content of test logic, can finish efficiently, fast the test assignment of more complicated.
Describe the technical scheme of the embodiment of the invention in detail below in conjunction with accompanying drawing.The software testing device that the embodiment of the invention provides can provide for the tester configuration interface of test case; By configuration interface, the tester can input the step of each testing procedure and carry out information; The step of testing procedure is carried out information and can be comprised: number of steps (index), step type (type), step title (name), step parameter.If what testing procedure was related is page control, then step parameter is the locating information of test elements object, in the test case script with XPath(XML Path Language, XML path language) labeled marker; If testing procedure need to be inputted data, then step parameter is for needing the data of input, with the VALUE(data) labeled marker.
For the need verification step in the testing procedure, the tester also can pass through configuration interface, inputs the step authorization information of this testing procedure.The step authorization information of testing procedure can comprise: verification method title, expectation value;
Further, the step authorization information of testing procedure also can comprise: the locating information of number of retries setting value, check post classification, identifying object; Further, the step authorization information also can comprise: verification tool information.
Configuration interface is after the relevant information of each testing procedure that has received tester's input, and software testing device is pressed predetermined format generating test use case script.
The below shows the test case script example of a concrete XML form:
Figure BDA00002615735800081
Figure BDA00002615735800091
In the above-mentioned test case script example, the first row is the XML statement, and it has defined version (1.0) and the employed coding (UTF-8) of XML; Afterwards, the processing instruction that is appointment is provided with XLST (Extensible Stylesheet Language Transformations, extensible stylesheet table code-switching) conversion, can make the viewed device of test case XML file energy open and be shown as HTML(HypertextMarkup Language, HTML (Hypertext Markup Language)) form.XSLT is a W3C standard, XML can be converted to other form, such as html format.Each SUITE(protos test suite PROTOS) element can be specified the configuration information that use-case is carried out, such as the automated test tool Selenium information of browser and open source code etc.Each TEST(test) the element correspondence a test case, and each TEST comprises some STEP(steps) element, corresponding different testing procedure.Each STEP labeled marker goes out the relevant information of testing procedure, comprises step execution information and step authorization information.For example, step 1 is used for input user account title in the example, and step 2 is used for input user's password, and step 3 is used for clicking login button, finishes login feature.Wherein step 3 is for needing verification steps, and the check post classification in the step authorization information of this testing procedure is verified by VERIFY() labeled marker is the checking classification; If the check post classification in the step authorization information of other testing procedure is asserted by ASSERT() labeled marker, show that then this check post classification is for asserting classification; The verification method title is by the METHOD(method) labeled marker, be equalToIgnoringCase, be used for judging whether two string datas equate; Expectation value is by the ARGUMENT(parameter) labeled marker, for " welcoming you, the keeper! "; The locating information of identifying object is by the actual(actual value) labeled marker, for //span[@name=' welcome '], indicate the locating information of identifying object in display page; The number of retries setting value is by the retry(retry) labeled marker; Verification tool information is by the type(type) labeled marker.In the above-mentioned example, type=' assertThat ' expression uses JUnit assertThat to assert that semantic tools verify; Can specify type=' Selenium ' in other situation, adopt automated test tool Selenium to the checking of page control element, etc.
According to above-mentioned test case script, the concrete grammar flow process that the software testing device that the embodiment of the invention provides is tested tested software as shown in Figure 1, comprises the steps:
S101: the test case script to tested software is resolved, and makes i=1, number of retries j=1.
In this step, software testing device is resolved the test case script of tested software, therefrom parse the step execution information into each testing procedure configuration, and be the step authorization information of the need verification step configuration in the described testing procedure, as analysis result.
After obtaining analysis result, software testing device will be carried out each testing procedure according to analysis result successively according to following steps; Before carrying out each testing procedure, software testing device makes i=1, number of retries j=1.
S102: carry out i testing procedure.
In this step, software testing device is carried out information according to the step of current testing procedure, and namely the step of i testing procedure is carried out this testing procedure of information and executing; After this testing procedure is finished, obtain execution result.Automated test tool all provides the mode of location Web page control, take Selenium as example, it can pass through CSS (Cascading Style Sheets, CSS (cascading style sheet)), client script language Javascript and XPath location control, and mode is very abundant.The step type correspondence the application programming interface API(Application Program Interface of testing tool, application programming interfaces), testing tool the similar Click of clicking all be provided, double-click DoubleClick, pull DragAndDown, the API of the type action such as input data.Particularly, software testing device calls corresponding Selenium method according to step type, and imports step parameter into the method and finish testing procedure.
For example, the software test step of using for Web can be that page control is carried out certain action; For example control can be input frame, login button, and the action of execution can be the input data, or clicks;
Such as, in the above-mentioned test case script example, the testing procedure of index=" 1 " is the 1st testing procedure, indicating the test elements object according to step type type=" Type.INPUT " is the control input frame, according to the test elements object locating information<XPATH in the step parameter〉//input[@id='user']</XPATH can the assignment test element object in the position of the page, according to the data<VALUE of the input of the needs in the step parameter admin</VALUE indicate the data of input frame input; The testing procedure of carrying out information and executing according to the step of this testing procedure is: the id of page attribute for ' input " admin " in the input frame of user '.
How to carry out the technology that the information and executing testing procedure is well known to those skilled in the art according to the step of testing procedure, repeat no more herein.
S103: judge whether i testing procedure is to need verification step; If execution in step S104 verifies; Otherwise execution in step S110 carries out the execution of next testing procedure.
In this step, software testing device can judge whether current testing procedure is to need verification step according to the step authorization information that whether has i testing procedure in the analysis result; For example, for above-mentioned test case script example, in the testing procedure of the testing procedure of index=" 1 ", index=" 2 ", the step authorization information that does not indicate with check post classification VERIFY or ASSERT; In the testing procedure of index=" 3 ", then has the step authorization information that indicates with VERIFY; Thus, can judge the testing procedure of index=" 3 ", namely the 3rd testing procedure is for needing verification step.
After software testing device was determined current testing procedure and is verification step, execution in step S104 verified; Otherwise execution in step S110 carries out the execution of next testing procedure.
S104: the execution result to i testing procedure is verified.
Determine current testing procedure for after needing verification step at software testing device, in this step, software testing device is verified the execution result that obtains among the step S102: software testing device utilizes reflex mechanism Dynamic Acquisition Matchers(coupling) example of class, and the method shown of the verification method name referring that calls this testing procedure, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified.
Particularly, described identifying object information can be variable name, call the method in the Java reflex mechanism that the verification method name referring of this testing procedure shows, and the expectation value of this testing procedure and the variable name in the identifying object information be passed in the method described execution result is verified; After namely calling the method, the value of the variable of being indicated by described variable name in the expectation value that the method will be imported into and the execution result compares, thereby to being verified by the value of the variable of described variable name indication in the described execution result, be verified the result and return.
Perhaps, the described identifying object information locating information that can be identifying object; Identifying object is generally the control on the page; Call the method in the Java reflex mechanism that the verification method name referring of this testing procedure shows, and the expectation value of this testing procedure and the locating information of identifying object be passed in the method, from the page as execution result, locate identifying object according to the locating information of described identifying object by the method, and according to described expectation value the value of the identifying object of location is verified.
For example, a process of verifying according to the step authorization information of the 3rd testing procedure of above-mentioned test case script example: call the method by the equalToIgnoringCase indication, import expectation value in the method " to welcome you, the keeper! ", and the locating information of identifying object " //span[@name=' welcome '] "; The method is obtained the value of identifying object after navigating to the identifying object on the page according to " //span[@name=' welcome '] "; If the value of identifying object is consistent with expectation value, then return successful the result; Otherwise, return the result of failure.
Further, verify at the execution result that software testing device obtains in to step S102, call before the method that the verification method name referring of this testing procedure shows, can also be by the verification tool information in the step authorization information, determining is the method for calling in which instrument, namely determines the affiliated instrument of method that the verification method name referring shows; Like this, can determine corresponding tool according to verification tool information first, then call correlation method in this instrument according to the verification method title.
S105: verify among the determining step S104 that resulting the result is successfully still failure; If success, then execution in step S110 carries out the execution of next testing procedure; If failure, then execution in step S106 carries out retry according to the number of retries setting value.
The result that the method that the software testing device judgement is called is returned is success or failure; If success, then execution in step S110 carries out the execution of next testing procedure; If failure, then execution in step S106 carries out retry according to the number of retries setting value.
S106: judge that j is whether less than the number of retries setting value of i testing procedure; If make j=j+1 and jump to step S102 and again carry out i testing procedure; Otherwise execution in step S107 finishes retry.
The number of retries setting value of current testing procedure has indicated the number of times that this testing procedure is allowed to retry; If software testing device is judged number of retries j less than the number of retries setting value of current testing procedure, make j=j+1 and jump to step S102 and again carry out i testing procedure; Otherwise execution in step S107 finishes retry.
S107: the check post classification of judging i testing procedure; If the classification of asserting, then execution in step S120 finishes test, reports unsuccessfully; If the checking classification, then execution in step S110 carries out the execution of next testing procedure.
Particularly, the check post classification of testing procedure can be two kinds, and a kind of is to assert classification, and another kind is the checking classification; Assert that the classification indication stops this test, the indication of checking classification can be proceeded test.
If software testing device is judged the check post classification of current testing procedure for asserting then execution in step S120 end test of classification, report unsuccessfully; If the checking classification, then execution in step S110 carries out the execution of next testing procedure.
S110: judge whether i testing procedure is last testing procedure; If jump to step S111 and finish test; Otherwise, make i=i+1, number of retries j=1 after, jump to the execution that step S102 carries out next testing procedure.
S111: finish test, the report test result.
Behind all testing procedures that is finished, proving installation can generate the test result report as test result with the execution result of each testing procedure, the result, number of retries etc. to be showed.Proving installation can the html page form be showed, or showed with other form.
S120: finish test, report unsuccessfully.
The inner structure block diagram of the software testing device that the embodiment of the invention provides as shown in Figure 2, comprising: test case parsing module 201, testing execution module 202.
Test case parsing module 201 is used for the test case script of tested software is resolved; Put down in writing the step execution information for each testing procedure configuration in the described test case script, and be the step authorization information of the need verification step configuration in the described testing procedure, comprise in the described step authorization information: verification method title, expectation value, identifying object information; Further, described step authorization information also can comprise: number of retries setting value, check post classification;
Testing execution module 202 is used in the process of carrying out successively each testing procedure according to the analysis result of test case parsing module 201, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, after obtaining execution result, call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure and and identifying object information be passed in the method described execution result verified.
Further, testing execution module 202 described expectation value with this testing procedure be passed in the method described execution result verified after, if also be used for determining that the result that the method is returned is unsuccessfully, then carry out retry according to the number of retries setting value of this testing procedure:
In retry procedure, after testing execution module 202 is carried out this testing procedure of information and executing according to the step of this testing procedure again, call again the method that the verification method name referring of this testing procedure shows, again according to the expectation value of this testing procedure the execution result of this testing procedure is verified;
If testing execution module 202 determines that the result that the method is returned in this time retry procedure still is unsuccessfully, then after the number of retries setting value of number of times less than this testing procedure of determining retry, carry out next retry procedure;
If testing execution module 202 determines that the result that the method is returned in this time retry procedure is successfully, determine that then the final the result of this testing procedure is successfully.
Further, testing execution module 202 also is used for after described number of retries setting value according to this testing procedure is carried out retry, if the final the result of this testing procedure that obtains is unsuccessfully, then: if the check post classification of definite this testing procedure is for asserting classification, then stop the execution of described test case script, the report failure result; Be the checking classification if determine the check post classification of this testing procedure, then carry out the next testing procedure of information and executing according to the step of next testing procedure.
Further, also can comprise in the software testing device: test case generation module 203, test case memory module 204.
Test case generation module 203 is used for receiving the tester and carries out information for the step of each testing procedure configuration, and the step authorization information of the need verification step in the testing procedure; Generate described test case script according to the information that receives by predetermined format; For example, test case generation module 203 can provide a patterned XML use-case editing machine for the tester, can friendly, the quick test case script that must generate according to tester's input the XML form.
Testing execution module 202 is being carried out the complete rear generation test result report of each testing procedure successively according to the analysis result of test case parsing module 201.
Test case memory module 204 is used for the test case script that storage test case generation module 203 generates; And
Test case parsing module 201 also is used for obtaining described test case script according to test instruction from described test case memory module.
Further, also can comprise in the software testing device: test case script display module 205, test result display module 206.
Test case script display module 205 is used for the test case script of test case memory module 204 storages is showed; For example, for the test case script of XML form, use the XSLT technology, be converted into html format, use browser to show.
Test result display module 206 is showed the test result report that testing execution module 202 generates.
Inner structure block diagram in the above-mentioned testing execution module 202 can as shown in Figure 3, comprise: testing procedure performance element 301, authentication unit 302, retry unit 303.
Testing procedure performance element 301 is used for carrying out successively according to described analysis result the process of each testing procedure, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, obtain execution result after, send the checking notice;
Authentication unit 302 is used for after the checking notice that receives 301 transmissions of testing procedure performance element, call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure and and identifying object information be passed in the method described execution result verified; And
Authentication unit 302 also is used for after described expectation value with this testing procedure is passed to the method described execution result is verified, if also be used for determining that the result that the method is returned be unsuccessfully, then 303 transmission retries are notified to the retry unit;
Retry unit 303 is used for the number of retries counting to this testing procedure, and after receiving described retry notice, if determine that the number of retries of this testing procedure is less than the number of retries setting value of this testing procedure, then determine this testing procedure is carried out retry one time, send the retry notice to testing procedure performance element 301;
Testing procedure performance element 301 also is used for again carrying out this testing procedure of information and executing according to the step of this testing procedure after receiving described retry notice, and after obtaining execution result, sends described checking notice; And
Retry unit 303 also is used for after receiving described retry notice, be equal to or greater than the number of retries setting value of this testing procedure if determine the number of retries of this testing procedure, then: if the check post classification of determining this testing procedure for asserting classification, then sends to testing execution module 301 and stops notice; Be the checking classification if determine the check post classification of this testing procedure, then send to testing execution module 301 and continue notice; And
Testing procedure performance element 301 also is used for stopping the execution of described test case script, the report failure result according to described termination notice; Or according to the next testing procedure of described continuation notice execution.
In the technical scheme of the embodiment of the invention, because the tester can be according to the checking demand, the corresponding verification method title of configuration in the test case script; After the test case script is resolved, utilize the characteristic of Java reflex mechanism capable of dynamic call method, class, realize calling the respective party the function of the law according to the verification method title of configuration, thereby realize the checking demand; In this process, the tester need not relate to programming, and only need understand the title that some can realize the method for the demand of verifying, so that the tester more is absorbed in the relevant content of test logic, can finish efficiently, fast the test assignment of more complicated.
Further, the tester also can dispose the number of retries predetermined value in the test case script; Control the number of times of checking retry according to the number of retries predetermined value of configuration, the tester can realize the repeatedly retry verified easily; Further help the tester to finish efficiently, fast the test assignment of more complicated.
One of ordinary skill in the art will appreciate that all or part of step that realizes in above-described embodiment method is to come the relevant hardware of instruction to finish by program, this program can be stored in the computer read/write memory medium, as: ROM/RAM, magnetic disc, CD etc.
The above only is preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (10)

1. method for testing software comprises:
Test case script to tested software is resolved; Put down in writing the step execution information for each testing procedure configuration in the described test case script, and be the step authorization information of the need verification step configuration in the described testing procedure, comprise in the described step authorization information: verification method title, expectation value, identifying object information;
Carrying out successively according to analysis result in the process of each testing procedure, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, after obtaining execution result, call the method that the verification method name referring of this testing procedure shows, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified.
2. the method for claim 1 is characterized in that, described identifying object information is specially variable name; And
The method that the described verification method name referring that calls this testing procedure shows, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified, be specially:
Call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure, and the identifying object information of this testing procedure is passed in the method; The method is according to described expectation value, to being verified by the value of the variable of described variable name indication in the described execution result;
Perhaps, described identifying object information is specially the locating information of identifying object; And
The method that the described verification method name referring that calls this testing procedure shows, and the expectation value of this testing procedure and identifying object information is passed in the method described execution result is verified, be specially:
Call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure, and the locating information of the identifying object of this testing procedure is passed in the method, from the page as execution result, locate identifying object according to the locating information of described identifying object by the method, and according to described expectation value the value of the identifying object of location is verified.
3. method as claimed in claim 1 or 2 is characterized in that, described step authorization information also comprises: the number of retries setting value; And
Described expectation value with this testing procedure be passed in the method described execution result verified after, also comprise:
If the result that the method is returned is unsuccessfully, then carry out retry according to the number of retries setting value of this testing procedure:
In retry procedure, again after carrying out this testing procedure of information and executing according to the step of this testing procedure, call again the method that the verification method name referring of this testing procedure shows, again according to the expectation value of this testing procedure the execution result of this testing procedure is verified;
If determine that the result that the method is returned in this time retry procedure still is unsuccessfully, then after the number of retries setting value of number of times less than this testing procedure of determining retry, carry out next retry procedure;
If determine that the result that the method is returned in this time retry procedure is successfully, determine that then the final the result of this testing procedure is successfully.
4. method as claimed in claim 3 is characterized in that, described step authorization information also comprises: the check post classification; And
After described number of retries setting value according to this testing procedure is carried out retry, also comprise:
If the final the result of this testing procedure that obtains is unsuccessfully, then:
If determine that the check post classification of this testing procedure for asserting classification, then stops the execution of described test case script, the report failure result;
Be the checking classification if determine the check post classification of this testing procedure, then carry out the next testing procedure of information and executing according to the step of next testing procedure.
5. method as claimed in claim 4 is characterized in that, described step authorization information also comprises: verification tool information; And
Before the method that the described verification method name referring that calls this testing procedure shows, also comprise:
Determine the affiliated instrument of described method; And
Described test case script is extensible markup language XML form.
6. software testing device comprises:
The test case parsing module is used for the test case script of tested software is resolved; Put down in writing the step execution information for each testing procedure configuration in the described test case script, and be the step authorization information of the need verification step configuration in the described testing procedure, comprise in the described step authorization information: verification method title, expectation value, identifying object information;
Testing execution module, be used in the process of carrying out successively each testing procedure according to the analysis result of described test case parsing module, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, after obtaining execution result, call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure and and identifying object information be passed in the method described execution result verified.
7. device as claimed in claim 6 is characterized in that, described step authorization information also comprises: the number of retries setting value; And
Described testing execution module described expectation value with this testing procedure be passed in the method described execution result verified after, if also be used for determining that the result that the method is returned is unsuccessfully, then carry out retry according to the number of retries setting value of this testing procedure:
In retry procedure, after described testing execution module is carried out this testing procedure of information and executing according to the step of this testing procedure again, call again the method that the verification method name referring of this testing procedure shows, again according to the expectation value of this testing procedure the execution result of this testing procedure is verified;
If described testing execution module determines that the result that the method is returned in this time retry procedure still is unsuccessfully, then after the number of retries setting value of number of times less than this testing procedure of determining retry, carry out next retry procedure;
If described testing execution module determines that the result that the method is returned in this time retry procedure is successfully, determine that then the final the result of this testing procedure is successfully.
8. device as claimed in claim 7 is characterized in that, described step authorization information also comprises: the check post classification; And
Described testing execution module also is used for after described number of retries setting value according to this testing procedure is carried out retry, if the final the result of this testing procedure that obtains is unsuccessfully, then: if the check post classification of definite this testing procedure is for asserting classification, then stop the execution of described test case script, the report failure result; Be the checking classification if determine the check post classification of this testing procedure, then carry out the next testing procedure of information and executing according to the step of next testing procedure.
9. device as claimed in claim 8 is characterized in that, described testing execution module comprises: testing procedure performance element, authentication unit, retry unit;
Described testing procedure performance element is used for carrying out successively according to described analysis result the process of each testing procedure, if current testing procedure is for needing verification step, then carry out complete this testing procedure of information and executing according to the step of this testing procedure, obtain execution result after, send the checking notice;
Described authentication unit is used for after receiving the checking notice of described testing procedure performance element transmission, call the method that the verification method name referring of this testing procedure shows, and with the expectation value of this testing procedure and and identifying object information be passed in the method described execution result verified; And
Described authentication unit also is used for if also be used for determining that the result that the method is returned be unsuccessfully, then notifying to described retry unit transmission retry after described expectation value with this testing procedure is passed to the method described execution result is verified;
Described retry unit is used for the number of retries counting to this testing procedure, and after receiving described retry notice, if determine that the number of retries of this testing procedure is less than the number of retries setting value of this testing procedure, then determine this testing procedure is carried out retry one time, send the retry notice to described testing procedure performance element;
Described testing procedure performance element also is used for again carrying out this testing procedure of information and executing according to the step of this testing procedure after receiving described retry notice, and after obtaining execution result, sends described checking notice; And
Described retry unit also is used for after receiving described retry notice, be equal to or greater than the number of retries setting value of this testing procedure if determine the number of retries of this testing procedure, then: if the check post classification of determining this testing procedure for asserting classification, then sends to described testing execution module and stops notice; Be the checking classification if determine the check post classification of this testing procedure, then send to described testing execution module and continue notice; And
Described testing procedure performance element also is used for stopping the execution of described test case script, the report failure result according to described termination notice; Or according to the next testing procedure of described continuation notice execution.
10. such as the arbitrary described device of claim 6-9, it is characterized in that, also comprise:
The test case generation module is used for receiving the tester and carries out information for the step of each testing procedure configuration, and the step authorization information of the need verification step in the testing procedure; Generate described test case script according to the information that receives by predetermined format;
The test case memory module is used for storing the test case script that described test case generation module generates; And
Described test case parsing module also is used for obtaining described test case script according to test instruction from described test case memory module.
CN201210557000.2A 2012-12-19 2012-12-19 Method for testing software and proving installation Active CN102981958B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210557000.2A CN102981958B (en) 2012-12-19 2012-12-19 Method for testing software and proving installation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210557000.2A CN102981958B (en) 2012-12-19 2012-12-19 Method for testing software and proving installation

Publications (2)

Publication Number Publication Date
CN102981958A true CN102981958A (en) 2013-03-20
CN102981958B CN102981958B (en) 2015-09-30

Family

ID=47856012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210557000.2A Active CN102981958B (en) 2012-12-19 2012-12-19 Method for testing software and proving installation

Country Status (1)

Country Link
CN (1) CN102981958B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103326930A (en) * 2013-06-24 2013-09-25 青岛海信传媒网络技术有限公司 Automatic patrolling method and system for open platform interface
CN104915287A (en) * 2014-03-11 2015-09-16 富士施乐实业发展(中国)有限公司 Method and system for unit testing
CN106649090A (en) * 2016-10-10 2017-05-10 上海瀚之友信息技术服务有限公司 Automated test system and method
CN106776324A (en) * 2016-12-19 2017-05-31 广州酷狗计算机科技有限公司 Interface test method and device
CN107506302A (en) * 2017-08-23 2017-12-22 杭州安恒信息技术有限公司 The method and apparatus that multinomial content accuracy is searched for generally based on selenium checkings
CN107783902A (en) * 2017-09-26 2018-03-09 甘肃万维信息技术有限责任公司 A kind of Selenium automated testing methods and system from coding
CN107908559A (en) * 2017-11-15 2018-04-13 中国农业银行股份有限公司 A kind of Test Case Design method and device
CN108491322A (en) * 2018-03-06 2018-09-04 平安科技(深圳)有限公司 Automated testing method, device and storage medium
CN108733555A (en) * 2017-04-25 2018-11-02 中移信息技术有限公司 A kind of application testing method and device
CN109144856A (en) * 2018-07-27 2019-01-04 北京皮尔布莱尼软件有限公司 A kind of UI automated testing method calculates equipment and storage medium
CN109491919A (en) * 2018-11-28 2019-03-19 中电科西北集团有限公司 A kind of method for testing software and test platform
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case
CN112527665A (en) * 2020-12-18 2021-03-19 上海万向区块链股份公司 Method and system for processing dirty data generated by assertion based on FitNesse framework
CN113407460A (en) * 2021-07-16 2021-09-17 北京字节跳动网络技术有限公司 Page testing method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996131A (en) * 2009-08-19 2011-03-30 航天信息股份有限公司 Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word
CN102819492A (en) * 2012-08-02 2012-12-12 中山大学 Keyword driven automatic testing frame on basis of Android

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996131A (en) * 2009-08-19 2011-03-30 航天信息股份有限公司 Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word
CN102819492A (en) * 2012-08-02 2012-12-12 中山大学 Keyword driven automatic testing frame on basis of Android

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
倪铭等: "基于脚本的构件测试自动化框架", 《计算机工程》, vol. 36, no. 6, 31 March 2010 (2010-03-31), pages 94 - 99 *

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103326930B (en) * 2013-06-24 2016-05-25 青岛海信传媒网络技术有限公司 Open platform interface automatic detecting method and system
CN103326930A (en) * 2013-06-24 2013-09-25 青岛海信传媒网络技术有限公司 Automatic patrolling method and system for open platform interface
CN104915287B (en) * 2014-03-11 2018-07-06 富士施乐实业发展(中国)有限公司 Unit test method and system
CN104915287A (en) * 2014-03-11 2015-09-16 富士施乐实业发展(中国)有限公司 Method and system for unit testing
CN106649090A (en) * 2016-10-10 2017-05-10 上海瀚之友信息技术服务有限公司 Automated test system and method
CN106776324A (en) * 2016-12-19 2017-05-31 广州酷狗计算机科技有限公司 Interface test method and device
CN108733555A (en) * 2017-04-25 2018-11-02 中移信息技术有限公司 A kind of application testing method and device
CN107506302A (en) * 2017-08-23 2017-12-22 杭州安恒信息技术有限公司 The method and apparatus that multinomial content accuracy is searched for generally based on selenium checkings
CN107783902A (en) * 2017-09-26 2018-03-09 甘肃万维信息技术有限责任公司 A kind of Selenium automated testing methods and system from coding
CN107908559A (en) * 2017-11-15 2018-04-13 中国农业银行股份有限公司 A kind of Test Case Design method and device
CN107908559B (en) * 2017-11-15 2021-05-07 中国农业银行股份有限公司 Test case design method and device
CN108491322A (en) * 2018-03-06 2018-09-04 平安科技(深圳)有限公司 Automated testing method, device and storage medium
WO2019169761A1 (en) * 2018-03-06 2019-09-12 平安科技(深圳)有限公司 Automated testing method and apparatus, and storage medium
CN109144856A (en) * 2018-07-27 2019-01-04 北京皮尔布莱尼软件有限公司 A kind of UI automated testing method calculates equipment and storage medium
CN109491919A (en) * 2018-11-28 2019-03-19 中电科西北集团有限公司 A kind of method for testing software and test platform
CN109491919B (en) * 2018-11-28 2021-10-26 中电科西北集团有限公司 Software testing method and testing platform
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case
CN112527665A (en) * 2020-12-18 2021-03-19 上海万向区块链股份公司 Method and system for processing dirty data generated by assertion based on FitNesse framework
CN113407460A (en) * 2021-07-16 2021-09-17 北京字节跳动网络技术有限公司 Page testing method, device, equipment and storage medium
CN113407460B (en) * 2021-07-16 2023-04-11 抖音视界有限公司 Page testing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN102981958B (en) 2015-09-30

Similar Documents

Publication Publication Date Title
CN102981958B (en) Method for testing software and proving installation
US7627821B2 (en) Recording/playback tools for UI-based applications
US8645912B2 (en) System and method for use in replaying software application events
Zeng et al. Studying the characteristics of logging practices in mobile apps: a case study on f-droid
Do et al. Supporting controlled experimentation with testing techniques: An infrastructure and its potential impact
US10176079B2 (en) Identification of elements of currently-executing component script
Hartmann et al. A UML-based approach to system testing
CN103049371A (en) Testing method and testing device of Android application programs
CN103729294B (en) Method and device for testing performance script of application software
CN110716870B (en) Automatic service testing method and device
Marchetto et al. A case study-based comparison of web testing techniques applied to AJAX web applications
Roehm et al. Monitoring user interactions for supporting failure reproduction
EP3443460B1 (en) Method, apparatus, and computer-readable medium for performing functional testing of software
CN102479152A (en) Method and device for obtaining tool automatic test results on basis of Android platform
Amalfitano et al. The DynaRIA tool for the comprehension of Ajax web applications by dynamic analysis
Eldh On test design
CN115904989A (en) Interface testing method, device, equipment and readable storage medium
Menegassi et al. Automated tests for cross‐platform mobile apps in multiple configurations
KR101792864B1 (en) System and Method for verifying application
Pan et al. Effective testing of Android apps using extended IFML models
Gupta et al. Model based approach to assist test case creation, execution, and maintenance for test automation
KR100969877B1 (en) Test automating system
Mann et al. Hybrid test language processing based framework for test case optimization
Gaelli et al. Composing Tests from Examples.
Coppola et al. Translation from visual to layout-based android test cases: A proof of concept

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20170109

Address after: 266100 Shandong Province, Qingdao city Laoshan District Songling Road No. 399

Patentee after: Poly Polytron Technologies Inc

Address before: 266061 Laoshan, Qingdao province Hongkong District No. East Road, room 248, room 131

Patentee before: Hisense Media Networks Co., Ltd.