Panther ODM
Exercises
Documentation Builds

Panther Test Kata Exercises

Welcome to the Panther Test Kata exercise - this page will give you a breakdown of tasks for throughout the workshop.

Setting up your machine

First off you will need a laptop, and a power cable (we'll be working on it most of the day) which has either Firefox or Chrome as a browser installed, ideally both!

The exercises requires a machine which can run Java - don't worry too much if you're relatively new to Java, the exercises are designed to be useable with a minimum understanding of the language (although you'll get more out of it the more you understand).

To help, you'll also be working in groups.

Still, it's important to arrive with a working laptop that's ready to go!

Here are software items I need you to pre-install,

  • Oracle Java Development Kit (JDK) relevant for your machine. This will allow Java to run on your machine. This is required for your Integrated Development Environment to work on. Currently can be found here.
  • IntelliJ IDEA Community Edition (IDE). This is where we'll be editing code. Currently can be found here.
  • GitHub Desktop. This will make pulling down the code examples so much easier. I suggest creating a GitHub account (it's free).

It's also worth cloning the following repositories to your machine,

I recommend a Windows laptop, but the code work on Linux, and should also worin on a macOS (however I've not been able to check the macOS).

If possible, I recommend pre-reading through the following introduction to the scenario you face together with this set of requirements.

You will also need to download the following repositories from GitHub, and open them in IntelliJ Community Edition.

When you open them in IntelliJ, you need to select to auto import to bring through any dependencies. You might also need to set an appropriate version of Java to run on - this is the Project SDK which can be accessed under Project Structure,

Exercise 1 - Testing fuel data load

We start working with pantheraircraftodminitial from GitHub.

This is the start version of the code we're working on.

We are going to focus on the tests in src/test/java/testsheepnz/panther/odm/calculator/test/FuelRateDataTests.java

These tests are designed to test the how the class FuelRateData copes with lines of data given.

Currently there is a postive and negative test created, but the test manager doesn't like them. Can you do better?

Exercise 2 - Testing equipment load

We start working again with pantheraircraftodminitial from GitHub.

We are going to look at the other test class which can be found in src/test/java/testsheepnz/panther/odm/calculator/test/AircraftManagementTests.java

  • What are your thoughts on these tests?
  • What are they trying to test?
  • Do any of the scenarios look familiar?

During this exercise you'll create a series of tests to check for scenarios with equipment loads. Think what makes a good test, and what will make for useful feedback.

Report any issues you find with the software. If you're feeling really confident, you might want to have a go at fixing them.

Exercise 3 - Fuel Rate Data

We start working again with pantheraircraftodminitial from GitHub.

There are a number of tables of fuel rate data in the ODM requirements.

On paper - you need to design a number of scenarios to test this data. Just follow the maths! You might find the following aid helpful.

Later on in this exercise you will be asked to check out pantheraircraftodmmodified from GitHub.

Exercise 4 - UI Tests With Selenium

We will now be working with pantheraircraftseleniumbasic from GitHub.

A working version of the software has been built with a front-end. It can be found here.

One of your developers has build a basic test framework for you to build tests from.

Build and run a few basic tests. Work with the initial tests in /src/test/java/testsheepnz/panther/aircraft/test/EquipmentFormTest.java

Exercise 5 - What went wrong?

We will now be working with pantheraircraftseleniumautomation from GitHub.

This repository contains a lot more defined tests.

A number of builds can be found here. Builds 1-5 have been rejected, but no-one knows the exact reason why.

You can get this suite to run on the builds by going into the file test.properties and editing the command website_under_test to point to the appropriate html link.

You can read through any errors, but also check out logs in /src/main/resources/screenshots. You can also check out manually if you need to.

Catalog the problems you find, and bring to the attention of your line manager.

Exercise 6 - Refuel fun

This item is extension material - to be honest we could run another full day on this code base! Different people are at different stages in their automation journey, so some might want to tackle this on the day or else look at later.

New functionality has been added for refueling on this page.

You need to create a new page definition class for this under https://github.com/TestSheepNZ/pantheraircraftseleniumautomation/tree/master/src/main/java/testsheepnz/panther/page

It might help to look at items like the ClimbPage.java or DivePage.java which have similar definitions.

You need to think not just about the elements you need to define but also any methods for what you'll want to do with the elements.

Finally you will want to define a test class under /src/test/java/testsheepnz/panther/aircraft/test/ which includes some tests.

Again, you might want to look at ClimbTest.java and DiveTest.java for starting ideas.

As in the previous exercise, before running you need to go into the file test.properties and edit the command website_under_test to point to the appropriate html link.

Exercise 7 - Redefine using XPath (BONUS)

This is an item for you to try after the workshop - support can be provided remotely.

Currently if you look at the classes under src/main/testsheepnz.panther/page all the @FindBy instances are find by ID,

@FindBy(id = INITIAL_FUEL_FIELD)
private WebElement fuelField;

Change the code, starting with EquipmentPage.java to work from find by XPath. Make sure you keep running your test to make sure what you're changing still works!

Harnessing the power of Google, look to see how you find XPath elements for a page, and what advantages there are against find by ID.

Exercise 8 - Browser support (BONUS)

This is an item for you to try after the workshop - support can be provided remotely.

You are going to attempt to support Internet Explorer (IE) as a supported browser going forward. This obviously only works for Windows machine, if you have another machine, just choose another browser for which you can find driver support.

1) Download driver

Download the driver for Internet Explorer and place in the resources/drivers.windows folders.

2) Handle case for IE browser

Browser support is provided by setting the value browser in test.properties and how this parameter is handled in TestProperties.java including the enum BrowserType and method setBrowserType.

3) Open WebDriver for IE instance

If you look into the method launchDriver for class SeleniumInstance, you will find a set of if statements covering opening the WebDriver instance for different browsers.

You need to create a new instance to handle IE browsers, including handling the name of the driver and where it is located.

4) Troubleshoot

IE is one of the trickiest browsers to work with and doesn't work as 'out of the box' as other browsers. You will need to investigate this - but you'll need to set some InternetExplorerOptions before setting driver.

You can find a lot of help about other drivers on the Selenium downloads page here.