CN109885493A - A kind of automation combination frame reflected based on Android platform and Java - Google Patents

A kind of automation combination frame reflected based on Android platform and Java Download PDF

Info

Publication number
CN109885493A
CN109885493A CN201910119601.7A CN201910119601A CN109885493A CN 109885493 A CN109885493 A CN 109885493A CN 201910119601 A CN201910119601 A CN 201910119601A CN 109885493 A CN109885493 A CN 109885493A
Authority
CN
China
Prior art keywords
test
layer
data
java
case
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
CN201910119601.7A
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.)
Nanjing Post and Telecommunication University
Nanjing University of Posts and Telecommunications
Original Assignee
Nanjing Post and Telecommunication University
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 Nanjing Post and Telecommunication University filed Critical Nanjing Post and Telecommunication University
Priority to CN201910119601.7A priority Critical patent/CN109885493A/en
Publication of CN109885493A publication Critical patent/CN109885493A/en
Pending legal-status Critical Current

Links

Abstract

The invention proposes a kind of automation combination frames reflected based on Android platform and Java, include: infrastructure component layer: the layer is to carry out very high level conceptual processing to test infrastructure component, infrastructure component is packaged using test library thought, id is obtained by way of Uiautomator, pass through the API library of access Uiautomator simultaneously, realization such as clicks the operation of each control, inputs text, rolls, and finally operates these and what is operated is combined and packaged into an infrastructure component;Not only the design of script module and test library had been contained, but also has had data script to combine the ability with crucial word drive, the reasonable combination of different thoughts, so that test frame availability, reusability and flexibility are greatly improved.

Description

