CN106776343A - A kind of web application automated test tool and method - Google Patents

A kind of web application automated test tool and method Download PDF

Info

Publication number
CN106776343A
CN106776343A CN201710023922.8A CN201710023922A CN106776343A CN 106776343 A CN106776343 A CN 106776343A CN 201710023922 A CN201710023922 A CN 201710023922A CN 106776343 A CN106776343 A CN 106776343A
Authority
CN
China
Prior art keywords
language
web page
test
java
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710023922.8A
Other languages
Chinese (zh)
Inventor
邓嗣琦
刘超
龙国平
马文静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Software of CAS
Original Assignee
Institute of Software of CAS
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 Institute of Software of CAS filed Critical Institute of Software of CAS
Priority to CN201710023922.8A priority Critical patent/CN106776343A/en
Publication of CN106776343A publication Critical patent/CN106776343A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The present invention relates to a kind of web application automated test tool and method, including:Basic browser and web page operation realizes module, custom code collector, starts test program module.The system efficiently solves that manual test task in traditional software test process is heavy, test written in code is complicated, cannot automatic test whole system shortcoming, have stronger application value in practice.

Description

A kind of web application automated test tool and method
Technical field
The present invention relates to a kind of web application automated test tool and method, belong to the application field of software test.
Background technology
The test of large software is a complexity and time-consuming work, and automatic test is provided for writing for test program Excellent basis.
Selenium WebDriver be one being capable of the manually-operated software systems of automatic imitation.By using The interface function that Selenium WebDriver are provided, Java code can simulate people and webpage is clicked on, and be input into character, choosing Select the operation such as drop-down menu.But Selenium only provides the interface of basic operation, complete cycle tests is realized, also needed Want substantial amounts of development.
JMeter is powerful, can carry out multithreading, the web program tests of multi-user, and STAX is also many supports Plant the automatic testing software of function multilingual.But these instruments set up it is cumbersome, be not suitable for treatment user make by oneself The complex sequence of justice, easy to get started is not allowed yet for simulating webpage test.Cucumber is external a automatic testing software.Should The advantage of software is that user is by being input into one section of code of similar test description word, you can obtain a complete test Program.But one test of description is accomplished by code more long, is also not suitable for the cycle tests of complexity.Although Watir uses It is convenient, however it is necessary that user is familiar with Ruby language.
The content of the invention
The technology of the present invention solve problem:In order to overcome the shortcomings of existing software automated testing technology, the present invention provides one Kind of web application automated testing method and instrument, solve in traditional software test process that manual test task is heavy, survey Examination written in code is complicated, cannot automatic test whole system shortcoming, while the present invention is suitable for various web applications Automatic test.
The technical solution adopted in the present invention is:A kind of web application automated test tool, including:Basic is clear Look at device and web page operation realizes module, custom code collector, starts test program module, wherein:
Basic browser and web page operation realizes module:Write using Java language, write largely based on Selenium Web page operation function, realize basic browser operation and basic web page operation, provide the user the built-in function for using Interface;User is realized when test program is write by calling built-in function;
Custom code collector:For self-defined language codes to be compiled, Java code is generated;The module bag CompilerTools containing T and preprocessor, T CompilerTools are input with T language testing code, are rewritten by preprocessor It is C language style code, then by morphological analysis, syntactic analysis, generative grammar tree during syntax tree is traveled through, generates Java code;T language is the simplified version of Java language and C language, need to only understand webpage test scene and simple programming basis Knowledge, just can easily use;Preprocessor is write with python language;
Start test program module:Java code for running the generation of custom code collector, carries out Web applications The test of program;
System combination module:For by basic browser and web page operation realize module, custom code collector, Start that test program is module integrated combines above procedure using python scripts to together, form complete test flow, surveying After the completion of examination hall scape and Test Sample Design, full-automatic operation is realized.
The basic browser and web page operation realize that module includes:
(1) basic browser operation includes:Browser automatic, maximization, input network address, closing;
(2) basic web page operation includes:
A. ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR, LINK_TEXT, PARTIAL_ are passed through LINK_TEXT, XPATH feature location web page element, operate to web page element, including clickthrough, click on button, selection Drop-down menu, word is input into text box;
B. check that certain web page element whether there is, by id, css selector features find corresponding web page element;
C. the value of list cell in webpage is checked, this class function compares certain value and function input value of web page element Compared with, by ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH position-tables, then in the table by key assignments, side-play amount positioning unit lattice, then content analog value in comparing unit lattice, Analog value includes the value of relatively more single and multiple cell;
D. check in webpage certain form row whether be all or all comprising certain character string, after the row in positioning table, to this Each cell is arranged to be checked;
E. whether a certain node is checked in checking form a line or structure tree, this generic operation need position-table row or Check box element, is checked;
F. certain value of certain web page element is obtained, for example, obtaining the text of certain cell in certain form;
G. a button, such as Enter are sent to webpage;
H. logged on or off on webpage;
I. transmitting file is gone up;
J. gauge outfit is initialized;
K. other web page operations, including change frame, empties text box, checks that whether certain text box or drop-down menu may be used With the dialog box of closing ejection;
(3) operating process:
A. ID, TAG_NAME, NAME, CLASS_NAME, CSS_ are pressed in the interface for being provided by Selenium, realization SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH position a web page element;
After web page element is found, by Selenium interfaces, asked to the control sending action, for example, click on, or Certain key is input into, a predetermined time is waited before and after action, to ensure that web page element can use, and action is accomplished;
Throw exception when b. can not find certain control;
C. to the operation of selection drop-down menu, an example for Select classes is created, is called according to incoming parameter such Different choice function;
D. check that whether web page element whether there is or meet the function of certain value, can not find this element or value does not meet and wants Thrown when asking abnormal;
E. to the inspection and operation of cell in table, table is first positioned, further according to Table Header information and row/column Information locating unit Lattice;
F. to being operated as upper transmitting file, file path is obtained, web page element is transmitted to as parameter, to realize selection text Part is simultaneously uploaded.
The custom code collector implementation process:
(1) self-defined test language (T language)
Data type:Character string, integer, null, list;
Basic statement:Variable-definition, function definition, built-in function is called, and SQL is called, for Do statements, if Conditional branch statements etc..
Language essential characteristic and requirement:
A. each sentence end bonus point number;
B. Chinese character string is supported;
C. null is supported;
D. SQL return type is void;
E. without specified data type during variable-definition;
F. test keywords are used as program entry function;
G.for Do statements form for " for (iter in list) ...;op(iter);…;, wherein iter is circulation An element in variable, i.e. list, in is keyword, and list is array to be traveled through, and op () is carried out in cyclic variable Operation;
(2) code pretreatment:The T language codes being input into are pre-processed using python scripts, including to for ... In ... circulations are rewritten, and without proper notice variable is stated, are allowed to be adapted to C style codes;
(3) compiling and code building:By transforming a C language compiler for LALR (0), generation is completed using three traversals The T language codes that the step two that code generation is input in compiler was rewritten, first time traversal, morphological analysis and syntactic analysis, For T language codes generate corresponding syntax tree;Travel through for second, syntax check;Third time is traveled through, while traversal syntax tree, For each node generates corresponding Java code, finally, Java import sentences are generated, where class definition statement, statement function library The example of class, forms complete Java files, and be put into the test file folder of Maven.
The startup test program module implementation process:
(1) Java SDK are installed, and change system environment variable, addition user-variable JAVA_HOME=Java installs road Footpath;
(2) MAVEN is installed, and changes system environment variable, add user-variable MVN_HOME=MAVEN installation paths;
(3) added in environmental variance Path ";%JAVA_HOME% jre bin;%MAVEN_HOME% bin ";
(4) chrome Driver are installed;
(5) open " beginning "->" CMD ", catalogue is switched to project home catalogues, operation order " mvn test- Dtest=xxx ", wherein " xxx " it is that web application functional module to be measured tests the relative path of Java code, once open It is dynamic, just start automatic test, whole process is without manual intervention.
A kind of web application automated testing method, realizes that step is as follows:
(1) substantial amounts of web page operation function is write based on Selenium, realizes basic browser operation and basic net Page operations, provide the user the built-in function interface for using;User when test program is write, by calling built-in function come real It is existing;
(2) self-defined language codes are compiled, generate Java code, comprising T CompilerTools and preprocessor, ginseng C language grammer is examined, using bison and flex instruments, T CompilerTools and preprocessor, compiler C language is designed and write Write, preprocessor is write with python language;T CompilerTools is to be input into T language testing code, will by preprocessor It is rewritten as C language style code, then by morphological analysis, syntactic analysis, generative grammar tree, during syntax tree is traveled through, Generation Java code;T language is the simplified version of Java language and C language, need to only understand webpage test scene and simple programming Rudimentary knowledge, just can easily use;According to the demand and feature of web application, basic letter is write using selenium interfaces Number storehouse, is write with Java language;According to the function library finished writing, built-in function list is added in compiler;
(3) script is write using python language, above procedure is combined, complete test flow is formed, in test scene And after the completion of Test Sample Design, realize full-automatic operation.
Present invention beneficial effect compared with prior art is:
(1) the invention provides a kind of simple XProgrammer can also light left-hand seat language, allow tester to have more Many energy are absorbed in test scene and testing example design, rather than complex language syntax gauge.
(2) present invention contains self-defined language compilation's module, language can be automatically compiled as what can be run Java code.
(3) the invention provides a kind of more general Web test frames, it is adaptable to various Web application systems, to not When same Web application systems are tested, it is only necessary to update self-defined test language test code.
(4) the invention provides a kind of framework of automatic test, can automatically test whole Web using this framework and apply System, without manpower intervention.The result of test program can generate test report and be automatically saved to local disk, facilitate manual examination and verification Test result, finds Web application systems bug.
Brief description of the drawings
Fig. 1 realizes flow chart for of the invention.
Specific embodiment
Below in conjunction with the accompanying drawings and embodiment the present invention is described in more detail.Main implementation steps of the invention are as follows:
As shown in figure 1, the present invention is main to realize module, custom code compiling mould by basic browser and web page operation Block, startup test program module, system combination module composition.
Overall implementation process is as follows:
Basic browser and web page operation realizes module:The module is write with Java language, is write based on Selenium Substantial amounts of web page operation function, mainly realizes basic browser operation and basic web page operation, and providing the user makes With the built-in function interface of this instrument.
Custom code collector:For the self-defined language that will be write in test scene and Test Sample Design module Code is compiled, and generates Java code.The module includes T CompilerTools and preprocessor.Compiler is with T language testing generations Code is input, and by morphological analysis, syntactic analysis, generative grammar tree during syntax tree is traveled through, generates target Java tests Code.
Start test program module:Java code for running the generation of custom code collector, carries out applying journey The test of sequence functional module.
Self-defined language compilation's module includes:
(1) self-defined test language (T language)
Data type:Character string, integer, null, list;
Basic statement:Variable-definition, function definition, built-in function is called, and SQL is called, for Do statements, if Conditional branch statements etc..
Language essential characteristic and requirement:
A. each sentence end bonus point number;
B. Chinese character string is supported;
C. null is supported;
D. SQL return type is void;
E. without specified data type during variable-definition;
F. test keywords are used as program entry function;
G.for Do statements form for " for (iter in list) ...;op(iter);…;, wherein iter is circulation An element in variable, i.e. list, in is keyword, and list is array to be traveled through, and op () is carried out in cyclic variable Operation;
H. support that character string is added.
(2) code pretreatment:The T language codes being input into are pre-processed using python scripts, including to for ... In ... circulations are rewritten, and without proper notice variable is stated etc., are allowed to be adapted to C style codes;
(3) compiling and code building:By transforming a C language compiler for LALR (0), generation is completed using three traversals Code generation.First time traversal, morphological analysis and syntactic analysis, are that T language codes generate corresponding syntax tree;Travel through for second, Syntax check;Third time is traveled through, and is that each node generates corresponding Java code while traversal syntax tree.Finally, Java is generated Import sentences, class definition statement etc., form complete Java files, and be put into the test file folder of Maven.
Start test program module implementation process:
(1) Java is installed, and changes system environment variable, add user-variable JAVA_HOME=Java installation paths;
(2) MAVEN is installed, and changes system environment variable, add user-variable MVN_HOME=MAVEN installation paths;
(3) added in environmental variance Path ";%JAVA_HOME% jre bin;%MAVEN_HOME% bin ";
(4) chrome Driver are installed;
(5) open " beginning "->" CMD ", catalogue is switched to project home catalogues, operation order " mvn test- Dtest=xxx ", wherein " xxx " it is relative path that web application functional module to be measured tests Java code.
System combination module implementation process:
Above procedure is combined using python scripts, forms complete test flow.
Above-mentioned each module to implement process as follows:
1. basic browser and web page operation realize module
The module Java language, based on Selenium interfaces, writes web page operation function, mainly realizes basic clear Device of looking at is operated and basic web page operation, is provided the user and is used the built-in function interface of this instrument.
Basic browser operation includes:Browser automatic, maximization, input network address, closing etc.;
Basic web page operation:According to id, css selector, link text etc. finds web page element, according to id, css The webpage clicking such as selector, link text element, according to id, the filling such as css selector, link text text box, root According to id, css selector, link text etc. chooses check box, according to id, the position-table element such as css selector, looks into See whether form element is desired value, check that whether certain cell is comprising certain character string etc. in form.Mainly have following several Operation:
(1) ID, TAG_NAME, NAME, CLASS_NAME, CSS_ are pressed in the interface provided by Selenium, realization SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH position a web page element.Then, to web page element Operated, such as clickthrough, clicked on button, selected drop-down menu, in text box input word etc..
(2) check that certain web page element whether there is, by ID, TAG_NAME, NAME, CLASS_NAME, CSS_ SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH, find corresponding web page element.
(3) value of list cell in webpage is checked.This class function compares certain value and function input value of web page element Compared with.By ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH position-tables, then in the table by key assignments or side-play amount positioning unit lattice, then compare its analog value.Including comparing The value of single and multiple cell.
(4) certain grid column is all certain character string or all comprising certain character string in checking webpage.It is right after row in positioning table This arranges each cell and is checked.
(5) whether a certain node is checked in checking form a line or structure tree.This generic operation needs position-table row Or check box element, checked.
(6) certain value of certain web page element is obtained, for example, obtaining the text of certain cell in certain form.
(7) a button, such as Enter are sent to webpage.
(8) certain pop-up dialogue box is closed.
(9) check box of certain every trade head in table, or certain check box in structure tree are chosen.It is by value " preceding-sibling::The XPATH of span [1] " positions check box.
(10) check whether certain control can use.Realized using isEnabled functions.
(11) logged on or off on webpage.This is that, by inputing user name, password is clicked on and logs in this series of operation Realize.Occurrence is input into by user in call function.
(12) other web page operations, such as change frame, empty text box, check that whether certain text box or drop-down menu may be used With dialog box of closing ejection etc..
(13) to the operation of selection drop-down menu, an example for Select classes is created, this is called according to incoming parameter The different choice function of class.
(14) check that whether web page element whether there is or meet the function of certain value, can not find this element or value does not meet It is required that when throw abnormal.
(15) to being operated as upper transmitting file, file path is obtained, web page element is transmitted to as parameter, to realize selection File is simultaneously uploaded.
To different types of web page operation, before the procedure with operation after, add different time delays.This delay parameter It is adjustable, to ensure to there are enough stand-by period to make webpage make a response during test.Additionally, the inspection to needing the stand-by period more long Operation, is polled, and is returned in time to ensure having enough stand-by period, and after webpage is made a response.Definition BaseCommon classes, above-mentioned all functions are all as such member function statement and definition.
2. custom code collector
(1) self-defined test language (T language)
T language is similar with C language, and using basic process type programmed method, user is realized by calling built-in function Web page operation.And operating process can be controlled using Do statement and conditional branch statements.Variable in T language need not definition Type, is considered as character string without exception, while supporting that character string plus sige is connected, and unassignable character string is represented using null. Test program is write with T language, it is simple more many than writing code with Java or C language, therefore, even if without many programming experiences People, as long as being familiar with business scenario, could be used that this instrument.
Data type:Character string, integer, null, list;
Basic statement:Variable-definition, function definition, built-in function is called, and SQL is called, for Do statements, if Conditional branch statements etc..
Language essential characteristic and requirement:
A. each sentence end bonus point number;
B. Chinese character string is supported;
C. null is supported;
D. SQL return type is void;
E. without specified data type during variable-definition;
F. test keywords are used as program entry function;
G.for Do statements form for " for (iter in list) ...;op(iter);…;, wherein iter is circulation An element in variable, i.e. list, in is keyword, and list is array to be traveled through, and op () is carried out in cyclic variable Operation;
H. support that character string is added.
(2) code pretreatment:The T language codes being input into are pre-processed using python scripts, to for ..., in ... is followed Ring is rewritten, and is changed to for (iter=0 of C language;iter<length;Iter++) form.Sound is carried out to without proper notice variable It is bright, declarative statement is put into block head, it is allowed to be adapted to C language style.
(3) compiling and code building:It is T language generations lexical analyzer and syntax analyzer according to flex and bison, makes Generated with three traversal completion codes.Browser and web page operation function are all processed as built-in function.
First time traversal, morphological analysis and syntactic analysis, are that T language codes generate corresponding syntax tree, in generating process In if any the sentence that can not be parsed, then report an error;
Travel through for second, syntax check, the syntax error to input code is pointed out, for example, to User Defined letter Several calls, if number of parameters is not right, reports an error;
Third time is traveled through, and is that each node generates corresponding Java code while traversal syntax tree.In generation Java code When, according to T language and the corresponding relation of Java language, by corresponding Java code output to file.For example, in each sentence knot Shu Shi, exports branch.For another example, for character string phase add operation, output caused with double quotation marks come character string, and two characters Plus sige in the middle of going here and there.To null identifiers, processed as a single identifier.As the entitled test of function, it is claimed as:
@Test
public void test()
To represent that this is the test functions in java applet.
To the variable in function, String type declarations are added.If character string dimension, then come with String [] type Statement.For branch statement generates corresponding and if else keywords, and braces is generated in appropriate position.
Finally, Java import sentences are generated, the required bag such as selenium is introduced.In addition, according to test file name Define test class, the such object of reputation.Statement BaseCommon class objects base.To the built-in letter called in T language codes Number, is processed by defined function, is added " base. " when code is generated.
After generating complete .java files .java files are put into the test file folder of Maven.
3. test program module is started
(1) Java is installed, and changes system environment variable, add user-variable JAVA_HOME=Java installation paths;
(2) MAVEN is installed, and changes system environment variable, add user-variable MVN_HOME=MAVEN installation paths;
(3) add in environmental variance Path ";%JAVA_HOME% jre bin;%MAVEN_HOME% bin ";
(4) chrome Driver are installed;
(5) open " beginning "->" CMD ", catalogue is switched to project home catalogues, operation order " mvn test- Dtest=xxx ", wherein " xxx " it is relative path that web application functional module to be measured tests Java code.
Non-elaborated part of the present invention belongs to techniques well known.
The above, part specific embodiment only of the present invention, but protection scope of the present invention is not limited thereto, and appoints What those skilled in the art the invention discloses technical scope in, the change or replacement that can be readily occurred in should all be covered Within protection scope of the present invention.

