fluent integration-tests

14
How to live happily ever after with integration tests Copyright (c) 2014 Maciej Hryniszak

Upload: matthias-hryniszak

Post on 15-Jun-2015

2.211 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Fluent integration-tests

How to live happily ever after with integration tests

Copyright (c) 2014 Maciej Hryniszak

Page 2: Fluent integration-tests
Page 3: Fluent integration-tests

Disclaimer

Dear viewer,

Please be advised that opinions expressed in this presentation and on the following slides as well as comments made during the discussion aftet the presentation are solely those of the presenter and not necessarily those of Lumesse. Lumesse does not guarantee the accuracy or reliability of the information provided herein.

Thank you!

Page 4: Fluent integration-tests

Overview

The three challenges

Fluent interface

Page objects

Reusable scenarios

Reusable special functionality

Clean resources

Agenda

Page 5: Fluent integration-tests

Overview

Different types of tests Manual tests

Unit tests

Performance tests

Acceptance tests

Integration vs Unit tests

Test code is important – it saves you

Let’s get serious...

Page 6: Fluent integration-tests

Writing integration tests is hard

Reading integration tests is even harder

Maintaining integration tests is a nightmare

The three challenges

Page 7: Fluent integration-tests

In software engineering, a fluent interface (as first coined by Eric Evans and Martin Fowler) is an implementation of an object oriented API that aims to provide for more readable code.

A fluent interface is normally implemented by using method cascading (concretely method chaining) to relay the instruction context of a subsequent call (but a fluent interface entails more than just method chaining ). Generally, the context is

defined through the return value of a called method

self-referential, where the new context is equivalent to the last context

terminated through the return of a void context.

Fluent interface

Page 8: Fluent integration-tests

Page Object is a Design Pattern which has become popular in test automation for enhancing test maintenance and reducing code duplication. A page object is an object-oriented class that serves as an interface to a page of your AUT. The tests then use the methods of this page object class whenever they need to interact with that page of the UI. The benefit is that if the UI changes for the page, the tests themselves don’t need to change, only the code within the page object needs to change. Subsequently all changes to support that new UI are located in one place.

Page objects

Page 9: Fluent integration-tests

Code reuse, also called software reuse, is the use of existing software, or software knowledge, to build new software, following the reusability principles.

Reusable scenarios

Page 10: Fluent integration-tests

In computer science and software engineering, reusability is the likelihood that a segment of source code can be used again to add new functionalities with slight or no modification

Reusable special functionality

Page 11: Fluent integration-tests

Clean database with automatic migrations and injection of test data

Initialization of other resources (files, folders..)

Clean resources

Page 12: Fluent integration-tests
Page 13: Fluent integration-tests

Thank you!

http://padcom13.blogspot.com

Page 14: Fluent integration-tests

Hope you didn’t feel like falling asleep