A kind of automation combination frame reflected based on Android platform and Java
Technical field
The present invention relates to a kind of primary frame of Android, the optimizations of specifically a kind of pair Android automatic test It realizes, belongs to radio network technique field.
Background technique
Today of 21 century, with the development of the society, the mature development of new generation of wireless network technology has been pushed, to new one For the performance of mobile device, more stringent requirements are proposed, needs to have efficient system stable operation.And Android platform is wide General application brings great convenience to daily life at leading force for people's lives.In entire application and development Test is unusual the key link in the process, needs to carry out the test of more wheel functions, performance, stability, reliability etc., no Disconnected all kinds of wrong and loopholes of amendment, step up the availability of application, online user can be given to use.
Software test plays epochmaking effect during modern software development and maintenance, be ensure software reliability and Improve the important means of software quality.Speed measuring with software is required with user continuous improvement and software engineering technology Increasingly mature, software test has penetrated into each link of software life-cycle, in software development, production and maintenance process It plays an increasingly important role.Wherein, a branch of the automatization testing technique as software testing technology, by more next More uses in each stage of software test, be greatly saved software test cost, improve testing efficiency, shorten it is soft The part development cycle.Along with the rapid development of mobile Internet and the popularization and application of smart phone, mobile applications (APP) It emerges one after another.Mobile APP has more type, updating decision, upgrading is frequent, application environment is diversified, stability requirement is high and concurrent Measure the features such as big, how to carry out the test of high quality guarantee the quality of mobile APP to promoted user experience increasingly by The concern of industry.
The mobile APP test job amount of traditional craft is big, repetitive operation is more, will expend a large amount of manpowers and time, efficiency Low and pure manual test is unable to complete high-precision pressure test, concurrent test, load testing and stability test etc..Automatically Test execution efficiency can be effectively improved and control testing cost expense by changing test, but a design it is not scientific and reasonable enough from Dynamicization test frame cannot not only improve efficiency, and will increase construction cost instead, while bring undying maintenance work.For The validity for promoting test execution avoids writing a large amount of duplicated code in test item simultaneously, how to construct a strong robust Property, convenient for safeguarding, highly scalable mobile APP automated test frame be badly in need of research content.
Summary of the invention
High, reusability that the technical problem to be solved by the present invention is to the module coupling degrees encountered in automatic test course Difference, configurableization are low, provide a kind of automation reflected based on Android platform and Java in order to overcome the deficiencies of the prior art Combination frame.
The present invention provides a kind of automation combination frame reflected based on Android platform and Java, comprising:
Infrastructure component layer: the layer is to carry out very high level conceptual processing to test infrastructure component, using test library thought to basis Component is packaged, and id is obtained by way of Uiautomator, while by the API library of access Uiautomator, being realized The operation of each control is such as clicked, text is inputted, rolls, finally these are operated and what is operated is combined and packaged into a base Plinth component;
Execute access layer: the layer uses Java reflection technology, is the intermediary of data Yu keyword layer and infrastructure component layer, mainly Configuration data is read in by XML parser, executes test using the component of Java reflection mechanism dynamic call infrastructure component layer, Java reflection mechanism dynamically loading classes and can call class method and using class members by configuration file when program is run Variable;
Data Layer and keyword layer: in the layer, tables of data and keyword configure the layer, using data-driven as core in the way of XML The heart realizes the separation of test code and data for the test data input that automatic test code provides parametrization, is driven with keyword It moves and realizes the associating key word hierarchical structure for testing code and use-case as further technical solution of the present invention for core
Further, the keyword hierarchy structure is divided into test case set, test case layer, testing procedure layer, keyword Definition it is inseparable with the structure of test case set, a set of test case set contains a series of test cases, and one A test case is to be combined to constitute by each testing procedure.
Further, the test case set concrete function are as follows: a set of test case set represents a tested business All function points may include the tests of multiple independent function points;Test item is denoted as set B test case set and is denoted as Set R is then:
Further, the test case layer concrete function are as follows: for the independent test use-case for realizing particular test functionality point Include data needed for test input, the processing for executing logic, anticipated output in use-case, test case set is represented with T Then:
Further, the testing procedure layer concrete function are as follows: test case is split into series of operation steps and is write Test case is exactly the connection by testing procedure by the progress of execution sequence in logic, represents testing procedure set then with S:
Further, the test element unit, that is, keyword operational order is the reusable code components of infrastructure component layer With specific business is not related to be used by any testing procedure, with u proxy component unit U proxy component unit set Then:
The invention adopts the above technical scheme compared with prior art, has following technical effect that based on Android visitor The automation at family end is tested and assessed, and is improved the efficiency of test, is showed preferable user experience process;By combining Android client Test, analysis optimization is carried out to Android automated test frame, in conjunction with a kind of hierarchical relationship of the primary frame of Android, Based on Java reflection mechanism, the function of binding modules thought and primary API when calling, with the combination of data script and keyword It is driven to core, keeps test case associated with test code, and service logic, test data and test code are isolated; It can accomplish test execution and exploitation loose coupling, high degree of automation, convenient for fast and effeciently carrying out Android mobile application software Test;Not only the design of script module and test library had been contained, but also has had data script to combine the ability with crucial word drive, no With the reasonable combination of thought, so that test frame availability, reusability and flexibility are greatly improved.
Detailed description of the invention
Fig. 1 is that design data of the invention drives thought structure chart.
Fig. 2 is design hierarchical diagram of the invention.
Fig. 3 is keyword hierarchy structural schematic diagram of the invention.
Fig. 4 is frame diagram of the invention.
Fig. 5 is the correlation data figure of two ways in the present invention.
Fig. 6 is the flow chart that test exemple automation executes in the present invention.
Specific embodiment
1-6 is described in further detail technical solution of the present invention with reference to the accompanying drawing:
The present embodiment proposes a kind of automation combination frame reflected based on Android platform and Java, comprising:
Infrastructure component layer: the layer is to carry out very high level conceptual processing to test infrastructure component, using test library thought to basis Component is packaged, and id is obtained by way of Uiautomator, while by the API library of access Uiautomator, being realized The operation of each control is such as clicked, text is inputted, rolls, finally these are operated and what is operated is combined and packaged into a base Plinth component;
Execute access layer: the layer uses Java reflection technology, is the intermediary of data Yu keyword layer and infrastructure component layer, mainly Configuration data is read in by XML parser, executes test using the component of Java reflection mechanism dynamic call infrastructure component layer, Java reflection mechanism dynamically loading classes and can call class method and using class members by configuration file when program is run Variable;
Data Layer and keyword layer: in the layer, tables of data and keyword configure the layer, using data-driven as core in the way of XML The heart realizes the separation of test code and data for the test data input that automatic test code provides parametrization, is driven with keyword Move the associating key word hierarchical structure that test code and use-case is realized for core.
Keyword hierarchy structure is divided into test case set, test case layer, testing procedure layer, the definition and survey of keyword The structure of example set on probation is inseparable, and a set of test case set contains a series of test cases, and a test case It is to be combined to constitute by each testing procedure.
Test case set concrete function are as follows: all function points that a set of test case set represents a tested business can With the test comprising multiple independent function points;Test item is denoted as set B test case set and is denoted as set R then:
Test case layer concrete function are as follows: to realize that the independent test use-case of particular test functionality point includes surveying in use-case Data needed for examination input, the processing for executing logic, anticipated output, test case set is represented with T then:
Testing procedure layer concrete function are as follows: splitting into series of operation steps to write test case by test case is exactly to incite somebody to action Testing procedure is carried out connection in logic by execution sequence, represents testing procedure set then with S:
Test element unit, that is, keyword operational order is the reusable code components of infrastructure component layer and specific business It is not related to be used by any testing procedure, then with u proxy component unit U proxy component unit set:
In the present invention, realization for automatic test, rely on the testing tool Robotium based on Android platform come It realizes, Robotium is a open source automated test frame, and the test frame that it combines Android itself to provide can be right Application program carries out automatic test.Test frame supports multiple Activities automatic movables, and the readability of test case is very Height, and support the operation to WebView.Test frame, which integrates Uiautomator, can fast implement the writing of test case, together When incorporate Maven or Ant run test, facilitate packing execute.Test frame supports Remote Control mode, is based on Instrumentation realizes that the interface provided can satisfy most of automation demanding, and application method is simple.
Based on testing tool Robotium, test program can generate APK file, and Robotium requires tested program and test Program signature is consistent, so before test using the signature of signature tool modification tested program.New APK text is generated after signature Part, while Main activity is obtained for using during Test code below.
Test uses robotium-solo-5.0.1.jar, its available control and analog subscriber movement, such as Click, slide etc., following function in solo has mainly been used in this test process: 1 clicks control: click On Text (), click On Button () etc.;2 obtain control: get Current Activity (), get Text () etc.;3 wait control: wait For Text () etc.;4 input datas: enter Text ();5 other Function: go Back (), sleep () etc..
Tool is carried in Android SDK: control identifier-Hierarchy Viewer, opening it can be obtained simulation Device connects in upper mobile device control element in Android application, for example, button id and tested application it is each Activity title is used for test
The debugging tool of Android SDK: ADB-major function has: 1 can install application program on simulator or equipment; The shell-command row of 2 running equipments;The port mapping of 3 management equipments or mobile phone simulator;Between 4 computers and equipment File transmission.
The invention further relates to the thoughts of partial automation test frame, comprising:
Modularization idea: modularization idea will test the operation of code using the abstract and encapsulation principle of Java on this basis It hides, only externally exposure one can call shielded interface to be used to execute test method, so that the design of frame need not be paid close attention to Specific application and correlative detail, while can avoid unfavorable interference of the change to test of other block codes, realize that decoupling is high The purpose of effect.Test points different in test function point are split with modularization idea herein, and by the test after fractionation The testing procedure of point is packaged, and forms the test module that it can be used repeatedly.
Test library thought: test library thought is that the test of application program creates a series of library text comprising function sets APP is tested common operation and is packaged in the form of component, in conjunction with above-mentioned modularization idea, can go to transmit by interface by part Parameter realizes the interaction between module.
Data script combination thought: the data script combination ideological system is as shown in Fig. 1, and core is exactly executing test Required data are abstracted from test script, are stored in external data file, such as XML file, database, text text Shelves.It is this to decouple the reusability for improving test script.Using data script combination thought, pass through the knot of different data scripts Fruit, with the same test process to different inputs, output combined test.It tests input data and anticipated output result constitutes one Table is opened, every a line in table represents each testing procedure, and then constructs an automatic test course.
Crucial word drive thought: crucial word drive thought separates actual test case with program coding, to test When use-case is modified, without code maintenance.The thought pulls out test data from software test scripted code to be come, point From test logic and test script code, it is embodied in test design and strategy in test data, rather than concentrates on script generation In code.Using the automated test frame designed herein, tester can be constructed by using the keyword of design use-case Test case, improves the reusability and flexibility of automatic test, and the crucial word instruction of different use-cases can be used to drive Different test flow directions and test result, while comparing the difference of use-case attribute.
It is specific as follows shown with the test element unit of app test item:
No keyword Parameter 1 Parameter 2 Parameter 3
1 testInputTextByResourceid ResourceId Text
2 testFlingVerticalByResourceId ResourceId Methods Times
Wherein testInputTextByResourceId is that text is inputted in text box by the ResourceId of text box Component;TestFlingVerticalByResourceId is to realize that the component of lateral quick sliding is logical by ResourceId It crosses parameter Method selection and still rolls through the specified rolling number of Times backward forward.
Automatic test can be improved according to the division that above-mentioned test case set, test case, testing procedure carry out level The reusability of code.
Test data and test code are encapsulated based on the above thought and design.Using Uiautomator tool Basic control is further encapsulated, Java reflection mechanism realization test data is verified and tests being isolated between code.
Every class testing movement can define one or more components, the corresponding keyword of each component according to different attribute It is such as ClickByButton according to the keyword of the click event of Button attribute, tester needs to click Button every time Operation when the keyword that can be used can call the component, execute corresponding test action i.e. activity classification, code mould Blockization integration.
Said modules library can be packaged as ModuleApp.jar, be used for tester's implementation of test cases.Follow-up test Personnel need to only write XML test case, call the Component Gallery to carry out test execution.The mode of proposition is after Component Gallery is abundant Will not because of test case increase and increase code, test code is safeguarded well, and reduces debugging Cost can greatly improve the efficiency and quality of automatic test.
Automatic test cases are write:
XML document of writing that use-case is completed by writing XML document is a use-case, includes several steps under each use-case Suddenly.Its content format is two-level configuration, and wherein relevant information of the father node for defining current use-case is as follows:
<root startid="1" nextDoc="testModule.xml"
errNextDoc="-1" className="com.test.app.Utils">
Wherein startid indicates that current use-case starts to execute the id number nextDoc of step and indicates that current use-case executes when passing through The document name errNextDoc of next use-case indicates document name (- 1 expression interruption of the obstructed out-of-date next use-case of current use-case Execute) class Name indicate reference component library name.
Child node indicates that each operating procedure its format in use-case is defined as follows:
<Button id="btn" type="ClickByButton"
Value=" submission " next=" 2 " errnext=" -1 " errlog=" 1 "/>
Wherein id indicates that the number type of current procedures indicates that the keyword of references component, Value are the data of transmitting, parameter Next is executed not for connecting the next step to be executed when current procedures execution passes through, errnext for connecting current procedures By when the next step to be executed (- 1 indicates to interrupt the execution of current use-case), errlog is for controlling log output.
The method for writing test case above, which is easy to upper hand, reduces requirement and test step to tester's code capacity The rapid clear debugging for being easy to test process facilitates the positioning and maintenance of use-case.
Automatic test cases execute:
The test case finished writing and test suite library are uploaded into mobile phone, issue task execution test case, output journal and report Wrong screenshot, tester can be by checking log and screenshot, positioning analysis problem.
The above, the only specific embodiment in the present invention, but scope of protection of the present invention is not limited thereto, appoints What is familiar with the people of the technology within the technical scope disclosed by the invention, it will be appreciated that expects transforms or replaces, and should all cover Within scope of the invention, therefore, the scope of protection of the invention shall be subject to the scope of protection specified in the patent claim.