Claims (5)

1. a kind of web application automated test tool, it is characterised in that including:Basic browser and web page operation are realized Module, custom code collector, startup test program module, wherein:
Basic browser and web page operation realizes module:Write using Java language, substantial amounts of net is write based on Selenium Page operations function, realizes basic browser operation and basic web page operation, provides the user the built-in function interface for using; User is realized when test program is write by calling built-in function;
Custom code collector:For self-defined language codes to be compiled, Java code is generated;The module includes T CompilerTools and preprocessor, T CompilerTools are input with T language testing code, and C is rewritten as by preprocessor Diction code, then by morphological analysis, syntactic analysis, generative grammar tree during syntax tree is traveled through, generates Java generations Code;T language is the simplified version of Java language and C language, need to only understand webpage test scene and simple programming rudimentary knowledge, just Can easily use;Preprocessor is write with python language;
Start test program module:Java code for running the generation of custom code collector, carries out web application Test;
System combination module:For basic browser and web page operation being realized into module, custom code collector, being started Test program is module integrated to be combined above procedure using python scripts to together, complete test flow is formed, in checkout area After the completion of scape and Test Sample Design, full-automatic operation is realized.
2. a kind of web application automated test tool according to claim 1, it is characterised in that:It is described basic Browser and web page operation realize that module includes:
(1) basic browser operation includes:Browser automatic, maximization, input network address, closing;
(2) basic web page operation includes:
A. ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR, LINK_TEXT, PARTIAL_LINK_ are passed through TEXT, XPATH feature location web page element, operate to web page element, including clickthrough, click on button, select drop-down Menu, word is input into text box;
B. check that certain web page element whether there is, by ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH feature, find corresponding web page element;
C. the value of list cell in webpage is checked, this class function compares certain value and function input value of web page element, leads to Cross ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH Position-table, then passes through key assignments, side-play amount positioning unit lattice, then content analog value in comparing unit lattice, accordingly in the table Value includes the value of relatively more single and multiple cell;
D. whether certain form row are all or all comprising certain character string, after the row in positioning table, arrange every to this in checking webpage Individual cell is checked;
E. whether a certain node is checked in checking form a line or structure tree, and this generic operation needs position-table row or final election Frame element, is checked;
F. certain value of certain web page element is obtained, including obtains the text of certain cell in certain form;
G. a button is sent to webpage;
H. logged on or off on webpage;
I. transmitting file is gone up;
J. gauge outfit is initialized;
K. other web page operations, including change frame, empties text box, checks whether certain text box or drop-down menu can use, and closes Close the dialog box of ejection;
(3) operating process:
A. ID, TAG_NAME, NAME, CLASS_NAME, CSS_SELECTOR are pressed in the interface for being provided by Selenium, realization, LINK_TEXT, PARTIAL_LINK_TEXT, XPATH position a web page element;
After web page element is found, by Selenium interfaces, asked to the control sending action, including clicked on, be input into certain Key, chooses drop-down menu, obtains its various value;A predetermined time is waited before and after action, to ensure that web page element can use, And action is accomplished;Complete to wait and perform using a single thread;
Throw exception when b. can not find certain control;
C. to select drop-down menu operation, create an example for Select classes, called according to incoming parameter it is such not With selection function;
D. check that whether web page element whether there is or meet the function of certain value, when can not find this element or undesirable value Throw abnormal;
E. to the inspection and operation of cell in table, table is first positioned, further according to Table Header information and row/column Information locating cell;
F. to being operated as upper transmitting file, file path is obtained, web page element is transmitted to as parameter, to realize select file simultaneously Upload.
3. a kind of web application automated test tool according to claim 1, it is characterised in that:It is described self-defined Code compilation module implementation process:
(1) self-defined test language (T language)
Data type:Character string, integer, null, list;
Basic statement:Variable-definition, function definition, built-in function is called, and SQL is called, for Do statements, if conditions Branch statement etc.;
Language essential characteristic and requirement:
A. each sentence end bonus point number;
B. Chinese character string is supported;
C. null is supported;
D. SQL return type is void;
E. without specified data type during variable-definition;
F. test keywords are used as program entry function;
G.for Do statements form for " for (iter in list) ...;op(iter);…;, wherein iter becomes for circulation Amount, i.e. an element in list, in is keyword, and list is array to be traveled through, and op () is the behaviour carried out in cyclic variable Make;
(2) code pretreatment:The T language codes being input into are pre-processed using python scripts, including to for ... in ... is followed Ring is rewritten, and without proper notice variable is stated, is allowed to be adapted to C style codes;
(3) compiling and code building:By transforming a C language compiler for LALR (0), given birth to using three traversal completion codes It is T languages into the T language codes that the step two being input in compiler was rewritten, first time traversal, morphological analysis and syntactic analysis The speech corresponding syntax tree of code building;Travel through for second, syntax check;Third time is traveled through, and is each while traversal syntax tree Node generates corresponding Java code, finally, generates Java import sentences, class definition statement, the reality of class where statement function library Example, forms complete Java files, and be put into the test file folder of Maven.
4. a kind of web application automated test tool according to claim 1, it is characterised in that:Described startup is surveyed Examination program module implementation process:
(1) Java SDK are installed, and change system environment variable, add user-variable JAVA_HOME=Java installation paths;
(2) MAVEN is installed, and changes system environment variable, add user-variable MVN_HOME=MAVEN installation paths;
(3) added in environmental variance Path ";%JAVA_HOME% jre bin;%MAVEN_HOME% bin ";
(4) chrome Driver are installed;
(5) open " beginning "->" CMD ", catalogue is switched to project home catalogues, operation order " mvntest-Dtest =xxx ", wherein " xxx " it is relative path that web application functional module to be measured tests Java code, once starting, just open Begin automatic test, whole process is without manual intervention.
5. a kind of web application automated testing method, it is characterised in that:Realize that step is as follows:
(1) substantial amounts of web page operation function is write based on Selenium, realizes basic browser operation and basic webpage behaviour Make, provide the user the built-in function interface for using;To each web page operation, after web page element is found, pass through Selenium interfaces, ask to the control sending action, including click on, and are input into certain key, choose drop-down menu, obtain its various Value;A predetermined time is waited before and after action, to ensure that web page element can use, and action is accomplished;Use one Single thread is completed to wait and performed;User is realized when test program is write by calling built-in function;
(2) self-defined language codes are compiled, Java code are generated, comprising T CompilerTools and preprocessor, with reference to C Language syntax, using bison and flex instruments, designs and writes T CompilerTools and preprocessor, and compiler is compiled with C language Write, preprocessor is write with python language;T CompilerTools with T language testing code be input, by preprocessor by its C language style code is rewritten as, then by morphological analysis, syntactic analysis, generative grammar tree;Then, in traversal syntax tree process In, generate Java code;T language is the simplified version of Java language and C language, need to only understand webpage test scene and simple volume Journey rudimentary knowledge, just can easily use;According to the demand and feature of web application, write substantially using selenium interfaces Function library, is write with Java language;According to the function library finished writing, built-in function list is added in compiler;
(3) script is write using python language, above procedure is combined, complete test flow is formed, in test scene and survey After the completion of examination case designing, automatic operating is realized.
CN201710023922.8A 2017-01-13 2017-01-13 A kind of web application automated test tool and method Pending CN106776343A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710023922.8A CN106776343A (en) 2017-01-13 2017-01-13 A kind of web application automated test tool and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710023922.8A CN106776343A (en) 2017-01-13 2017-01-13 A kind of web application automated test tool and method

