Automated testing of CS UI using Selenium and Python



Similar documents
INSTALLATION GUIDE Datapolis Process System v

About the VM-Series Firewall

About the VM-Series Firewall

Background Deployment 3.1 (1003) Installation and Administration Guide

Virtzone Cloud Control User Guide

IT Service Desk Manual Ver Document Prepared By: IT Department. Page 1 of 12

SOFTWARE TESTING TRAINING COURSES CONTENTS

SysPatrol - Server Security Monitor

Guide to the LBaaS plugin ver for Fuel

Using SMI-S for Management Automation of StarWind iscsi SAN V8 beta in System Center Virtual Machine Manager 2012 R2

Continuous Integration

603: Enhancing mobile device experience with NetScaler MobileStream Hands-on Lab Exercise Guide

Test Automation Integration with Test Management QAComplete

Bitrix Site Manager ASP.NET. Installation Guide

ICONICS Using the Azure Cloud Connector

NetIQ Aegis Adapter for VMware vcenter Server

Important Notes for WinConnect Server VS Software Installation:

ServerPronto Cloud User Guide

Secure File Transfer Guest User Guide Updated: 5/8/14

Citrix Lab Manager 3.6 SP 2 Quick Start Guide

Oracle Managed File Getting Started - Transfer FTP Server to File Table of Contents

3] Alert Configuration for User Login Failure and Incorrect Guest Details [HIA]

How To Install An Org Vm Server On A Virtual Box On An Ubuntu (Orchestra) On A Windows Box On A Microsoft Zephyrus (Orroster) 2.5 (Orner)

Configure Web Conference Parameters Through The Web Conference Administration User Interface.

Sonian Getting Started Guide October 2008

vsphere Replication for Disaster Recovery to Cloud

Installation Guide Avi Networks Cloud Application Delivery Platform Integration with Cisco Application Policy Infrastructure

Automation using Selenium

NetWrix File Server Change Reporter. Quick Start Guide

App Orchestration 2.0

An Introduction To The Web File Manager

Application Discovery Manager User s Guide vcenter Application Discovery Manager 6.2.1

QEx Whitepaper. Automation Testing Pillar: Selenium. Naveen Saxena. AuthOr:

Ticket Center Quick Start

Automating Testing and Configuration Data Migration in OTM/GTM Projects using Open Source Tools By Rakesh Raveendran Oracle Consulting

Certified Selenium Professional VS-1083

WEB2CS INSTALLATION GUIDE

Pharos Control User Guide

MS SQL Server Database Management

Data Center Connector for vsphere 3.0.0

IBM Campaign and IBM Silverpop Engage Version 1 Release 2 August 31, Integration Guide IBM

QaTraq Pro Scripts Manual - Professional Test Scripts Module for QaTraq. QaTraq Pro Scripts. Professional Test Scripts Module for QaTraq

BackupAgent Management Console User Manual

SERVER CLOUD DISASTER RECOVERY. User Manual

Introduction to Google Docs

IIS, FTP Server and Windows

Sentral servers provide a wide range of services to school networks.

GRAVITYZONE HERE. Deployment Guide VLE Environment

How to add your Weebly website to a TotalCloud hosted Server

Richmond Systems. Self Service Portal

Deployment Guide: Unidesk and Hyper- V

Building A Very Simple Web Site

SELF SERVICE RESET PASSWORD MANAGEMENT WEB INTERFACE GUIDE

IBM Campaign Version-independent Integration with IBM Engage Version 1 Release 3 April 8, Integration Guide IBM

NOC PS manual. Copyright Maxnet All rights reserved. Page 1/45 NOC-PS Manuel EN version 1.3

Installing and Using the vnios Trial

Table of Contents INTRODUCTION... 2 HOME PAGE Announcements... 7 Personalize & Change Password... 8 Reminders... 9 SERVICE CATALOG...

NETWRIX USER ACTIVITY VIDEO REPORTER

HowTo. Planning table online

AJ Matrix V5. Installation Manual

Data Center Connector for OpenStack

How to Configure a High Availability Cluster in Azure via Web Portal and ASM

The SSL device also supports the 64-bit Internet Explorer with new ActiveX loaders for Assessment, Abolishment, and the Access Client.

WinSCP for Windows: Using SFTP to upload files to a server

HP A-IMC Firewall Manager

DiskPulse DISK CHANGE MONITOR

User Manual. User Manual for Version

Secure Messaging Server Console... 2