Claims (6)

1. a kind of automation combination frame reflected based on Android platform and Java characterized by comprising
Infrastructure component layer: the layer is to carry out very high level conceptual processing to test infrastructure component, using test library thought to basis Component is packaged, and id is obtained by way of Uiautomator, while by the API library of access Uiautomator, being realized The operation of each control is such as clicked, text is inputted, rolls, finally these are operated and what is operated is combined and packaged into a base Plinth component;
Execute access layer: the layer uses Java reflection technology, is the intermediary of data Yu keyword layer and infrastructure component layer, mainly Configuration data is read in by XML parser, executes test using the component of Java reflection mechanism dynamic call infrastructure component layer, Java reflection mechanism dynamically loading classes and can call class method and using class members by configuration file when program is run Variable;
Data Layer and keyword layer: where tables of data and keyword configure the layer, using data-driven as core in the way of XML Realize the separation of test code and data, for the test data input that automatic test code provides parametrization with crucial word drive The associating key word hierarchical structure of test code and use-case is realized for core.
2. a kind of automation combination frame reflected based on Android platform and Java according to claim 1, feature Be, the keyword hierarchy structure is divided into test case set, test case layer, testing procedure layer, the definition of keyword with The structure of test case set is inseparable, and a set of test case set contains a series of test cases, and a test is used Example is to be combined to constitute by each testing procedure.
3. a kind of automation combination frame reflected based on Android platform and Java according to claim 2, feature It is, the test case set concrete function are as follows: a set of test case set represents all function points of a tested business It may include the test of multiple independent function points;Test item is denoted as set B test case set and is denoted as set R then:
4. a kind of automation combination frame reflected based on Android platform and Java according to claim 2, feature Be, the test case layer concrete function are as follows: for realize particular test functionality point independent test use-case include in use-case Data needed for test input, the processing for executing logic, anticipated output, test case set is represented with T then:
5. a kind of automation combination frame reflected based on Android platform and Java according to claim 2, feature It is, the testing procedure layer concrete function are as follows: test case is split into series of operation steps write test case and be exactly Testing procedure is subjected to connection in logic by execution sequence, represents testing procedure set then with S:
6. a kind of automation combination frame reflected based on Android platform and Java according to claim 1, feature are existed In the test element unit, that is, keyword operational order is that the reusable code components of infrastructure component layer are not closed with specific business System can be used by any testing procedure, then with u proxy component unit U proxy component unit set:
CN201910119601.7A 2019-02-18 2019-02-18 A kind of automation combination frame reflected based on Android platform and Java Pending CN109885493A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910119601.7A CN109885493A (en) 2019-02-18 2019-02-18 A kind of automation combination frame reflected based on Android platform and Java

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910119601.7A CN109885493A (en) 2019-02-18 2019-02-18 A kind of automation combination frame reflected based on Android platform and Java

