当前位置:网站首页>Using robot framework to realize multi platform automated testing

Using robot framework to realize multi platform automated testing

2022-06-24 02:05:00 Test development technology

be based on Robot Framework、Jenkins、Appium、Selenium、Requests、AutoIt And other open source frameworks and technologies , Successfully built a general automatic test continuous integration management platform ( hereinafter referred to as “ platform ”), It significantly improves the test quality and the execution efficiency of test cases .

01

Design objectives

  • The platform is universal and supports different types of automated testing The platform frame is lightweight 、 to open up 、 flexible , There is a powerful and rich test library , Full support PC Desktop application ( Such as core counter and online trading system )、Web application ( Such as mall online Hall )、APP application ( Such as mobile securities )、 Interface ( Such as the interface around the counter )、 database ( Such as Oracle) Wait for automated testing , It is convenient for subsequent continuous test development and centralized and unified management .
  • The platform supports automated testing of the whole process The platform display interface is unified 、 Clear 、 concise , Cover test case design 、 Test script development 、 The test execution 、 Test report generation and other processes . Through the unified management of the test process , Lower the threshold for testers to use the platform .
  • The platform has good expansibility 、 Maintainability The platform supports collaborative work 、 Distributed test execution , Can work with version management tools 、 Software defect management system 、 Enterprise mail system integration , At the same time, in the process of continuous iteration of the project , Automated test scripts can be flexibly adjusted and reused .

02

Architecture design

The platform adopts the idea of component and layered architecture , Can be divided into 4 layer , Each layer implements specific functions , And provide interfaces for other layers to call :

chart 1 Platform architecture design

  • The bottom layer is the system under test , It mainly defines the shape of the tested object . Platform support APP、Web and PC Application testing , And interfaces 、 Database and other tests .
  • Up is the test library . In addition to the platform, such as process 、 character string 、 aggregate 、 Screenshot processing and other basic test libraries , Also provide Web、APP、 Extended test library for special tests such as interface , To support different tested systems, select the corresponding test library .
  • In the middle is the test framework , Its role includes use case management 、 Test data management 、 test run 、 Test report, etc .
  • At the top is the continuous construction layer , Responsible for the task 、 machine 、 Queue control and scheduling , Automatically complete the whole test process .

03

Platform implementation

In the selection of automation framework , We choose Robot Framework( hereinafter referred to as “RF”) As the core underlying framework of automated test platform ,Jenkins As a platform for continuous integration and task scheduling , At the same time choose AppiumLibrary、Selenium2Library、RequestsLibrary、AutoItLibrary As an extended test library , To meet different test requirements .

(1)RF frame

RF Is a An open source automated testing framework with rich functions and strong scalability , The main For regression tests with more rounds . The framework forms test logic through the combination of keywords , Finally, it interacts with the tested system through each underlying test library , Complete the test work .

RF The framework is APP、Web、 Interface 、 Database testing, etc Provides standard underlying keywords API, Testers only need to develop custom scripts based on these keywords , It can meet the requirements of its own test .

chart 2 RF Architecture diagram

(2)AppiumLibrary

Appium It's a Open source 、 Cross platform and multi language Test framework for , Compared to other frameworks , It supports iOS and Android Native on the platform 、Web And hybrid application automation testing , Code can be reused between platforms , There is no need to recompile the source code when writing test scripts and running tests , There are not many requirements for programming language in script writing and Implementation , The test is lighter, more flexible .

AppiumLibrary yes RF Based on the framework of Appium Third party extended application test library , can Support mobile securities of securities companies APP Automated test development .

chart 3 Appium Architecture diagram

(3)Selenium2Library

Selenium yes In order to realize multi platform Web Specifically designed for application testing Automated test tool suite , With extensibility 、 Cross platform 、 Multi browser support and other features .Selenium 2 Integrated WebDriver,WebDriver Control the browser directly through native browser support or browser extension , Testers can test according to different platforms 、 Different browsers choose different WebDriver To perform tests .

Selenium2Library yes RF Based on the framework of Selenium2 Of Web Test library , can Support the brokerage Mall 、 Net hall, etc Web Application automation test development .

chart 4 WebDriver Architecture diagram

(4)RequestsLibrary

Interface test is generally Used for interactive development between multiple systems , Or test of application system development with multiple subsystems .Requests Yes, it is Python Language writing , be based on urllib, use Apache2 Licensed Open source protocol HTTP library , To satisfy HTTP Interface test requirements .RequestsLibrary yes RF Under the framework of API Test library , Can support securities companies IFS Or other custom development interfaces to automate test development .

(5)AutoIt Desktop application testing

AutoIt Is a Used to deal with Windows GUI Software for automatic operation , It can simulate keyboard keys ,、 Mouse movement and window or control operation to realize automatic tasks .AutoItLibrary yes RF Based on the framework of AutoIt Of Win32 Desktop application test library , It can support the core counters of securities companies 、 Automatic test and development of desktop application systems such as online trading .

chart 5 Au3Info distinguish GUI Object example