Moving the TRITON Reporting Databases

Quick Start Guide. Hosting Your Domain

PaperCut Payment Gateway Module - RBS WorldPay Quick Start Guide

HP IMC Firewall Manager

The goal with this tutorial is to show how to implement and use the Selenium testing framework.

NETWRIX EVENT LOG MANAGER

Job Board Integration with eempact

Guide to Using the AK240 MQS Streaming Server. (Macintosh OS X Lion only)

Site Monitor. Version 5.3

Connect for Dragon Medical 360 Network Edition. Administrator Guide

metaengine DataConnect For SharePoint 2007 Configuration Guide

In order to upload a VM you need to have a VM image in one of the following formats:

Using Internet or Windows Explorer to Upload Your Site

Using Microsoft Expression Web to Upload Your Site

IPS Attack Protection Configuration Example

HP Intelligent Management Center v7.1 Virtualization Monitor Administrator Guide

Acronis Backup Advanced Version 11.5 Update 6

Licensing Guide BES12. Version 12.1

Table of Contents INTRODUCTION... 2 HOME Dashboard... 5 Reminders... 8 Announcements Preferences Recent Items REQUESTS...

Getting Started with PRTG Network Monitor 2012 Paessler AG

DEPLOYMENT GUIDE Version 2.1. Deploying F5 with Microsoft SharePoint 2010

Introduction. Installation of SE S AM E BARCODE virtual machine distribution. (Windows / Mac / Linux)

ThirtySix Software WRITE ONCE. APPROVE ONCE. USE EVERYWHERE. SMARTDOCS SHAREPOINT CONFIGURATION GUIDE THIRTYSIX SOFTWARE

BarTender Web Print Server

AWS Service Catalog. User Guide

CRSP MOVEit Cloud Getting Started Guide

vsphere Replication for Disaster Recovery to Cloud

QUANTIFY INSTALLATION GUIDE

Provisioning ShareFile on Microsoft Azure Storage

Google Analytics Playbook. Version 0.92

Chef Integration. Chef Integration. with IDERA s Uptime Cloud Monitor. Simple, Smart, Seamless May 10, 2013 IDERA

Transcription:

Automated testing of CS UI using Selenium and Python Parth Jagirdar Software Test Engineer Datacenter & Cloud Division Citrix Systems Powering Mobile Workstyles and Cloud Services. Introduction You would need very basic understanding of Python (or coding in general), Selenium and HTML/XML (and similar technologies heavily used in web pages) to get started. 1) What is selenium? http://seleniumhq.org Selenium is a very useful tool and can be used to create scripts to reproduce specific bugs through UI or can also be used for regression. Selenium Webdriver which resides within the client browser; Can record user actions on UI; including data entry. These actions can later be played back N number of times to mimic user actions on UI. With logical organization of such recorded scripts we can create and execute full test plans.

2) Selenium has language bindings with Python. http://selenium-python.readthedocs.org/en/latest/ 3) General HTML / XML / Python / Scripting http://www.w3schools.com/ Project outline and framework Our primary goal is to exercise as many UI elements as possible which are interactive. We intend Selenium Automation to run as and when required with minimal supervision / intervention from an engineer. We can break UI into a Tree like structure and think of our goal as to traverse as many leaf nodes as possible with least inter-script dependency as possible. Following is a brief example with a few nodes.

We can see that two of the farthest leaves have one way dependency. PF -> Instance: We need a VM Instance present, if we were to configure and verify a PF rule. So we need to Organize test actions into groups such that it addresses serialization and dependency requirements. For Example: A simple, hypothetical test case: log into FTP server 10.1.1.0 and download CentOS ISO from there. (Web-based)

Now we break this test case into multiple actions: 1) Open Browser 2) Type in Server IP/URL 3) Wait till page is loaded 4) Locate CentOS ISO (Within webpage contents) 5) Click on link to download the ISO 6) Verify data integrity by running md5 and comparing it with the one on webpage. Now let us compile a dependency list; assume that This server is running on one of the VM s managed by CS. Some of the easy ones we can think of right away are: 1) Need a VM for server (Of course) 2) To host VM we need a infrastructure 3) To create a VM we will also need a template or ISO 4) We need to host a server on this VM 5) We need to upload our CentOS ISO which we will download in our test case 6) Our Server (VM) should be reachable from other networks 7) So we create Port Forwarding and Firewall rules. 8) And so on and on It becomes clear that to run 1 test case we will have to ensure that at least 10 test cases have ran successfully; before we begin execution of our original test case. We can follow a top down approach (the tree above) and start with some golden minimum configuration as part of test initialization. And as we go on, we serialize our test cases such that majority of the dependencies are resolved. Now let us put all that we have discussed so far into following: 1) Find bare minimum pre requisites for these test cases. (Few of them are) a. Zone configuration b. Adding Template c. Adding VM s And so on We will now arrange these into an Initialization script. 2) Initialization script will grow as Automation efforts progresses. Contributors must identify and add these dependencies as needed.