Publications (1)

Publication Number Publication Date
CN109885493A true CN109885493A (en) 2019-06-14

Family

ID=66928273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910119601.7A Pending CN109885493A (en) 2019-02-18 2019-02-18 A kind of automation combination frame reflected based on Android platform and Java

Country Status (1)

Country Link
CN (1) CN109885493A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111338965A (en) * 2020-03-02 2020-06-26 五八有限公司 Case testing method and device, electronic equipment and storage medium
CN112445401A (en) * 2020-10-26 2021-03-05 北京达佳互联信息技术有限公司 Document sliding processing method and device and server
CN115829034A (en) * 2023-01-09 2023-03-21 白杨时代(北京)科技有限公司 Method and device for constructing knowledge rule execution framework

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120047489A1 (en) * 2010-08-19 2012-02-23 Salesforce.Com, Inc. Software and framework for reusable automated testing of computer software systems
CN102819492A (en) * 2012-08-02 2012-12-12 中山大学 Keyword driven automatic testing frame on basis of Android
CN104699604A (en) * 2015-02-28 2015-06-10 百度在线网络技术(北京)有限公司 Method and device for testing Android application on basis of customized rendering engine
CN107451060A (en) * 2017-08-01 2017-12-08 安徽善金科技股份有限公司 A kind of across mobile terminal automated test frame system
CN108427646A (en) * 2018-04-13 2018-08-21 中国民航信息网络股份有限公司 Android App automated test frames construction method based on Appium and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120047489A1 (en) * 2010-08-19 2012-02-23 Salesforce.Com, Inc. Software and framework for reusable automated testing of computer software systems
CN102819492A (en) * 2012-08-02 2012-12-12 中山大学 Keyword driven automatic testing frame on basis of Android
CN104699604A (en) * 2015-02-28 2015-06-10 百度在线网络技术(北京)有限公司 Method and device for testing Android application on basis of customized rendering engine
CN107451060A (en) * 2017-08-01 2017-12-08 安徽善金科技股份有限公司 A kind of across mobile terminal automated test frame system
CN108427646A (en) * 2018-04-13 2018-08-21 中国民航信息网络股份有限公司 Android App automated test frames construction method based on Appium and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杜巍: "基于Java反射的APP自动化混合测试框架的研究与实现", 《移动通信》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111338965A (en) * 2020-03-02 2020-06-26 五八有限公司 Case testing method and device, electronic equipment and storage medium
CN112445401A (en) * 2020-10-26 2021-03-05 北京达佳互联信息技术有限公司 Document sliding processing method and device and server
CN115829034A (en) * 2023-01-09 2023-03-21 白杨时代(北京)科技有限公司 Method and device for constructing knowledge rule execution framework
CN115829034B (en) * 2023-01-09 2023-05-30 白杨时代(北京)科技有限公司 Method and device for constructing knowledge rule execution framework