Publications (1)

Publication Number Publication Date
CN106776343A true CN106776343A (en) 2017-05-31

Family

ID=58948184

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710023922.8A Pending CN106776343A (en) 2017-01-13 2017-01-13 A kind of web application automated test tool and method

Country Status (1)

Country Link
CN (1) CN106776343A (en)

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107678952A (en) * 2017-09-22 2018-02-09 郑州云海信息技术有限公司 A kind of method and system of Webpage element operation
CN107704389A (en) * 2017-09-26 2018-02-16 无线生活(杭州)信息科技有限公司 A kind of page method of testing and device
CN107783902A (en) * 2017-09-26 2018-03-09 甘肃万维信息技术有限责任公司 A kind of Selenium automated testing methods and system from coding
CN108650149A (en) * 2018-04-24 2018-10-12 平安科技(深圳)有限公司 Server testing method, device, equipment and computer readable storage medium
CN108733566A (en) * 2018-05-23 2018-11-02 郑州云海信息技术有限公司 A kind of virtualization system automatization test system and method based on python
CN108829583A (en) * 2018-05-24 2018-11-16 广东睿江云计算股份有限公司 A kind of page compatibility test method and device based on Selenium
CN109032936A (en) * 2018-07-13 2018-12-18 陈希 A kind of desktop automatic test development approach and system
CN109032870A (en) * 2018-08-03 2018-12-18 百度在线网络技术(北京)有限公司 Method and apparatus for test equipment
CN109491890A (en) * 2018-10-16 2019-03-19 深圳壹账通智能科技有限公司 The interface scans method and terminal device of application program
CN109739751A (en) * 2018-12-19 2019-05-10 贵阳朗玛信息技术股份有限公司 Realize the method and system of webpage automatic test
WO2019100576A1 (en) * 2017-11-27 2019-05-31 平安科技(深圳)有限公司 Automated test management method and apparatus, terminal device, and storage medium
CN110018953A (en) * 2018-01-10 2019-07-16 武汉斗鱼网络科技有限公司 Use method, storage medium, equipment and the system of python test JS code
CN110727591A (en) * 2019-10-11 2020-01-24 集奥聚合(北京)人工智能科技有限公司 Modeling page-based automatic testing method
CN111162972A (en) * 2019-12-31 2020-05-15 扬州航盛科技有限公司 Vehicle-mounted Ethernet protocol stack automatic testing method based on semantic analysis
CN111708474A (en) * 2020-05-26 2020-09-25 广州朗国电子科技有限公司 Method and device for simulating user touch operation, storage medium and all-in-one machine equipment
CN112328488A (en) * 2020-11-09 2021-02-05 深圳证券通信有限公司 Control object identification method for UI (user interface) automatic test
CN112346726A (en) * 2020-03-16 2021-02-09 成都华微电子科技有限公司 Method for automatically generating design code based on form information
CN112416322A (en) * 2020-11-20 2021-02-26 城云科技(中国)有限公司 Implementation method for acquiring previous data in data set according to self-circulation function
CN112651698A (en) * 2020-09-01 2021-04-13 广西辰亚信息技术有限公司 Legal process automation intelligent system
CN112905456A (en) * 2021-02-07 2021-06-04 重庆富民银行股份有限公司 Automatic test report generation method based on MAVEN life cycle
CN114064041A (en) * 2021-11-18 2022-02-18 宁波波导易联电子有限公司 Method and system for automatically generating car control codes for car control matrix file through Android system
CN115630086A (en) * 2022-12-22 2023-01-20 西安葡萄城软件有限公司 Method for converting Access application into Web application program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7698688B2 (en) * 2008-03-28 2010-04-13 International Business Machines Corporation Method for automating an internationalization test in a multilingual web application
CN104021080A (en) * 2014-06-13 2014-09-03 中国民航信息网络股份有限公司 Automatic testing system based on custom scripts
CN104809068A (en) * 2015-05-08 2015-07-29 浪潮电子信息产业股份有限公司 Web automatic testing framework construction method based on selenium
CN104820640A (en) * 2015-05-19 2015-08-05 广州华多网络科技有限公司 Webpage testing method and device
CN105354035A (en) * 2015-11-17 2016-02-24 天津橙子科技有限公司 Method for compiling test case of web engineering

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7698688B2 (en) * 2008-03-28 2010-04-13 International Business Machines Corporation Method for automating an internationalization test in a multilingual web application
CN104021080A (en) * 2014-06-13 2014-09-03 中国民航信息网络股份有限公司 Automatic testing system based on custom scripts
CN104809068A (en) * 2015-05-08 2015-07-29 浪潮电子信息产业股份有限公司 Web automatic testing framework construction method based on selenium
CN104820640A (en) * 2015-05-19 2015-08-05 广州华多网络科技有限公司 Webpage testing method and device
CN105354035A (en) * 2015-11-17 2016-02-24 天津橙子科技有限公司 Method for compiling test case of web engineering