3) Every script should have dependency only on Initialization script and Global Locators file (Discussed in next section). 4) Scripts will be serialized into main script to resolve serialization dependencies. So our project organization will look like this. (Consider Global Locators file as one being parallel to Init.py) Main.py :: We will create test suits here and Serialize Test Cases. Now pass this test suit to Test Runner, which will begin the test execution.

Init.py :: This will be the first one to be executed in Main.py. Contains minimum golden configuration on which rest of the test cases depend upon. Init.py also contains configuration verification. Modules :: These are nothing but folders to organize Test cases in some logical order. We will use each menu item on CS UI Dashboard as a module. *.py :: These are individual files. They must contain test steps and verification both. It is logical to have an organization such that; Create_Instance > Edit > Restart > Delete. This way at the end of the script execution script cleans for it self. ** We are also considering organizing subsequent test runs into separate Accounts. Thus we can tear down anything left over from the Test by deleting that account. Challenges and Mitigations 1) Element Locators UI automation heavily depends on location of interactive elements on UI screen. And just as there are number of different ways to reach your office from your home; we have multiple different ways to identify/locate an element on UI screen. We have following ways to identify an element on the screen. (Refer to http://mestachs.wordpress.com/2012/08/13/selenium-best-practices/) In order of their preference. id > name > css > xpath Unfortunately we do not have ID s or Name s for most of the elements within CS UI. So we will be relying on xpath for now with provisioning for future ID/Name inclusion into the code.

So to make scripts more robust and portable across code versions with UI changes We will have a Global Locator file. And every script must have dependency on this file. This file will contain: Element Name Locator Variable Name Add Instance /html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div[2]/span Instance_add_Instance Add Guest Network /html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div[3]/span Network_add_Guest_network Variable names are unique. Variable name succeeds its module name They should more or less reflect exact actions they represent on UI. Only variable must be used in scripts and not full xpath locators. This way we can change locators at one single location when UI code changes. This will also help adding ID s or names as and when they are available. 2) Dynamically Generated elements Some elements on UI will be generated dynamically while testing. The challenge is to identify such elements and then find a method to access them. Now as these elements are generated dynamically at run time we do not have their xpath and thus we need to find a way to identify this dynamically generated element by means other than direct xpath. Say while creating port forwarding rule we acquired a new IP. This IP was generated dynamically hence we do not have its xpath locator. Careful observation shows that this newly generated IP will be the first one in the table. However if we navigate away and back to the page then this IP may not be the first one in the table. Table may get sorted upon each page load. Here is how we can deal with it.

1) Navigate to the page and click acquire IP 2) Wait for (worst case scenario) for IP to get acquired and displayed. Now store this IP into a variable. 3) Re-Navigate to this page and using locator of the table (Not the element; we will use table now) search through IP s to find the one we just acquired. 4) Once found Click for more actions on that IP. Following snippet will clarify:: Server IP will host the acquired IP in our example. Linkclass will point to the Table s First Column Comparison takes place For each link in First Column without acquired IP. If Match found click this link. (Else Error will be reported). Server_Ip = None Server_Ip = driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div[2]/div[3]/div[2]/div/div[2]/table/tbody/tr/td").text linkclass = None linkclass = driver.find_elements_by_xpath('/html/body/div/div/div[2]/div[2]/div[2]/div[3]/div[2]/div/div[2]/table/tbody/tr/td/span') for link in linkclass: if link.text == Server_Ip: print "found link to IP %s" % Server_Ip link.click() There are numerous tables in CS UI and this snippet can be reused. That s all for now J Current Project Plans I will be working on BVT (Build Verification Tests) Test plan found @ http://wiki.cloudstack.org/display/qa/manual+bvt It has about 90 individual test cases. We will start with Xenserver, 1 Host and 1 Advance Zone. This will cover about 70% of BVT Test cases. Thanks you for your time. Please pass on your valuable suggestions.