An Introduction to text-based test automation and the TextTest tool



Similar documents
XP with Acceptance-Test Driven Development : A rewrite project for a resource optimization system

Live Specifications: From Requirements to Automated Tests and Back

Continuous Integration

the first thing that comes to mind when you think about unit testing? If you re a Java developer, it s probably JUnit, since the

Certified Selenium Professional VS-1083

Agile Development and Testing Practices highlighted by the case studies as being particularly valuable from a software quality perspective

Elements of robot assisted test systems

QA or the Highway 2016 Presentation Notes

Introduction to Automated Testing

Automated Software Testing by: Eli Janssen

Getting started with API testing

Lessons Learned in Test Automation

Break It Before You Buy It!

Graphical Environment Tool for Development versus Non Graphical Development Tool

Delivery. Continuous. Jez Humble and David Farley. AAddison-Wesley. Upper Saddle River, NJ Boston Indianapolis San Francisco

Fail early, fail often, succeed sooner!

Software Configuration Management Best Practices for Continuous Integration

Secrets to Automation Success. A White Paper by Paul Merrill, Consultant and Trainer at Beaufort Fairmont, LLC

Let s start with a couple of definitions! 39% great 39% could have been better

Test-Driven Development. SC12 Educator s Session November 13, 2012

Chapter 8 Software Testing

JUnit. Introduction to Unit Testing in Java

Lessons Learned in Software Testing

Testing, Debugging, and Verification

Editors Comparison (NetBeans IDE, Eclipse, IntelliJ IDEA)

Testing Rails. by Josh Steiner. thoughtbot

Building, testing and deploying mobile apps with Jenkins & friends

Adopting Agile Testing

Agile Testing and Extreme Programming

Why Test Automation Fails

Advanced Test-Driven Development

Co-Presented by Mr. Bill Rinko-Gay and Dr. Constantin Stanca 9/28/2011

Continuous Integration (CI) for Mobile Applications

Unit Testing with zunit

Agile Testing Overview

Top Ten Reasons to Transition Your IT Sandbox Environments to the Cloud

TesT AuTomATion Best Practices

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References

ServiceNow Certified Application Developer. Examination Specifications

ICAPRG529A Apply testing techniques for software development

Meta-Framework: A New Pattern for Test Automation

The ROI of Test Automation

If Your HR Process is Broken, No Technology Solution will Fix It

Top ten reasons to transition your IT lab environments to the cloud

Continuous Delivery Workshop

SPECIFICATION BY EXAMPLE. Gojko Adzic. How successful teams deliver the right software. MANNING Shelter Island

MSCA Introduction to Statistical Concepts

9 Research Questions Resolved

KS3 Computing Group 1 Programme of Study hours per week

Guideline for stresstest Page 1 of 6. Stress test

FREQUENTLY ASKED QUESTIONS

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University

Secure Coding SSL, SOAP and REST. Astha Singhal Product Security Engineer salesforce.com

Overcoming Testing Challenges in SAP Upgrade Projects

Continuous Integration

Agile Scrum Workshop

Continuous Integration: Aspects in Automation and Configuration Management

Accelerate Software Development with DevOps and Hybrid Cloud

BIM Awards notes. Muistio 1 (5) Lopullinen. Nieminen Juha / BC FIN Service Public knowledge. Creating Virtual Tour flights.

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

A Sales Strategy to Increase Function Bookings

4. Test Design Techniques

VIRTUALIZED WEB DESKTOP Towards a Faster Web Cloud Operating System

top tips to help you save on travel and expenses

Financial services marketers: Are your sales aids actually aiding sales?

Arcade Game Maker Product Line Production Plan

Software Development Processes. Software Life-Cycle Models. Process Models in Other Fields. CIS 422/522 Spring

Step 2 Go2Group Automation Self Assessment

HP WebInspect Tutorial

Software Continuous Integration & Delivery

ICAgile Learning Roadmap Agile Testing Track

Case Studies of Free Test Tools Successful Test Tool Use without a Big Budget

Eclipse Help

Accelerate Testing Cycles With Collaborative Performance Testing

Testing in a Mobile World

Quality Assurance Training Program

