20
Using Selenium & Cucumber to Test an HIS Andy Tinkham Selenium Conference, San Francisco April 2011

Using Selenium and Cucumber to test a Healthcare Information System

Embed Size (px)

DESCRIPTION

My talk about the architecture we're building out at Healthland for test automation, using Selenium-Webdriver, Cucumber, Page Objects, and a bunch of Ruby code. Given March 28, 2011 at the Ruby Users of MN in Minneapolis and April 6, 2011 at Se Conf in San Francisco.

Citation preview

Page 1: Using Selenium and Cucumber to test a Healthcare Information System

Using Selenium & Cucumber toTest an HIS

Andy Tinkham

Selenium Conference, San Francisco

April 2011

Page 2: Using Selenium and Cucumber to test a Healthcare Information System

Background Information

Healthland• Web-based HIS (Clinicals, Financials)• Geared to rural hospitals (<50 beds)• .NET-based backend• UI is native HTML/CSS/JavaScript in browser (no Flash or non-

standard elements)

Me• 16 years of testing experience (almost all automated)• Started using Selenium in 2007

Page 3: Using Selenium and Cucumber to test a Healthcare Information System

Goals of Current Automation Effort

Run on all our supported platforms & browsers

Rapid deployment in new environment

Keep up with developers

Avoid vendor & script lock-in

Maintain test clarity

Page 4: Using Selenium and Cucumber to test a Healthcare Information System

Platform & Browser Support

Use Selenium 2

Develop tests on multiple platforms & browsers from start

Page 5: Using Selenium and Cucumber to test a Healthcare Information System

Rapid deployment

Minimize locations of change from version to version

No hard-coded data in scripts

Robust locators

Page 6: Using Selenium and Cucumber to test a Healthcare Information System

Keep up with developers

Plan test scenarios as part of feature planning

Minimize change locations

Business-focused tests & code

Use Cucumber so that more people can create tests

Page 7: Using Selenium and Cucumber to test a Healthcare Information System

Avoid Vendor lock-in

Open source testing tools

Encapsulate tool interface to facilitate swapping in other tools as needed

Page 8: Using Selenium and Cucumber to test a Healthcare Information System

Avoid Script lock-in

Use random data

Future behavior manager

Future long-scale random test driver

Page 9: Using Selenium and Cucumber to test a Healthcare Information System

Maintain clarity

Cucumber tests defined in plain text

Tests specify only relevant details

Test specifies verifications that are relevant to the point of the test

Future potential tie-in to test case manager

Page 10: Using Selenium and Cucumber to test a Healthcare Information System

Architecture

Page 11: Using Selenium and Cucumber to test a Healthcare Information System

Test Cases

Cucumber features• Created jointly with QA, Dev, BAs, and Product Managers• Created as part of initial story creation• Just enough source code to translate plain text into calls into

Conceptual Layer• Specifies only required tasks and data

Random test driver

Page 12: Using Selenium and Cucumber to test a Healthcare Information System

Example Cucumber test

Feature: Allergy Notification

In order to avoid causing an allergic reaction in a patient while providing treatment

As a patient care provider

I want to be notified of a patient's allergic status

Scenario: No allergy on file

Given I have a patient with no allergy information

When I visit a page with the allergy warning

Then I should see that the patient has no allergy information on file

Page 13: Using Selenium and Cucumber to test a Healthcare Information System

Conceptual Layer

Provides methods that correspond to actual user tasks and goals

Ignores actual implementation

Gets additional required data not provided by test case

Page 14: Using Selenium and Cucumber to test a Healthcare Information System

Implementation-Focused Layer

Contains all interactions with actual web pages

Contains all calls to tool interface

Uses Page Objects and Control Objects

Uses ruby modules to handle repeated components bigger than a control

Page 15: Using Selenium and Cucumber to test a Healthcare Information System

Page Objects

Each page of the application is encapsulated by a single class

The class provides public methods that correspond to the things a user can do on that page

No details of page implementation available outside of class

Page 16: Using Selenium and Cucumber to test a Healthcare Information System

Control Objects

Each control type is wrapped in its own class

Allows for verification at control level

Removes need to remember how to interact with controls

Page 17: Using Selenium and Cucumber to test a Healthcare Information System

Support Layer

Contains code that is not specific to any user action

Data classes (Patient, Allergy)

Builders (create new patients, get existing patients)

Page 18: Using Selenium and Cucumber to test a Healthcare Information System

Challenges so far

Ramp up of staff unfamiliar with tools

Cross-platform database access

Using non-ASCII characters in test data

Firefox/Selenium/FortiClient interaction

Page 19: Using Selenium and Cucumber to test a Healthcare Information System

Future Directions

Behavior manager

Adding basic performance tests

Basic fuzz testing

Automated usability testing• Tab order• Keyboard navigation• Text rendering

On-site deployment tests

Random test runner/High volume automation

Parallel execution

Page 20: Using Selenium and Cucumber to test a Healthcare Information System

Questions?Andy Tinkham

[email protected]

andytinkham in IRC #selenium and #ruby.mn channel