CN105354035A - Method for compiling test case of web engineering - Google Patents
Method for compiling test case of web engineering Download PDFInfo
- Publication number
- CN105354035A CN105354035A CN201510791831.XA CN201510791831A CN105354035A CN 105354035 A CN105354035 A CN 105354035A CN 201510791831 A CN201510791831 A CN 201510791831A CN 105354035 A CN105354035 A CN 105354035A
- Authority
- CN
- China
- Prior art keywords
- language
- web engineering
- case
- instruction
- writing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention provides a method for compiling a test case of web engineering. The method comprises the following steps: (1) compiling the test case of web engineering according to a specific language; (2) analyzing the grammar of the specific language in the step (1) through an analyzer and converting the test case in the step (1) into an abstract syntax tree; and (3) running the test case through a resolver on the basis of the abstract syntax tree generated by the analyzer in the step (2). According to the method for compiling the test case of web engineering provided by the invention, compiling of the test case of web engineering is relatively simple, relatively abstract and easy to read; and the method is specially designed for compiling the test case, so that the language is more convenient to compile the test case than other languages.
Description
Technical field
The invention belongs to WEB engineering and WEB automatic test field, particularly relating to a kind of method for writing web engineering test use-case.
Background technology
In order to ensure correctness and the reliability of Web engineering, tester's design test case is needed to test Web engineering, conventional method of testing is that use can the instrument of automated function test in a browser, write test case, carry out alternately with browser, test web application, such as Selenium2 is conventional testing tool.
These conventional testing tools all support multiple programming language usually, but no matter use any programming language, and all there is more complicated, be not easy the problem understood, it is not very convenient for writing test case with it.
Summary of the invention
In view of this, the present invention proposes a kind of method for writing Web engineering test use-case, make writing of the test case of Web engineering simple, abstract, easily understand.
For achieving the above object, technical scheme of the present invention is achieved in that a kind of method for writing Web engineering test use-case, comprises step as follows:
Step one: Web engineering test use-case is according to specific language compilation, and described language-specific comprises macro instruction, test instruction, process;
Described macro instruction is used for setting during the self-defined testing results of author;
Whether described test instruction is working properly for testing Web engineering characteristic;
Described process is the set of a series of test instruction;
Step 2: by the grammer of language-specific described in analyzer analyzing step one, and be abstract syntax tree by the test case conversion of step one;
Step 3: by resolver, carrys out testing results use-case based on the abstract syntax tree of parser generation in step 2.
Further, described in step one, the process of language-specific comprises main procedure and subprocess, and main procedure is the entrance of all test instructions, and subprocess is the branching process that main procedure enters.
Further, described in step one, language-specific also comprises control statement, and described control statement is used for performing instruction according to decision condition.
Further, described in step one, language-specific also comprises variable, and described variable is used for reusing inside the action scope of its definition.
Further, analyzer described in step 2 analyzes the grammer of language-specific based on the pattern of recursive descent parsing.
Further, described analyzer is write based on JavaScript language.
Further, resolver described in step 3 performs the instruction in syntax tree successively based on the model of state machine.
Further, described resolver is write based on JavaScript language.
A kind of programming language, applies the method that above-mentioned any one writes Web engineering test use-case.
Relative to prior art, method for writing Web engineering test use-case of the present invention, makes the test case of writing web engineering simpler, more abstract and easily understand, the method designs for writing test case specially, thus ratio other Languages to write test case more convenient.
Embodiment
It should be noted that, when not conflicting, the embodiment in the present invention and the feature in embodiment can combine mutually.
The present invention is described in detail below in conjunction with embodiment.
According to method design Lemoncase language of the present invention.
Lemoncase language is to make the test case of writing web engineering simpler, more abstract and easily understand.This just similar Unreal in order to allow, to write game scripts simpler and more easily understand and invented the special game scripts that Unreal engine can run.
This language has 3 large ingredients:
1. macro instruction: author can self-defined testing results time some setting.
2. test instruction: test instruction is used to test certain characteristic of website/web application conditional statement whether working properly.
3. process: process is the set of a series of test instruction.Process is divided into main procedure and subprocess.Main procedure is exactly the entrance of all test instructions.Subprocess is exactly some branching processes that main procedure may enter.
● grammer
The most basic HelloWorld program is as follows:
Wherein, Processmain represents main procedure."; The result of instruction is record a word in test report.
1. macro instruction
#setMAX_LOOP50
This macro instruction can set main procedure and to rerun how many times.
2. test instruction
wait3000;
click“.btn”;
assert“#login”in10000askey1;
3 general being meant to of instruction above, wait for 3000 milliseconds, and clicking a class is the button of btn, assert to there will be the html element that an id is login in 10000 seconds, and under related data is recorded in this key word of key1.
About assert instruction: the expect in assert and jasmine in this similar node.js, assert whether some html elements meet specific condition.Assert parameter below asserts condition, and acquiescence is a css selector switch, and resolver can be attempted to judge whether the page there is the html element meeting this css selector switch.Can also in addition, assert that the set of the element meeting css selector switch exists? whether the element meeting css selector switch visible on the page? etc..Asserting there is individual optional parameter after condition, occur with the form of in (numeral), it is the time of asserting, if do not have this parameter, program can judge condition at once.When there being parameter, program can wait for certain hour, until meet decision condition or time-out failure.This parameter is very useful when the page has ajax request or page jump.After assertion time, also have another parameter, this parameter is a character string, and effect is below this key word, record the details of the time needed for asserting specifically successfully or time-out error.
3. subprocess
Sub-process name adds that namely a pair bracket represent and calls subprocess at this place of program.
4. control statement
if(n>2)click“.btnG”;
elsereturn;
Decision condition is connect, the instruction performed when be decision condition after then being true, the instruction that else is then condition to be performed when being false after If.
loop100
doclick“#refresh”;
while(“div>.close”){
click“div>.close”;
}
Loop digitized representation cycle index is below the instruction needing in circulation to perform after do.
Be decision condition after while, as long as decision condition is true, do instruction below will be performed.
5. variable
$selector=“input#login”;
inputselectorby“admin”;
$ symbology defines a variable, the same with most of programming language, and variable can be reused inside the action scope of its definition.
● analyzer
The syntax analyzer that Lemoncase language has JavaScript language to write at present.Analyzer is the grammer analyzing Lemoncase based on the pattern of the recursive descent parsing (Recursivedescentparser) of classics, and the Program transformation that user is write be JavaScript can abstract syntax tree (AST).
● resolver
The resolver of Lemoncase is also based on JavaScript.Resolver carrys out testing results use-case based on the abstract syntax tree of parser generation.This resolver is the instruction performed successively based on the model of state machine in syntax tree.
The present invention designs for writing test case specially, thus ratio other Languages to write test case more convenient.
Suppose to use the interface of the webdriverJS of Selenium2 to write test case:
If write with Lemoncase, then can be such:
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (9)
1., for writing a method for Web engineering test use-case, it is characterized in that: comprise step as follows:
Step one: Web engineering test use-case is according to specific language compilation, and described language-specific comprises macro instruction, test instruction, process;
Described macro instruction is used for setting during the self-defined testing results of author;
Whether described test instruction is working properly for testing Web engineering characteristic;
Described process is the set of a series of test instruction;
Step 2: by the grammer of language-specific described in analyzer analyzing step one, and be abstract syntax tree by the test case conversion of step one;
Step 3: by resolver, carrys out testing results use-case based on the abstract syntax tree of parser generation in step 2.
2. a kind of method for writing Web engineering test use-case according to claim 1, it is characterized in that: described in step one, the process of language-specific comprises main procedure and subprocess, main procedure is the entrance of all test instructions, and subprocess is the branching process that main procedure enters.
3. a kind of method for writing Web engineering test use-case according to claim 2, is characterized in that: described in step one, language-specific also comprises control statement, and described control statement is used for performing instruction according to decision condition.
4. a kind of method for writing Web engineering test use-case according to claim 3, is characterized in that: described in step one, language-specific also comprises variable, and described variable is used for reusing inside the action scope of its definition.
5. a kind of method for writing Web engineering test use-case according to claim 1, is characterized in that: analyzer described in step 2 analyzes the grammer of language-specific based on the pattern of recursive descent parsing.
6. a kind of method for writing Web engineering test use-case according to claim 5, is characterized in that: described analyzer is write based on JavaScript language.
7. a kind of method for writing Web engineering test use-case according to claim 1, is characterized in that: resolver described in step 3 performs the instruction in syntax tree successively based on the model of state machine.
8. a kind of method for writing Web engineering test use-case according to claim 7, is characterized in that: described resolver is write based on JavaScript language.
9. a programming language, is characterized in that: apply the method that above-mentioned any one writes Web engineering test use-case.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510791831.XA CN105354035A (en) | 2015-11-17 | 2015-11-17 | Method for compiling test case of web engineering |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510791831.XA CN105354035A (en) | 2015-11-17 | 2015-11-17 | Method for compiling test case of web engineering |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105354035A true CN105354035A (en) | 2016-02-24 |
Family
ID=55330011
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510791831.XA Pending CN105354035A (en) | 2015-11-17 | 2015-11-17 | Method for compiling test case of web engineering |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105354035A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106776343A (en) * | 2017-01-13 | 2017-05-31 | 中国科学院软件研究所 | A kind of web application automated test tool and method |
CN107992421A (en) * | 2017-12-07 | 2018-05-04 | 畅捷通信息技术股份有限公司 | Interface test method and its device and computer installation and its readable storage medium storing program for executing |
CN108008947A (en) * | 2017-12-25 | 2018-05-08 | 上海达梦数据库有限公司 | A kind of intelligent prompt method of programmed statements, device, server and storage medium |
CN109656813A (en) * | 2018-11-21 | 2019-04-19 | 恒为科技(上海)股份有限公司 | A kind of test case operation method and device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1938690A (en) * | 2004-01-13 | 2007-03-28 | 交响乐服务公司 | Method and system for conversion of automation test scripts into abstract test case representation with persistence |
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
CN102087629A (en) * | 2011-01-25 | 2011-06-08 | 南京航空航天大学 | Agent embedded software-based invariant test method and tool |
US8156474B2 (en) * | 2007-12-28 | 2012-04-10 | Cadence Design Systems, Inc. | Automation of software verification |
CN102609352A (en) * | 2011-01-19 | 2012-07-25 | 阿里巴巴集团控股有限公司 | Parallel testing method and parallel testing server |
CN103914379A (en) * | 2014-03-25 | 2014-07-09 | 北京邮电大学 | Automatic fault injection and fault detecting method and system |
-
2015
- 2015-11-17 CN CN201510791831.XA patent/CN105354035A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1938690A (en) * | 2004-01-13 | 2007-03-28 | 交响乐服务公司 | Method and system for conversion of automation test scripts into abstract test case representation with persistence |
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
US8156474B2 (en) * | 2007-12-28 | 2012-04-10 | Cadence Design Systems, Inc. | Automation of software verification |
CN102609352A (en) * | 2011-01-19 | 2012-07-25 | 阿里巴巴集团控股有限公司 | Parallel testing method and parallel testing server |
CN102087629A (en) * | 2011-01-25 | 2011-06-08 | 南京航空航天大学 | Agent embedded software-based invariant test method and tool |
CN103914379A (en) * | 2014-03-25 | 2014-07-09 | 北京邮电大学 | Automatic fault injection and fault detecting method and system |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106776343A (en) * | 2017-01-13 | 2017-05-31 | 中国科学院软件研究所 | A kind of web application automated test tool and method |
CN107992421A (en) * | 2017-12-07 | 2018-05-04 | 畅捷通信息技术股份有限公司 | Interface test method and its device and computer installation and its readable storage medium storing program for executing |
CN108008947A (en) * | 2017-12-25 | 2018-05-08 | 上海达梦数据库有限公司 | A kind of intelligent prompt method of programmed statements, device, server and storage medium |
CN108008947B (en) * | 2017-12-25 | 2020-08-25 | 上海达梦数据库有限公司 | Intelligent prompting method and device for programming statement, server and storage medium |
CN109656813A (en) * | 2018-11-21 | 2019-04-19 | 恒为科技(上海)股份有限公司 | A kind of test case operation method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Schäfer et al. | An empirical evaluation of using large language models for automated unit test generation | |
CN112100054B (en) | Data management and control oriented program static analysis method and system | |
CN110908640B (en) | Method for realizing service function and script engine | |
JP5791698B2 (en) | Code inspection execution system for ABAP source code | |
CN108614707A (en) | Static code inspection method, device, storage medium and computer equipment | |
US20110314337A1 (en) | Method and Apparatus for Locating Input-Model Faults Using Dynamic Tainting | |
CN104899147A (en) | Code static analysis method oriented to security check | |
Zhang et al. | {APICraft}: Fuzz driver generation for closed-source {SDK} libraries | |
Morgado et al. | Automated pattern-based testing of mobile applications | |
CN104035873A (en) | Method and device for generating testing codes | |
CN103914379B (en) | Fault is automatically injected the method with fault detect and system thereof | |
CN105354035A (en) | Method for compiling test case of web engineering | |
CN103294596A (en) | Early warning method for contract-type software fault based on program invariants | |
CN114911711A (en) | Code defect analysis method and device, electronic equipment and storage medium | |
Chen et al. | Cati: Context-assisted type inference from stripped binaries | |
Durfina et al. | Detection and recovery of functions and their arguments in a retargetable decompiler | |
Haque et al. | Fixeval: Execution-based evaluation of program fixes for programming problems | |
Hu et al. | DeGPT: Optimizing Decompiler Output with LLM | |
CN115407997A (en) | Agile development application method and system based on low codes | |
CN111666216B (en) | Intelligent contract analysis method and device | |
Xie et al. | Rest: A tool for reducing effort in script-based testing | |
Wang et al. | [Retracted] Automatic Grading for Complex Multifile Programs | |
Marinho et al. | PLATEM: a method for mobile applications testing | |
Grigorev et al. | String-embedded language support in integrated development environment | |
CN114610320B (en) | LLVM (LLVM) -based variable type information restoration and comparison method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160224 |
|
RJ01 | Rejection of invention patent application after publication |