Cited By (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107678952A (en) * 2017-09-22 2018-02-09 郑州云海信息技术有限公司 A kind of method and system of Webpage element operation
CN107704389A (en) * 2017-09-26 2018-02-16 无线生活(杭州)信息科技有限公司 A kind of page method of testing and device
CN107783902A (en) * 2017-09-26 2018-03-09 甘肃万维信息技术有限责任公司 A kind of Selenium automated testing methods and system from coding
WO2019100576A1 (en) * 2017-11-27 2019-05-31 平安科技(深圳)有限公司 Automated test management method and apparatus, terminal device, and storage medium
CN110018953B (en) * 2018-01-10 2022-12-23 武汉斗鱼网络科技有限公司 Method, storage medium, device and system for testing JS code by using python
CN110018953A (en) * 2018-01-10 2019-07-16 武汉斗鱼网络科技有限公司 Use method, storage medium, equipment and the system of python test JS code
CN108650149B (en) * 2018-04-24 2021-10-01 平安科技(深圳)有限公司 Server testing method, device, equipment and computer readable storage medium
CN108650149A (en) * 2018-04-24 2018-10-12 平安科技(深圳)有限公司 Server testing method, device, equipment and computer readable storage medium
CN108733566A (en) * 2018-05-23 2018-11-02 郑州云海信息技术有限公司 A kind of virtualization system automatization test system and method based on python
CN108829583A (en) * 2018-05-24 2018-11-16 广东睿江云计算股份有限公司 A kind of page compatibility test method and device based on Selenium
CN109032936A (en) * 2018-07-13 2018-12-18 陈希 A kind of desktop automatic test development approach and system
CN109032936B (en) * 2018-07-13 2021-11-05 陈希 Desktop automation test development method and system
CN109032870A (en) * 2018-08-03 2018-12-18 百度在线网络技术(北京)有限公司 Method and apparatus for test equipment
CN109491890A (en) * 2018-10-16 2019-03-19 深圳壹账通智能科技有限公司 The interface scans method and terminal device of application program
CN109739751A (en) * 2018-12-19 2019-05-10 贵阳朗玛信息技术股份有限公司 Realize the method and system of webpage automatic test
CN110727591A (en) * 2019-10-11 2020-01-24 集奥聚合(北京)人工智能科技有限公司 Modeling page-based automatic testing method
CN111162972A (en) * 2019-12-31 2020-05-15 扬州航盛科技有限公司 Vehicle-mounted Ethernet protocol stack automatic testing method based on semantic analysis
CN112346726A (en) * 2020-03-16 2021-02-09 成都华微电子科技有限公司 Method for automatically generating design code based on form information
CN112346726B (en) * 2020-03-16 2023-12-12 成都华微电子科技股份有限公司 Method for automatically generating design codes based on form information
CN111708474A (en) * 2020-05-26 2020-09-25 广州朗国电子科技有限公司 Method and device for simulating user touch operation, storage medium and all-in-one machine equipment
CN112651698A (en) * 2020-09-01 2021-04-13 广西辰亚信息技术有限公司 Legal process automation intelligent system
CN112328488A (en) * 2020-11-09 2021-02-05 深圳证券通信有限公司 Control object identification method for UI (user interface) automatic test
CN112416322A (en) * 2020-11-20 2021-02-26 城云科技(中国)有限公司 Implementation method for acquiring previous data in data set according to self-circulation function
CN112905456A (en) * 2021-02-07 2021-06-04 重庆富民银行股份有限公司 Automatic test report generation method based on MAVEN life cycle
CN112905456B (en) * 2021-02-07 2023-06-06 重庆富民银行股份有限公司 MAVEN life cycle-based automatic test report generation method
CN114064041B (en) * 2021-11-18 2022-08-02 宁波波导易联电子有限公司 Method and system for generating car control codes for car control matrix file through Android system
CN114064041A (en) * 2021-11-18 2022-02-18 宁波波导易联电子有限公司 Method and system for automatically generating car control codes for car control matrix file through Android system
CN115630086A (en) * 2022-12-22 2023-01-20 西安葡萄城软件有限公司 Method for converting Access application into Web application program

Similar Documents

Publication Publication Date Title
CN106776343A (en) A kind of web application automated test tool and method
CN104503816B (en) A kind of hardware language VHDL to MSVL automated conversion system
Hartmann et al. A UML-based approach to system testing
US7975233B2 (en) Automatic conversion of a textual language into a graphical program representation
US7954059B2 (en) Automatic conversion of text-based code having function overloading and dynamic types into a graphical program for compiled execution
US7895575B2 (en) Apparatus and method for generating test driver
CN110222318B (en) XML-based data generation tool development method
CN108897687A (en) A kind of API automated testing method and system based on data-driven
US10379817B2 (en) Computer-applied method for displaying software-type applications based on design specifications
CN106502896A (en) A kind of generation method of function test code and device
Sun et al. Specification-driven automated testing of GUI-based Java programs
CN110209389A (en) A kind of data generating tool development system based on XML
CN109558117A (en) The C code automatic generation method of the refinement of AADL model and its support towards AEROSPACE APPLICATION
Dinh et al. Modern front-end web development: how libraries and frameworks transform everything
Bussenot et al. Orchestration of domain specific test languages with a behavior driven development approach
Wen et al. “Integrare”, a collaborative environment for behavior-oriented design
CN102012856B (en) Method and device for automatically generating hardware component simulation engineering
Bussenot et al. A domain specific test language for systems integration
Graf et al. Gaining insight into executable models during runtime: Architecture and mappings
Rangra et al. SDL to Fiacre translation
Dai et al. Automatic test data generation for TTCN-3 using CTE
Rentea et al. Ensuring quality of web applications by client-side testing using ttcn-3
Schulz Integrating performance tests in a generative software development platform
Hess et al. Enhancing Dafny Support in Visual Studio Code
Reyes et al. Siddhartha: a method for developing domain-specific test driver generators

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170531

WD01 Invention patent application deemed withdrawn after publication