robot framework dos and don'ts

24
© Copyright Nokia Networks Creative Commons Attribution 3.0 License Robot Framework Dos and Don'ts

Upload: pekka-klaerck

Post on 22-Apr-2015

2.095 views

Category:

Technology


5 download

DESCRIPTION

This presentation demonstrates general guidelines how to create good test cases using Robot Framework. Both good practices and anti-patterns are presented. The presentation is hosted on GitHub where you can find the original in ODP format: https://github.com/robotframework/DosDontsSlides

TRANSCRIPT

Page 1: Robot Framework Dos And Don'ts

© Copyright Nokia NetworksCreative Commons Attribution 3.0 License

Robot Framework

Dos and Don'ts

Page 2: Robot Framework Dos And Don'ts

Introduction

● Robot Framework is a generic acceptance level test automation framework

● This presentation demonstrates general guidelines how to create good test cases using it

● Both good practices and anti-patterns are presented● See also

http://code.google.com/p/robotframework/wiki/HowToWriteGoodTestCases

Page 3: Robot Framework Dos And Don'ts

Most important goals

● Easy to understand● Easy to maintain● Fast to execute

Page 4: Robot Framework Dos And Don'ts

Naming

● Very important to name well test cases, test suites, keywords, variables, libraries, resource files, ...

● Good name is explicit and easy to understand● Consistency● Namespaces● Name should tell “what”, not “how”

Page 5: Robot Framework Dos And Don'ts

Documentation

● Test suites often benefit from documentation explaining background etc.

● Well named tests created using well named keywords should not need extra documentation

● Reusable keywords must be documented– Good keyword and argument names help and are

often adequate with higher-level keywords

– Library keywords need detailed documentation

Page 6: Robot Framework Dos And Don'ts

Example categorization

● DO: A very good and generally recommended practice.

● DON'T: An anti-pattern, should not be used.● TRY: A practice that works in many contexts.● AVOID: A practice that typically should be

avoided but may sometimes be necessary.

Page 7: Robot Framework Dos And Don'ts

DO: Appropriate abstraction level

Page 8: Robot Framework Dos And Don'ts

DON'T: Too low abstraction level

Page 9: Robot Framework Dos And Don'ts

DON'T: Comments instead of abstraction

Page 10: Robot Framework Dos And Don'ts

DON'T: Documentation instead of abstraction

Page 11: Robot Framework Dos And Don'ts

DO: Use data-driven style to avoid repeating workflows and to

represent business rules

Page 12: Robot Framework Dos And Don'ts

TRY: Gherkin style (ATDD/BDD)

Page 13: Robot Framework Dos And Don'ts

DON'T: Tests without checks

Page 14: Robot Framework Dos And Don'ts

AVOID: Tests with unrelated checks

Page 15: Robot Framework Dos And Don'ts

AVOID: Dependencies between tests

Page 16: Robot Framework Dos And Don'ts

DO: Use teardowns for cleanup

Page 17: Robot Framework Dos And Don'ts

DO: Use suite setup/teardown to speed up execution

Page 18: Robot Framework Dos And Don'ts

TRY: Move suite setup/teardown to directory level initialization files

Page 19: Robot Framework Dos And Don'ts

DO: Use variables to avoid hard coding

Page 20: Robot Framework Dos And Don'ts

DON'T: Overuse variables

Page 21: Robot Framework Dos And Don'ts

AVOID: Variable assignment on test case level

Page 22: Robot Framework Dos And Don'ts

AVOID: Complex logic in test data

Page 23: Robot Framework Dos And Don'ts

DO: Move logic to libraries when possible

Page 24: Robot Framework Dos And Don'ts

DO: Use polling to synchronizeDON'T: Use sleeping to synchronize