Professional Documents
Culture Documents
Fangchun Yang
Institute of Network Technology; Engineering Research Center
of Information Network, Ministry of Education
School of Computer Science (National Pilot Software
Engineering School)
Beijing University of Posts and Telecommunications
Beijing, China
fcyang@bupt.edu.cn
Authorized licensed use limited to: Western Sydney University. Downloaded on June 14,2021 at 15:09:42 UTC from IEEE Xplore. Restrictions apply.
to parse the TCDL statement to generate the corresponding B. Program structures
groovy script. TCDL can not only effectively describe the In the language definition, the Backus-Naur form (BNF)
web UI test process, but also can be translated as is generally used for expression. The following statements
programming language test code, helps solve the problem of are BNF [13][14] expressions of TCDL:_________________
simplifying the web test language and promote the BNF________________________________________________
efficiency of UI function testing. BEGIN:
<program>::=<import_list><function_block>
III. TEST CASE DEDCRIPTION LANGUAGE <import_list>:: - ’import “<package>”;”
<package>::=*(<var>”.”)<var>”;”
A. Design goals <function_block>: :=<statement>
<function_name>: :=<ID>
In the design of description language, readability, <statement>:;=<expressions>|<functions>
writability and implementation cost can be used as language <functions>::=*(<function>|<staticfunction>)
evaluation criteria. <function>::=<ID>”(“<varList>”)”
TCDL is in the business layer of the test process and <staticfunction>::=<ID>”.“<ID>”(“<varList>”)”
should shield the details of the technical layer (executable <expressions>::=*(<expression>)<expression>
scripts). The TCDL script should be translated as a <expression>::=<ui>”.”<elementtype>”.”<elementfunction>”;”
(“#”<varList>)?
programming language script and executed by the computer.
<ui>: :=<ID>”(“<varList>”)”
Design goals of TCDL are as follows:
<elementtype>::=<ID>”(“<varList>”)”
1) The operation and meaning of the test case can be <elementfunction>::=<ID>”(“<varList>”)”
expressed completely and accurately with logic close to <comment>: :=<varList>
manual testing. <varList>: :=*(<var>”,”)<var>
<var>::=<ID> |<BOOLEAN>| <DIGIT> |<function>
2) A script can be translated as an executable <ID>::=<ALPHA>|”_”*(<ALPHA>|<DIGIT>|”_”)
language script. <BOOLEAN>::=”true”|”false”|”TRUE”|”FALSE”
<ALPHA>: :=%X41-5A|%61-7A
3) The translation process is idempotent. Translating <DIGIT>::=%X30-39s
the same TCDL case multiple times can get the same result. END________________________________________________
4) Meet the evaluation criteria of readability and The following statement is a pseudo code of a TCDL
writability. expression:
In the operation process of the webpage test, the user’s “U r “(”<variable>“)”“.”“ElementName”“(”<elementVar
test operation behavior can be simply summarized as: open a >u)”u.”uFunction”u(”<functionVar>u)”“;””\n”
specific webpage and operate on a certain web element. It 1) Grammar rules
generally follows the processing flow of "webpage-element-
operation”, and similarly, the design of TCDL sentence An expression is divided into three information modules:
should also follow the natural operation flow to facilitate window, element, and method, which are separated by ”.”.
users’ understanding. Groovy script needs location Semicolon ”;” is used to separate TCDL statements. The
parameters of web pages and elements for positioning, and ”ElementName” and ’’Function” represent the behavior
operation parameters are needed for element operation. The description of user logic, and the parameter ”elementVar”
TCDL statement needs to integrate the parameters required and the parameter ”functionVar” are the data description
by the script logic. The abstraction of TCDL’s operations on from the script logic.
webpage elements should highlight user logic and use script
2) Operator
logic as parameters, as shown in the following figure:
o The web UI test process does not involve mathematical
O User logic (Operation description) operations, so TCDL does not provide mathematical
operator operations. Only the separator and comment
symbols are kept.
3) Variable name
The variables in TCDL mainly represent the names and
positioning parameters of webpage elements. TCDL
statements support variable names defined by letters,
numbers, and underscores, and statement parameters support
Script logic (Data description)
variables, decimal integer numbers, and Boolean values.
Figure 1. User logic and script logic 4) Function operation
The TCDL expression sentence can describe the test
steps conforming to ”Webpage-Element-Operation”.
However, operations such as opening webpages and other
28
Authorized licensed use limited to: Western Sydney University. Downloaded on June 14,2021 at 15:09:42 UTC from IEEE Xplore. Restrictions apply.
non-webpage element operations do not comply with the
testing process. In order to complete the coverage of other
web page operations, the TCDL function statement is
introduced. The testers write the TCDL function for the
specific operation that needs to be described. The syntax
expression of function statement is:
“FunctionName”“(”<functionVar>“)”“;””\n”
C. Data definition
The UI test script statement needs positioning parameters
of the web page element during execution. When the
positioning element is written in the TCDL sentence, the
element needs to be re-configured when the step changes. Figure 3. Analyzing o f TCDL
The writing complexity of the sentence is increased. In order
to achieve the readability of TCDL and the reuse of element According to the grammatical structure mentioned
positioning parameters, positioning parameters are stored in above, the corresponding part of the ANTLR rule is:
the database in the form of key-value pairs. The key is the a n t l r
unique name configured by users for the web element, and BEGIN:
the value is the positioning parameter of the element. When statement
the webpage changes, modify parameters in the database, :(obj ectOperationStatement
which improves the data readability and writability of the |funcOperationStatement)*;
script positioning operation. As the figure below shown: obj ectOperationStatement
:ui'.'controllType'.'controllFunction';'argcomment?;
UI(“page").webedit(“editVar").set(“content"); argcomment:'#'variableExpressionList;
funcOperationStatement:ID'('varExpList?')'';';
ui:ID'('varExpList?')';
K-V Database “editVar”-7/*[@id="kw"]" controllType :ID'(' varExpList?')';
controllFunction:ID'('varExpList?')';
varExpList: varExp(','varExp)*;
varExp:ID|BOOLEAN|NUMBERjson|varExp(('and'|'or')
//*[@id="kw"] varExp)+|'('varExp')';
ID:('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
Figure 2. Requirement o f K-V value END_______________________________________________
Take a TCDL statement as an example:
IV. An a l y z in g o f TCDL UI("var").webedit("editVar").set("content");
The syntax analysis tree of the statement is shown in the
A. Analyzing o f TCDL statements
following figure:
Compared with other programming languages, TCDL is
only oriented to automated testing and describes test UI(“var").webedit(“editVar").set(“content");
operations. It is an incomplete abstract language and cannot
be directly executed by computer, needs to be translated to
target code script to run. To complete the translation of
TCDL sentences, the grammatical elements contained in the
TCDL sentences are needed to be parsed out and to be
ID: UI ( varExp ) ID: webedit ( varExp ) ID: set ( varExp )
replaced for the real executable script.
ANTLR [15] is a powerful syntactic analyzer generation
tool, which is used to read or translate structured texts. It has “var” “editVar” “content”
been widely used in syntax analysis of various language.
Figure 4. TCDL syntax analysis tree
When TCDL script is being translated, ANTLR is used to
parse TCDL sentences and to build a grammatical analysis
The program accesses the leaf nodes of the syntax
tree. The leaf nodes of the grammatical analysis tree are
analysis tree to obtain the syntax elements of the TCDL
composed of test case syntax elements. Then visit the leaf
statement.
node, replace the TCDL script elements to get the executable
script. Statements parsing needs to go through the stages of
B. Generate o f the target code
lexical analysis, syntax analysis, semantic analysis, and
access to the syntax analysis tree, as shown in the following After obtaining the constituent elements of the TCDL
figure: statement, the statement needs to be converted into an
executable statement. The target code comes from the test
29
Authorized licensed use limited to: Western Sydney University. Downloaded on June 14,2021 at 15:09:42 UTC from IEEE Xplore. Restrictions apply.
execution class configured by the test developer in the expression of the generated syntax analysis tree is as
execution server like: follows:
WebEdit_SeleniumImpl.getInstanceO.LocateTestObject( (statement (objectOperationStatement (ui UI (
“UrVar”,“edifVar”).Set("content"); (varExpList (varExp "var")) )) . (controllType webedit (
(varExpList (varExp "editVar")) )) . (controllFunction set (
The target code sentence is related to the element type,
(varExpList (varExp "content")) )) ;))
and the main body of the sentence can be recorded in the
database. The target language template code can be in the This parse tree complies with the design rules of TCDL,
following format: and the generated sentence fragments are:
WebEdit_SeleniumImpl.getInstance().LocateTestObject( W ebEdit_SeleniumImpl. getInstance().LocateT estObject(
${{UI}},${{element}}).Set(${{input}}); "var", "//*[@id="kw"]").Set("content");
${{UI}}, ${{element}}, ${{input}} are the flags of the The execution result of generated target code is that
three statement parameters. In the process of translation, the "content" is entered in the search box on the webpage, which
parameters are accessed in order, from the left to the right to is consistent with the expected effect, which can prove that
find the token ${{}} to replace the parameters in the the TCDL language can be parsed into the correct syntax
statement. Searching in order can ensure that the same result analysis tree and complete the test task.
can be obtained in translation, that is, idempotence is
guaranteed. The following figure shows the process of D. TCDL characteristics
generating the target code: 1) Technical requirements
webedit target template code:
TCDL is mainly for web page function testing. TCDL
"WebEdit_SeleniumImpl.getInstance().LocateTestObject(${ {UI}}, ${ {element}}).Set(S{ {content}});'
sentence structure is close to test operation logic, easy to
' .— 1 .
understand, and data is configured in the form of parameters.
“editVar” - " / / * [@ id= "kw "]" content TCDL sentences are easier to use and can reduce the ratio of
professional programmers to ordinary testers.
RE PLA CE :
2) Script comparison
W eb E d it....g etIn stan ce().L o cateT estO bject(‘fUIVar”,“//*[@ id= Mk w "]” ).S et("content");
30
Authorized licensed use limited to: Western Sydney University. Downloaded on June 14,2021 at 15:09:42 UTC from IEEE Xplore. Restrictions apply.
UI(“var”).webbutton(“clkButton”).ClickQ; Re f e r en c es
END [1] Hui Lu. Test Description Language of Automatic Test System.
Beijing: China Machine Press.2011.5.
[2] Zhenxing Lin. Research and Design o f Logistics Software Test Case
The test data that needs to be configured is the key-value
Description System. Beijing University of Posts and
pair: "editBox-//*[@id-’kw"]", "clkButton-//*[@id="su"]". Telecommunications, 2019.
TCDL scripts have lower requirements for testers' [3] Fenghua Li, Junzhi Yan , Rongna Xie, Jianfeng Ma, Haiwen Ou.
programming level. Script writing and data configuration are Research on the Programming Language for the Block Cipher
more concise. It’s more readable and closer to natural Algorithm. Acta Electronica Sinica, 2009,37(12), pp. 2705-2710.
language logic are more suitable for the needs o f web page [4] Yunlong Zhi. Design and Implementation of Open Clinical Quality
function testing. Language. Zhejiang University,2018.
[5] Jing Jiang. Design and Implementation of Domain-specific Language
3) Learning costs for Computer Vision. University o f Science and Technology of
China,2020.
According to experience statistics, the format of TCDL
[6] Minglan Wang, Dongsheng Ye. Research o f test case description
sentences is simple, and it takes about two weeks to master language. Computer Engineering and Design,2006(22). pp. 4281
the writing method. However, programming language 4284.
scripts requires one to two months of learning time. The [7] Xiaoqi Long, Jiahuan Zhang, Lin Tang, Zehua Chen, Peng Jiang. A
following table is a comparison o f the experience o f using Scripting Language for Embedded Software Automatic Test. Control
programming language to write scripts and in TCDL: and Information Technology,2019(03). pp. 48-51+55.
[8] Chen Meng. The Design and Implementation o f the Test Flow
Description Language. Acta Armamentarii,2007(01). pp.91-93.
TABLE I. Ad v a n t a g e o f TCDL
[9] Mang Su, Yan Yu, Bin Wu, Anmin Fu. Research on the
— — — ....... TCDL Others programming language for proxy re-encryption. Journal on
Communications, 2018,39(06). pp. 89-97.
Cross-platform Y N
[10] Jihua Liu, Fengfeng Bai, Yan Qiang. RASL:Embedded automatic
Close to natural Y N test language. Computer Engineering and Design, 2019,40(06). pp.
language 1642-1647.
Time to learn 15 days About 45 days [11] Christophe Strobbe. Test Case Description Language (TCDL): Test
Human resources 10 test 2 test developers Case Metadata for Conformance Evaluation[J]. Lecture Notes in
developers 8 testers Computer Science,2006,4061:164-171
Composition ratio — ............. 1: 4 [12] Dan Yu, Shilong Ma. Design and Implementation of Spacecraft
Automatic Test Language. Chinese Journal o f Aeronautics,
V. Co n c l u s io n 2011,24(03). pp. 287-298.
[13] Peter Linz. An Introduction to Formal Languages and Automata,
A test case description language TCDL is designed in Third Edition. Jones and Bartlett Computer Science.
this paper. TCDL realizes the standardization of test case [14] Alfred,V.A., Monika S. L., Ravi Sethi, Jeffrey D.U. Compilers:
execution steps, while ensuring the idempotence and Principles, Techniques and Tools, Second Edition. Pearson Edution.
correctness o f the translation process. The simplified [15] Terence Parr. The Definitive ANTLR 4 Reference. The Pragmatic
language expression makes the readability of TCDL Programmers.
sentences greatly improved compared with general [16] Xiaobin Ning, Wenmin Yi, Weijian Luo. A Web Service Testing
programming languages, and it is easy to modify, which Method Based on TTCN-3. Computer Applications and Software,
reduces the requirement o f user programming level and 2012,29(06). pp. 216-218.
expands the use range of the TCDL. The use of TCDL has
greatly improved test efficiency and throughput.
31
Authorized licensed use limited to: Western Sydney University. Downloaded on June 14,2021 at 15:09:42 UTC from IEEE Xplore. Restrictions apply.