Vladimir Bakhov AT-Consulting +7 (905)

a new generation software test automation framework - CIVIM

Introduction to C Unit Testing (CUnit) Brian Nielsen Arne Skou

Achieving business benefits through automated software testing. By Dr. Mike Bartley, Founder and CEO, TVS

Accelerating Time to Market with Agile Testing

TEST AUTOMATION FRAMEWORK

Service Models Comparisons & Total Cost of Ownership by Coupa Software

Selecting an ISP. 45% of people in the EU would change ISP if necessary to get a faster Internet connection. (Source: EC)

Advanced Software Testing

Growing testing skills using the Agile Testing Ecosystem. Dr Lee Hawkins Principal Test Architect Dell Software, Melbourne

How to Plan a Successful Load Testing Programme for today s websites

Supporting a Global SAS Programming Envronment? Real World Applications in an Outsourcing Model

A Pythonic Approach to Continuous Delivery

PROBLEM SOLVING. 1. I m thinking of buying to let - where do I start?

Faculty of Science and Engineering Placements. Stand out from the competition! Be prepared for your Interviews

Examination Guidance for the Advanced Certificate in PPSO Examinations. Version 1.0

DETERMINATION OF THE PERFORMANCE

The Agile Movement An introduction to agile software development

CT30A8901 Chapter 10 SOA Delivery Strategies

GCE APPLIED ICT A2 COURSEWORK TIPS

A Comparison of Programming Languages for Graphical User Interface Programming

What s Cool in the SAP JVM (CON3243)

Transcription:

An Introduction to text-based test automation and the TextTest tool

Contentions 1. That there are circumstances where xunit-style testing isn t the best choice. 2. That the text-based approach is an obvious alternative candidate in many of these cases. 3. That there are advantages to operating Acceptance testing in this way even in general. 4. That text-based test-driven development is possible and even desirable. 5. That TextTest is the best free tool out there that tests this way.

Agile test automation == The API-assertion paradigm? public void testadd() { Number x = new Number(1); Number y = new Number(1); Number result = new Number(2); Assert.assertEquals(x.add(y), result); } Classic, near universal xunit We assume an API to the Number object We assert that it returns certain hardcoded values

Acceptance test tools have the same approach Fixtures.Addition x 1 1 y 1 2 add() 2 3 Fit table. Because customers don t write code. So we write them a fixture, give them a table and let them fill in the numbers. Under the covers it s more or less xunit with variable data and a nice interface.

Example applications where this paradigm is less than ideal Anything in a non-mainstream language. UNIX-style command-line scripts. Wide language variety (cshunit anyone?). Command line/textual output key parts. Design often haphazard. Legacy systems. Often legacy language. Design optional. Retrofitting APIs possible but hazardous. Correct behaviour maybe unknown. Jeppesen s airline crew schedule planner. Correct behaviour subjective and volatile. Large amounts of data for interesting tests.

(Re-)Introducing The text-based paradigm config.expr: executable:/usr/bin/expr options.expr: 1 + 1 output.expr: 2 Run the system under test from the command line Define tests in terms of different command lines Compare produced text files to equivalent files from previous runs. (and save them when appropriate)

Behaviour Change Management by Comparing Plain Text Use produced result files and internal logs as a measure of system behaviour. Invest in them so they are easy to read and have the right level of detail. Testing becomes a matter of Behaviour Change Management.

Seeing testing as Behaviour Change Management not Correctness Assertion Start Release 1 Release 2 T=0 T=3 months Business conditions change Your system behaviour will change Your tests must also change The tests help you manage change What could be more Agile? T=6 months T=3 years? T>10? Release n

Assumptions of the text-based paradigm Can have one tool for all languages past, present and future Do not compel tests to bypass any parts of the system Can handle any amount of data Independent of the system design and APIs Does not require any hand-coded assertions But we still have (different) assumptions... That system logging will not be a performance burden That the system produces suitable files, or can easily be made to. That the developers know what to log and how to log it That the command line interface and logging are not too volatile

What is TextTest? A tool for automated text-based testing Free, open source and written in Python (GUI written with PyGTK). Works on UNIX systems and Windows XP/Vista System under test is driven via the command line. Compares text files produced by the system under test against those produced by previous runs Continually developed and improved by Jeppesen. Short demo follows