(6)Jenkins Continuous integration

Jenkins It's a kind of Open source continuous integration tools , It supports svn、Git Many other kinds SCM Configuration management tools , You can set up scheduled builds according to project requirements ( Such as every hour 、 Every time interval or what time every night ) Or trigger a build ( Such as source code submission trigger ), Support Shell Script 、Windows The batch 、Ant Construction and other construction methods , So as to meet the requirements of running on different operating systems .

Jenkins Support distributed build ( Be similar to Selenium Grid), It can realize parallel execution of multi host and multi task .Jenkins It also provides rich plug-in support , install Robot Framework plugin The plug-in can execute RF Automated test cases .

chart 6 Jenkins+RF+AppiumLibrary Examples of automated tests

04

Innovation of the platform

1、 The platform architecture is flexible 、 Adapt to a wide range of scenarios , Meet many different types of automated testing

The platform is based on lightweight RF Open source framework , It has good expansibility , By integrating different open source extended test libraries Different types of 、 Different platforms and applications Test of :

  • RF+AppiumLibrary Can be realized APP automated testing , And can be in iOS and Android Reuse code between , You only need to write a unified test script to run on different platforms , This approach will greatly improve the utilization of automated test scripts , Save time writing and debugging test scripts ;
  • RF+Selenium2Library It can be realized. Chrome、IE、Firefox Wait for multiple browsers Web Application automation testing ;
  • RF+AutoItLibrary Can achieve general Win32 Automated testing of desktop applications ;
  • RF+RequestsLibrary Interface automatic test can be realized , wait

So the platform It has considerable flexibility 、 Compatibility and ease of use , Especially suitable for core counters 、 Online trading 、 Mobile Securities and other interfaces have not changed much 、 Software has a long life cycle , Often launch new versions of product automated testing . 2、 The platform realizes end-to-end automatic test management , One stop graphic display of information

The platform supports use case management 、 Script development and debugging 、 Task distributed scheduling execution 、 The test report presents the whole process

chart 7 Platform test management

chart 8 Test log and report

3、 Data and keyword driven automated testing , Flexible response to system changes under test

The platform overcomes the disadvantage of high coupling of recording and playback mode scripts in traditional automation framework , High robustness 、 High reusability and good maintainability :

  • Support data-driven mode , Separation of test data and scripts , Test data changes do not need to modify the script , Improves the reusability of automated test scripts .
  • Realize unified management of interface elements , Interface elements are separated from test scripts , If the application interface changes, just modify the invalid interface elements , There is no need to modify the script a lot , Improved script maintainability .
  • Business process testing is controlled based on keyword scripts that can be flexibly combined , The function expansion of the test framework can be realized by adding keywords .
  • The script structure adopts the idea of hierarchical design , Divide automated test scripts into use case layers 、 Process level 、 Page element layer and variable collection layer , Easy to achieve high cohesion 、 Low coupling test script design .

chart 9 Layered automated testing

05

The implementation effect of the platform

1、 Improve the quality of test case design and the coverage of business scenarios

Since the implementation of Dongguan securities automation test project , The granularity and coverage of use cases have been greatly improved , mobile phone APP transaction 、 Interface 、Web( Net Hall / Shopping Mall / There are financial loans )、 Core counter 、 The test cases of online transactions reach 1645、153、76、569 and 1168 individual , The average growth of use case size is nearly 8 times , It basically covers all transaction businesses . The average automation rate is 65% above , It has greatly improved the quality confidence of the product R & D team . 2、 Improve the execution efficiency of test cases , Speed up the production of products

automated testing It improves the efficiency and accuracy of test case execution , The failure rate of production application system is reduced . In addition, continuous integration is involved as soon as possible , Reduces the possibility of delayed release of versions . Take Dongguan securities mobile phone APP Take transaction automation test as an example , The iteration cycle of previous versions was 2-3 Months , Reduced to... After automated testing 1 Months ; The previous round 15 After the manual test of man day is changed to automatic execution, less than 2 People are naturally . Calculated as an average of one iteration per month , It can save nearly 150 Human day testing resources . Such as docking independent test counters ( Support 7*24 perform ) And add multiple devices to execute in parallel , The efficiency of automated testing can also be greatly improved ; The project has been put into operation for nearly 20 Round of version iteration testing , Find a flaw 17 individual .

06

summary

Dongguan securities is based on open source RF Frame from 0 To 1 Establish a general automatic test system , And on the cell phone APP、 Core counter 、 Online trading 、 Interface 、 Shopping Mall 、 Landing in Internet hall and other projects , At the same time combined with Jenkins Realize continuous integration and distributed construction of automated testing , It effectively supports the agile and rapid iterative process .

Limited to space , This article does not focus on APP、Web、 Desktop application 、 Interface and other automatic test development methods are discussed in detail , It is This paper provides an idea of establishing a general automatic test continuous integration management platform , Hope to have some inspiration and reference for other securities companies .

原网站

版权声明
本文为[Test development technology]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/11/20211104174520743D.html