When the project iteration cycle is limited, the upgrade test with complex process complexity can no longer rely on manual method, and it must be solved by means of automated testing tools and methods. This article will take the Transwarp Data Hub (TDH) Automated upgrade test architecture as an example to analyze how different technologies should be selected and systematically integrated to implement automated testing and deployment upgrades reasonably.
As the release of the product increases, a large number of old versions of the existing customer site are to be upgraded, and each time a new release is released to the customer, testers must ensure that the new release is perfectly capable of supporting the old version of the upgrade. The new features or components introduced in each version of the product also need to be determined not to conflict with the existing functionality of the old version of the product. This reflects the extreme necessity of the upgrade test. Typically, when TDH is tested for version upgrades, our developers need to take into account not only the front-end interface but also the execution of back-end upgrades. And in order to ensure the completeness of the test dimension and facilitate analysis, the upgrade test framework must ensure the following:
Automatic upgrade Test
Simulate the behavior of a user
Stability Guarantee
Detailed Test Report
View the upgrade process at any time
Considering these requirements, we decided to build an automated upgrade test environment with a hybrid combination of Docker + Jenkins and Selenium + VNC Server + guacamole + python.
First, please read the following technical details, a simple understanding of the five related tools and technology.
Technical detailed
Docker
Docker is widely used as an open source container engine, it can support rapid deployment and porting of programs, and has good environmental isolation. In the example of this article, we will TDH upgrade the required OS Runtime environment--remote Webdriver and VNC Server, done in a Docker mirror, as Testbench. Before performing the TDH upgrade test, you can run the TDH program only by deploying it to the corresponding Testbench container. The Remote Desktop services provided by VNC Server allow developers to discover problems in the debug test in Docker.
The following is the contents of the Dockerfile file that makes the corresponding portion of the mirror:
ROM Centos7_webtest:latest Maintainer Transwarp #install JDK RUN RPM-IVH jdk-7u71-linux-x64.rpm #change Yum Repo ADD change_yum.sh/root/ RUN sh/root/change_yum.sh && rm-f/root/change_yum.sh #add html ADD htmltestrunner.py/usr/lib/python2.7/site-packages/ ... |
Jenkins
Jenkins is an ongoing build tool that facilitates development and testers to monitor the status of daily upgrade tests by making TDH upgrade testing a number of parameterized Jenkins Jobs through the process phase and test cases, and launching TDH upgrade tests through Jenkins scheduled tasks.
Selenium
Selenium is an open source test lightweight framework for Web applications with Cross-platform benefits and support from a number of mainstream programming languages, including Java and Python. Selenium is a TDH front-end operation of the important tool, we through the selenium implementation of the start and stop service, add configuration, install LDAP, Gardian a series of operations.
The following is a code example for the selenium login Transwarp-manager.
From selenium import Webdriver From selenium.webdriver.common.desired_capabilities import desiredcapabilities Driver =webdriver. Remote (command_executor= ' Http://remoteIP:port/wd/hub ', desired_capabilities=desiredcapabilities.chrome) Driver.set_page_load_timeout (30) Driver.implicitly_wait (30) Driver.maximize_window () Driver.get ("transwarp-managert-ip:8180") DRIVER.FIND_ELEMENT_BY_ID ("userid"). Clear (). Send_keys (USER) driver.find_element_by_id ("passwd"). Clear (). Send_keys (PASSWORD) driver.find_element_by_id ("Sign-in-button"). Click () |
VNC Server + guacamole
VNC Server is a service that is opened on a server in order to meet the needs of distributed users to share resources. TDH Select guacamole remote connection to access VNC Server. Guacamole is a VNC Web viewer based on HTML 5 and JavaScript. Connecting VNC server via guacamole Web page makes it easy to observe TDH upgrade status remotely.
Python
Pycrypto/paramiko Module
Pycryto and Paramiko are two important modules in Python for Remote Authentication login servers: Pycrypto for Security authentication, and paramik for landing remote servers to execute commands. During the TDH version upgrade, the two modules are used remotely to the corresponding cluster server to perform the corresponding upgrade process.
HTML
After the upgrade is complete, you need to give detailed test reports, such as the execution time of each phase, start time, success and other key information. Since Python's own or third-party-developed module Generation test reports are basically UT-level, it is not possible to use ready-made modules and develop them yourself. We refer to the corresponding module Htmltestrunner in Python for two development of the generated test reports.
Technical framework
Depending on the characteristics of the tools, the TDH Automated upgrade framework arranges different processing tasks for each tool: Docker for deployment and the environment; The overall test work is performed by Jenkins; Selenium responsible for front-end interface testing ; guacamole connect VNC as a Remote Desktop client