19
Building the Test Automation Framework Building the Test Automation Framework Module 2 : A Practical Introduction to Jenkins for Testers

Building the Test Automation Framework - Jenkins for Testers

Embed Size (px)

Citation preview

Page 1: Building the Test Automation Framework - Jenkins for Testers

Building the Test Automation Framework

Building theTest Automation Framework

Module 2 : A Practical Introduction to Jenkins for Testers

Page 2: Building the Test Automation Framework - Jenkins for Testers

The Test AutomationFramework

Page 3: Building the Test Automation Framework - Jenkins for Testers

Building the AWS Environment

Page 4: Building the Test Automation Framework - Jenkins for Testers

1. Installing Jenkins

3. Configuring Jenkins

4. Deploying the AUT

Setting Up and Running with Jenkins

2. Install Jenkins Plugins

Page 5: Building the Test Automation Framework - Jenkins for Testers

Why Use Jenkins?

Jenkins is a brilliant process automation tool for testers

Page 6: Building the Test Automation Framework - Jenkins for Testers

Prerequisites

1. Windows machine with RDP running

3. Private Key for SSH connection (Windows to Ubuntu)

4. Make sure your Linux ubuntu machine is NOT running

2. AWS Access Keys (so that Jenkins can connect to AWS)

Page 7: Building the Test Automation Framework - Jenkins for Testers

Module Parts Part 1: Installing Jenkins

Part 2: The Main Jenkins Configuration Areas

Part 3: Jenkins' Plugins

Part 4: Installing Plugins

Part 5: Configuring Jenkins

Part 6: Configuring Jenkins - Amazon AWS Integration

Part 7: Configuring Jenkins - Starting the Linux Amazon Instance Slave

Part 8: Configuring Jenkins - Instance Initialisation Script

Part 9: A Few Points about our Jenkins Slave Machine

Part 10: Setting Jenkins up to install the AUT

Part 11: Jenkins Post Build Actions and Smoke Tests

Part 12: Starting Subsequent Jenkins Builds

Page 8: Building the Test Automation Framework - Jenkins for Testers

PART 1:Installing Jenkins

https://jenkins-ci.org/

“It’s so simple it’s almost disappointing!”

Download

Extract and install

Then go to: http://localhost:8080/

Page 9: Building the Test Automation Framework - Jenkins for Testers

PART 2:The Main Jenkins

Configuration AreasConfigure Jenkins and connection to Amazon AWS

Configure Nodes we want to create (e.g. Ubuntu instance)

Add plugins to enable different types of tasks

Create a new job or project

Monitor status of our Jobs and see the results

Start a job manually

See what Jenkins is currently up to

Page 10: Building the Test Automation Framework - Jenkins for Testers

PART 3:Jenkins PluginsThere's a plug in module to help you automate just about any task

you need to automate. We’ll be using:

Amazon EC2 Plugin: Used to run up an Amazon EC2

instance automatically

SSH Slaves Plugin: Used with our SSH private key to

connect to the Amazon EC2 client machine.

GitHub Plugin: Used to connect to GitHub and download the

source for our application under test automatically

Post Build Tasks Plugin: Used to check the logs for

successful install messages and run a few checks to make

sure the AUT is running correctly.

Page 11: Building the Test Automation Framework - Jenkins for Testers

PART 4:Installing PluginsTo install Plugins you need to:

Page 12: Building the Test Automation Framework - Jenkins for Testers

PART 5:Configuring Jenkins1. Configure Integration to AWS

2. Configure to start our Linux Ubuntu machine on demand

3. Configure initialisation script for the Linux Ubuntu instances

4. Configure the 'job' that kicks off the build, installs our AUT and runs some tests

Page 13: Building the Test Automation Framework - Jenkins for Testers

PART 6:Configuring Jenkins -

Amazon AWS Integration1. Configure Integration to AWS

Page 14: Building the Test Automation Framework - Jenkins for Testers

PART 7:Configuring Jenkins -

Starting the Linux Amazon Instance Slave

2. Configure to start our Linux

Ubuntu machine on demand

Page 15: Building the Test Automation Framework - Jenkins for Testers

PART 8:Configuring Jenkins - Instance Initialisation

Script

3. Configure initialisation script for

the Linux Ubuntu instances

Page 16: Building the Test Automation Framework - Jenkins for Testers

PART 9:A Few Points about our Jenkins Slave

MachineStatus of the node/slave

Terminate the Amazon EC2 instance for this slave.

View and modify some of the configuration parameters for this slave

Details about builds we've run on this slave.

Stats on how hard this machine is having to work.

Run Groovy script on the slave machine from our Jenkins master machine

Details about the running up and install activities that took place when we created this instance

Full list of system properties

Disconnect Jenkins from the slave but leave the instance running still (you can reconnect later)

Page 17: Building the Test Automation Framework - Jenkins for Testers

PART 10:Setting Jenkins up to

install the AUT

4. Configure the 'job' that kicks off

the build and install of our AUT

Note: In practice, when you're testing your own applications, you'll need to replace the Rocket Chat build and install scripts with your own scripts.

Page 18: Building the Test Automation Framework - Jenkins for Testers

PART 11:Jenkins Post Build Actions and Smoke

Tests

Configure Jenkins to run a few checks and tests just to confirm that things completed without any issues.

Page 19: Building the Test Automation Framework - Jenkins for Testers

PART 12:Starting Subsequent

Jenkins Builds

When you kick off a new build:

a. If this Node has been shutdown: We’ll start from the beginning and create a new EC2 instance*

b. If this Node hasn’t been shut down:The slave is still running, so Jenkins just needs to start a new build and install using the same machine

*Note: if the node has been shutdown, and then a new node run up for a subsequent build, then the new node with have a NEW IP and HOSTNAME.

Idle termination time: 30

There is a Node configuration setting called Idle Termination time. If the EC2 Jenkins node (e.g. your Linux Ubuntu) is inactive for this period of time Jenkins will Terminate it automatically