CN107239405A - A kind of automated testing method based on many browser kernels of Android - Google Patents

A kind of automated testing method based on many browser kernels of Android Download PDF

Info

Publication number
CN107239405A
CN107239405A CN201710657427.2A CN201710657427A CN107239405A CN 107239405 A CN107239405 A CN 107239405A CN 201710657427 A CN201710657427 A CN 201710657427A CN 107239405 A CN107239405 A CN 107239405A
Authority
CN
China
Prior art keywords
browser
core
scripts
android
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710657427.2A
Other languages
Chinese (zh)
Other versions
CN107239405B (en
Inventor
孔帅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201710657427.2A priority Critical patent/CN107239405B/en
Publication of CN107239405A publication Critical patent/CN107239405A/en
Application granted granted Critical
Publication of CN107239405B publication Critical patent/CN107239405B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of automated testing method based on many browser kernels of Android, this method inherits WebView all conventional operations, core type is currently tested by CoreType variable labels, extension provides startTest (url on this basis, scripts []) method provides the compatibility tests closed in scripts [] test script collection of WebApp issued for domain name form, and scripts [] test script is by some suffix name * .js automatic test cases script based on JavaScript scripting languages.The present invention including four kinds of major browsers kernels of main flow in android system be WebKit, Blink, Chromium, Tengxun X5 it is integrated, to meet the automation compatibility test that browser, third party's browser, wechat microblogging embed the Web App issued on the platforms such as browser that carries of basic all standing android system.

Description

A kind of automated testing method based on many browser kernels of Android
Technical field
The present invention relates to the research and development of Android Mobile solutions and software test field, more particularly to one kind are many based on Android The automated testing method of browser kernel.
Background technology
With the highly popular of mobile Internet, the establishment of Html5 codes and standards and technology maturation, and each terminal device The development increasingly of hardware performance and browser kernel, WebApp or wechat public number microfiber web and micro services based on Html5 are Important component through being applied as mobile Internet.Nowadays, the Web App of Html5ization show be easy to exploitation, iteration it is fast The characteristic such as fast, easily transmitted, has been widely used in moving each neck such as electric business, mobile office, Domestic News, video-game Domain.But because the various individual demands of the mobile phone terminal of mobile interchange network users are present, cause to browse and using the clear of WebApp Diversity is presented in device (including the embedded browser of the application such as wechat, microblogging) of looking at, and also has led to a series of because of browser kernel There is different degrees of UI and compatibility issue functionally in difference.Android is asked because of its open ecology of increasing income, its compatibility Topic is showed particularly to highlight, and IOS research and development are ecological and system is more closed, and Web App are substantially based on Safari browsers With correspondence kernel, compatibility issue presents less.So, it is contemplated that a kind of effective method is found, it is integrated to be applicable In the different browsers kernel of android system, test script is provided by javascript scripts, only in stand-alone device On, you can concentrate the compatibility automated test completed under many browser kernels.
The content of the invention
Part in view of the shortcomings of the prior art, it is an object of the invention to provide one kind based on browsing Android more The automated testing method of device kernel, this method include android system on four kinds of major browsers kernels of main flow be WebKit, Blink, Chromium, Tengxun X5 it is integrated, with meet basic all standing android system to carry browser, third party clear Looking at device, wechat microblogging embeds the Web App issued on the platform such as browser automation compatibility test.
The purpose of the present invention is achieved through the following technical solutions:
A kind of automated testing method based on many browser kernels of Android, its method and step is as follows:
Step A, under integrated ADT, AndroidStudio or IntelliJ IDEA Android development environments create work Journey, introduces WebKit, Blink, Chromium, the official of tetra- kinds of different browser kernels of Tengxun X5 respectively in the engineering SDK, official SDK include jar bags, so storehouses;
Step B, in Android development environments or step A engineering construct SuperWebView base class, and introduce this four The WebView classes for planting kernel are used as member variable;
Step C, the member variable for setting WebView classes are CoreType, clear to mark that current test object uses Look at device core type, totally four often comprising CORE_WEBKIT, CORE_BLINK, CORE_CHROMIUM, CORE_X5 by CoreType Amount;
Step D, judge with reference to Switch branching logics, rewrite SuperWebView base class constructed fuction and browser conventional Function;
Step E, corresponding initial configuration is carried out in step D constructed fuction, to open browser object pair JavaScript support;
Step F, startTest (url, scripts []) function is write for SuperWebView base class, with for treating geodetic Location url, test script is sequentially performed according to scripts [] array;
Step G, Web App to be measured are distributed in Intranet or public network in domain name form, are that may have access to by URL;
Step H, using JavaScript scripts, be the test pin that Web App to be measured write some suffix name * .js This, its core methed be using include simulation click on, simulation rollings, simulation input, simulate be delayed, simulation loop method is to be measured The DOM element of the Web App pages carries out simulated operation test;
Step I, by if-else condition judgment sentences, judge whether to reach that script is finally expected running status;Meanwhile, The daily record that reports an error is recorded with reference to WebView, SuperWebView TestJudger modules is write, passes through the TestJudger modules Ultimately form the report of percent of pass and error rate.
The present invention compared with the prior art, with advantages below and beneficial effect:
The present invention include android system on four kinds of major browsers kernels of main flow be WebKit, Blink, Chromium, Tengxun X5's is integrated, and browser, third party's browser are carried, in wechat microblogging with meet basic all standing android system The Web App issued on the platforms such as embedding browser automation compatibility test.
Brief description of the drawings
Fig. 1 is the structural representation of the SuperWebView base class of the present invention;
Fig. 2 is the automatic testing process schematic diagram of the present invention.
Embodiment
The present invention is described in further detail with reference to embodiment:
Embodiment
As shown in Figure 1 and Figure 2, how interior a kind of automated testing method based on many browser kernels of Android, Android is Core automated testing method is the SuperWebView that the compatible different browsers kernel of an energy is developed with Android primary codes Base class, and all conventional operations for allowing it to inherit WebView, core type is currently tested by CoreType variable labels, Extension provides startTest (url, scripts []) methods and existed to provide the WebApp issued for domain name form on the basis of this The compatibility test that scripts [] test script collection closes, and scripts [] test script is by some suffix name * .js The automatic test cases script based on JavaScript scripting languages.Its specific method step is as follows:
Step A, under integrated ADT, AndroidStudio or IntelliJ IDEA Android development environments create work Journey, introduces WebKit, Blink, Chromium, the official of tetra- kinds of different browser kernels of Tengxun X5 respectively in the engineering SDK, official SDK include jar bags, so storehouses;
Step B, in Android development environments or step A engineering construct SuperWebView base class, and introduce this four The WebView classes for planting kernel are used as member variable;
Step C, the member variable for setting WebView classes are CoreType, clear to mark that current test object uses Look at device core type, totally four often comprising CORE_WEBKIT, CORE_BLINK, CORE_CHROMIUM, CORE_X5 by CoreType Amount;
Step D, judge with reference to Switch branching logics, rewrite SuperWebView base class constructed fuction and browser conventional Function;
Step E, corresponding initial configuration is carried out in step D constructed fuction, to open browser object pair JavaScript support;
Step F, startTest (url, scripts []) function is write for SuperWebView base class, with for treating geodetic Location url, test script is sequentially performed according to scripts [] array (its idiographic flow is see Fig. 2);
Step G, Web App to be measured are distributed in Intranet or public network in domain name form, are that may have access to by URL;
Step H, using JavaScript scripts, be the test pin that Web App to be measured write some suffix name * .js This, its core methed be using include simulation click on, simulation rollings, simulation input, simulate be delayed, simulation loop method is to be measured The DOM element of the Web App pages carries out simulated operation test;
Step I, by if-else condition judgment sentences, judge whether to reach that script is finally expected running status;Meanwhile, The daily record that reports an error is recorded with reference to WebView, SuperWebView TestJudger modules is write, passes through the TestJudger modules Ultimately form the report of percent of pass and error rate.
The concrete methods of realizing of SuperWebView base class is as follows:
(1) enumeration type, including four static constants are defined:
CORE_WEBKIT=0;//Webkit core types
CORE_BLINK=1;//Blink core types
CORE_CHROMIUM=2;//Chromium core types
CORE_X5=3;// Tengxun X5 core types
(2) current browser core type marking variable coreType is declared, and completes initialization definitions:
CoreType=CORE_WEBKIT;
(3) loading URL methods are provided, and its interface prototype is:
public void loadUrl(String url);
(4) provide and start automated testing method, its interface prototype is:
public void startTest(String url,Strings[]scrips);
(5) test script loader ScriptsLoader { } is realized
(6) test determining device TestJudger { } is realized
The write method of test case script can be specifically summarised as:
Object.click () is clicked in simulation, so that id is targetObject button as an example:
document.getElementById(“targetObject”).click();
Simulation rolls window.scrollTo (), exemplified by being rolled to 1/2 document height:
window.scrollTo(0,document.body.offsetHeight/2);
Simulation input object.innerHtml=XXX, so that id is targetEdit input frame as an example:
Document.getElementById (" targetEdit ") .innerHtml=" is for input data ";
Simulation delay setTimeOut (performs func, delay), by taking the 1000ms that is delayed as an example:
setTimeOut(testFunc(),1000);
Simulation loop setInterval (performs func, interval), by taking the 1000ms of interval as an example:
setInterval(testFunc(),1000);
It is for the method for removing circulation:clearInterval().
ScriptsLoader concrete methods of realizing is:
The test case script write in the write method of test case script is placed on the internal or external SD of mobile phone In storage card, and its file store path is provided, it is transmitted to String [] scripts parametric form ScriptsLoader, a thread Thread is opened by ScriptsLoader, and javascript sentences are taken out in row and separately, false If handle word string is handleStr1, handleStr2, handleStr3 ..., and with interval 1000ms, notifies main thread, utilize loadUrl(“javascript:"+handleStr) and mode perform, untill current script handle is fully completed, but after Continuous circulation performs next script.Treat that all scripts are finished, thread terminates.
TestJudger concrete methods of realizing is:
In WebView html, css, javascript interpreter, when running error, can automatic feedback mistake it is different Normal handle, TestJudger mainly needs to intercept anomalous event, and counts the abnormal number of each test script respectively and specific Abnormality code row.If test script can not be performed completely, the step handle line number correctly gone in report prompting (handleN);If test script can be performed completely, count that whole script completely performs is time-consuming.With reference to JavaScript If-else condition judgment sentences, by whether reaching the expected page, or there is expected DOM element result, to have discriminated whether Correct perform completes test script.
Core index is as follows:
Run integrity degree (100%):The correct operation complete line number of line number/script.
Error number (individual):The Javascript intercepted and captured by WebView kernels reports an error number.
Error log:By the WebView abnormality code sections returned and the abnormal row of wrong abnormal cause+test case script Number.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.

Claims (1)

1. a kind of automated testing method based on many browser kernels of Android, it is characterised in that:Its method and step is as follows:
Step A, under integrated ADT, AndroidStudio or IntelliJ IDEA Android development environments engineering is created, Introduce WebKit, Blink, Chromium, the official SDK of tetra- kinds of different browser kernels of Tengxun X5 respectively in the engineering, Official SDK includes jar bags, so storehouses;
Step B, the construction SuperWebView base class in Android development environments or step A engineering, and introduce in these four The WebView classes of core are used as member variable;
Step C, the member variable of setting WebView classes are CoreType, to the browser for marking current test object to use Core type, CoreType includes CORE_WEBKIT, CORE_BLINK, CORE_CHROMIUM, CORE_X5 totally four constants;
Step D, judge with reference to Switch branching logics, rewrite SuperWebView base class constructed fuction and browser and often use letter Number;
Step E, corresponding initial configuration is carried out in step D constructed fuction, to open browser object pair JavaScript support;
Step F, startTest (url, scripts []) function is write for SuperWebView base class, with for address to be measured Url, test script is sequentially performed according to scripts [] array;
Step G, Web App to be measured are distributed in Intranet or public network in domain name form, are that may have access to by URL;
Step H, using JavaScript scripts, be the test script that Web App to be measured write some suffix name * .js, its Core methed be using include simulation click on, simulation rollings, simulation input, simulate be delayed, simulation loop method is to Web to be measured The DOM element of the App pages carries out simulated operation test;
Step I, by if-else condition judgment sentences, judge whether to reach that script is finally expected running status;Meanwhile, with reference to WebView records the daily record that reports an error, and writes SuperWebView TestJudger modules, final by the TestJudger modules Form the report of percent of pass and error rate.
CN201710657427.2A 2017-08-03 2017-08-03 Automatic testing method based on Android multi-browser kernel Active CN107239405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710657427.2A CN107239405B (en) 2017-08-03 2017-08-03 Automatic testing method based on Android multi-browser kernel

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710657427.2A CN107239405B (en) 2017-08-03 2017-08-03 Automatic testing method based on Android multi-browser kernel

Publications (2)

Publication Number Publication Date
CN107239405A true CN107239405A (en) 2017-10-10
CN107239405B CN107239405B (en) 2020-04-28

Family

ID=59989188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710657427.2A Active CN107239405B (en) 2017-08-03 2017-08-03 Automatic testing method based on Android multi-browser kernel

Country Status (1)

Country Link
CN (1) CN107239405B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885662A (en) * 2017-11-09 2018-04-06 郑州云海信息技术有限公司 A kind of method of testing based on more browser multi-version compatibility sex chromosome mosaicisms
CN109144497A (en) * 2018-07-06 2019-01-04 航天星图科技(北京)有限公司 A kind of geographical space browser platform and construction method based on Android
CN111694724A (en) * 2019-03-15 2020-09-22 百度在线网络技术(北京)有限公司 Testing method and device of distributed table system, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530233A (en) * 2013-10-31 2014-01-22 广州菁英信息技术有限公司 Automation testing method, testing server and system of mobile browser
US20150020052A1 (en) * 2013-07-15 2015-01-15 Asaf Saar System and method for automating testing
CN104699604A (en) * 2015-02-28 2015-06-10 百度在线网络技术(北京)有限公司 Method and device for testing Android application on basis of customized rendering engine
CN104731694A (en) * 2013-12-18 2015-06-24 中国银联股份有限公司 Browser compatibility test analyzing method and system
US9405660B2 (en) * 2011-09-23 2016-08-02 Amazon Technologies, Inc. Intermediary for testing content and applications

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9405660B2 (en) * 2011-09-23 2016-08-02 Amazon Technologies, Inc. Intermediary for testing content and applications
US20150020052A1 (en) * 2013-07-15 2015-01-15 Asaf Saar System and method for automating testing
CN103530233A (en) * 2013-10-31 2014-01-22 广州菁英信息技术有限公司 Automation testing method, testing server and system of mobile browser
CN104731694A (en) * 2013-12-18 2015-06-24 中国银联股份有限公司 Browser compatibility test analyzing method and system
CN104699604A (en) * 2015-02-28 2015-06-10 百度在线网络技术(北京)有限公司 Method and device for testing Android application on basis of customized rendering engine

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
XINXIN LI ET AL: "Modeling web application for cross-browser compatibility testing", 《15TH IEEE/ACIS INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, ARTIFICIAL INTELLIGENCE, NETWORKING AND PARALLEL/DISTRIBUTED COMPUTING (SNPD)》 *
刘桂平: "Robotium对于安卓多内核浏览器自动化测试支持的研究_", 《网络安全技术与应用》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885662A (en) * 2017-11-09 2018-04-06 郑州云海信息技术有限公司 A kind of method of testing based on more browser multi-version compatibility sex chromosome mosaicisms
CN109144497A (en) * 2018-07-06 2019-01-04 航天星图科技(北京)有限公司 A kind of geographical space browser platform and construction method based on Android
CN109144497B (en) * 2018-07-06 2021-07-20 中科星图股份有限公司 Geographic space browser platform based on android and construction method
CN111694724A (en) * 2019-03-15 2020-09-22 百度在线网络技术(北京)有限公司 Testing method and device of distributed table system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107239405B (en) 2020-04-28

Similar Documents

Publication Publication Date Title
Gupta et al. PHP-sensor: a prototype method to discover workflow violation and XSS vulnerabilities in PHP web applications
CN105068925B (en) Software safety defect finds system
CN102272757B (en) Method for server-side logging of client browser state through markup language
CN105912473B (en) Mobile APP automatically testing platform and test method based on BDD
CN108304498A (en) Webpage data acquiring method, device, computer equipment and storage medium
CN106897215A (en) A kind of method gathered based on WebView webpages loading performance and user behavior flow data
CN102436563B (en) Method and device for detecting page tampering
Pattabiraman et al. Dodom: Leveraging dom invariants for web 2.0 application robustness testing
CN101751530B (en) Method for detecting loophole aggressive behavior and device
CN100478954C (en) Portal data processing system and method for managing portal response times
CN107908959A (en) Site information detection method, device, electronic equipment and storage medium
CN107239405A (en) A kind of automated testing method based on many browser kernels of Android
CN103647678A (en) Method and device for online verification of website vulnerabilities
CN104834588B (en) The method and apparatus for detecting resident formula cross site scripting loophole
CN107340954A (en) A kind of information extracting method and device
CN107506649A (en) A kind of leak detection method of html web page, device and electronic equipment
CN106649531A (en) Webpage detection method and device
Alnaeli et al. Source code vulnerabilities in IoT software systems
Pfeiffer et al. Cross-language support mechanisms significantly aid software development
CN114491560A (en) Vulnerability detection method and device, storage medium and electronic equipment
CN107038117A (en) It is a kind of based on the web automated testing methods that reference is defined between event handling function
CN111125704B (en) Webpage Trojan horse recognition method and system
CN110417746A (en) Cross-site scripting attack defence method, device, equipment and storage medium
CN106528118A (en) Method for solving compatibility of modal and non-modal windows in browser
CN105608383B (en) ActiveX control loophole test method and system

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
GR01 Patent grant
GR01 Patent grant