Similar Documents

Publication Publication Date Title
CN102819492B (en) Keyword driven automatic testing frame on basis of Android
CN100401264C (en) Data-driven automatic testing system and method
CN107861728B (en) Method and system for converting traditional program language into modern program language
CN103198009B (en) A kind of universal testing method, system and related device
CN102087597B (en) J2EE and component set-based visualized development platform
CN103441900A (en) Centralization cross-platform automated testing system and control method thereof
CN109885493A (en) A kind of automation combination frame reflected based on Android platform and Java
CN104778124A (en) Automatic testing method for software application
EP1960869A1 (en) Method and system for assisting a software developer in creating source code for a computer program
CN110928783A (en) RobotFramework-based automatic test datamation reconstruction platform
CN102306122A (en) Automated testing method and equipment
CN108804300A (en) Automated testing method and system
CN110705724A (en) Reusable automatic operation and maintenance management system
CN112699055A (en) Software automation test method and system with low maintenance cost
CN110221815B (en) Automatic generation method of control software model based on ontology
CN112114789A (en) Service development method and equipment
CN109753281B (en) Micro-grid energy management strategy visualization development tool based on graphical programming
CN117370217A (en) Automatic interface test result generation method based on python
Tang et al. Towards adaptive framework of keyword driven automation testing
CN109491904B (en) Automatic testing method and device for spark SQL application program
CN115758789B (en) Software architecture design and architecture transfer method of complex real-time embedded system
CN115951970A (en) Heterogeneous multi-simulation software integrated development environment
CN109933308A (en) The customed general-purpose system of remote sensing satellite data prediction flow path visual based on MPI+CUDA
CN115407997A (en) Agile development application method and system based on low codes
CN115705250A (en) Monitoring stack usage to optimize programs

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190614