Text-based Acceptance Testing and the GUI Use, or write, a record/replay library that can map GUI controls to a domain language (e.g. xusecase) Testers record sensible use-cases and critique system behaviour. wait for flight information to load select flight SA004 proceed to book seats accept error message quit Developers make sure system logs everything that can be observed externally.

Text-based testing for the whole team The Wall Unit Tests PD QA System tests QA QA sdgs How automated tests are often organised. Mr Team Leader - tear down this wall! The tests only run at the system level, but we can log at any level. Developers also create logs of lower level detail behaviour These are normally disabled but can be easily enabled for debugging Gradually build a knowledge base, unlike using debuggers

Test-Driven Development We want to provide rapid feedback to the developer at every build These tests are usually unit tests, but what if they weren't? Wouldn t it be nice to use our acceptance tests in this role?

Text-based test-driven development (really behaviour-driven development) Vital to take macro-level effects and the business perspective into effect when testing Greatly enhance our feedback if we see them every build instead of every iteration/release Enhance communication between developers and domain experts Everything is text files, so easy to write test sketches or suggest test changes by just editing them by hand But some things will be rather different

But system tests will be way too slow to run at every build Maintaining mock test environments or interdependent tests consumes human resources. Running tests in parallel consumes hardware resources. And hardware is cheap. Grid Engines are widely available, easy to use, and often free. TextTest integrates with SGE and LSF. Running more tests faster becomes simply a matter of buying more hardware.

But I want to use my tests to drive my design! Customer-perspective tests are unlikely to help drive design or prevent overdesign Much overdesign can be limited by Usagedriven design Before writing a class or method, write the code that make use of it (calls it). Ultimately, good design is mostly driven by thinking hard and refactoring well.

But I want to verify unit behaviour before trying to run the system! When the intended behaviour of a method, class or subsystem is clear it can be useful to test it on its own. We can reach for the interactive interpreter or the main method for this purpose. Aim is to drive development, not to bake microdesign decisions into the test suite. So we only make permanent the test that makes sense in a wider and longer-term perspective.

What ever happened to test-first? Unit-tests are predictive in that they assert up-front exactly what is expected. For larger-scale or requirements-focussed tests this is often not possible. Specify the test interaction first, but be prepared to frequently adjust the test behaviour as the problem is fleshed out. Testing then becomes less about correctness assertion and more about behaviour change management.

What about the Expert Reads Output antipattern? You need a person to read the output. But people are lazy and after a while will miss things. Then your tests are proving the wrong thing! Configure TextTest to find error messages automatically. Don't read the logs, observe the system! TextTest will group similar changes. Behaviour Change Management : changes are more important than contents.

Text-based ATDD : the process Write test interaction Write some code Logging adequate? N Log some information Y Release! N Test behaviour expected? N Y Y System behaviour usable? Save logs if needed

Conclusions Acceptance tests in the development cycle provide feedback on both macro effects and business perspective There are obstacles but all can be overcome: slowness best conquered by parallelism design can still be driven, top-down need to relax the test-first concept and introduce that of Behaviour Change Management Text-based testing is a much-underrated technique which works well in this role Tool support available in the form of TextTest.

TextTest Features Filters output to avoid false failure Manages test data and isolation from global effects Automatic organisation of test failures Nightjob website to get a view of test progress over time Performance testing Integrates with Sun Grid Engine for parallel testing (and LSF) Various data mining tools for automatic log interpretation Interception techniques to automatically mock out third-party components (command line and network traffic). Integrates with xusecase tools for GUI testing

The coding exercise We are now going to try to use the techniques outlined here to solve a toy coding problem in Python. We will not use unit testing as well. This is primarily to keep things simple. We will proceed from simple behaviour and manage the changes until it does what we want. We won t expend (much) effort predicting behaviour in advance. We will try to design top-down, but will use the python interpreter for bottom-up exploration when appropriate. You, the audience, should interrupt if: We take larger steps than you re comfortable with We over-design the code, or don t drive design from actual usage We don t test it adequately