Top Banner
Why testers should know about TDD and how we can use it? Raimond Sinivee, @RaimondSinivee 05.06.2015 @ntd2015
17

Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Aug 09, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Why testers should know about TDD and how we can use it?

Raimond Sinivee, @RaimondSinivee

05.06.2015 @ntd2015

Page 2: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Agenda

• Terminology

• The Exercise

• The Problem

• The Story

• Unit testing and TDD

• The Testing Pyramid

• How testers could use TDD when they code software that helps in testing?

• The Exercise continues

@ntd2015, @RaimondSinivee

Page 3: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Terminology

1. Tools, scripts, harness, framework, helpers but not automation

2. There are no best practices, there are heuristics.

@ntd2015, @RaimondSinivee

Page 4: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Small example how TDD would look like in case of Selenium is the play• Download

• Java:• Source: http://1drv.ms/1RL14lp (3KB)

• Java libs: http://1drv.ms/1RKYsDO (26MB)

• Pyhton: App\python.exe src\SeleniumExample.py• Source http://1drv.ms/1RKYRX2 (1KB)

• Portable with Source http://1drv.ms/1RKYwU4 (37MB)

• Implement new method to SeleniumExample which would add to http protocol to a URL• Input “www.google.ee” returns http://www.google.ee

• Input “www.bing.com” returns http://www.bing.com

@ntd2015, @RaimondSinivee

Page 5: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Testing purpose code is first class citizen

• Regressions• Low first time quality

• Unknown state of code

• Problematic testing tools• Inaccurate

• Instable

• Not understandable code nor results

• Are your tests actually able to find the concern that they supposed to?

@ntd2015, @RaimondSinivee

Page 6: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Getting started

• Went to developer events, community gatherings, courses• CODE KATA

• Peer for troubleshooting

• Fix a bug

• Break down the wall

@ntd2015, @RaimondSinivee

Page 7: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

@ntd2015, @RaimondSinivee

Page 8: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

@ntd2015, @RaimondSinivee

Page 9: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

@ntd2015, @RaimondSinivee

Page 10: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

@ntd2015, @RaimondSinivee

Page 11: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Unit testing and Test Driven Development

• Unit test covers a single intent of a method

• TDD is a code design method• unit tests should be written before the code

• … but we have unit tests!• How would a development process look like when you write your tests before

the code or after the code?

• Don't test implementation, test intent

@ntd2015, @RaimondSinivee

Page 12: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

The Test Pyramid

•Amount of tests

•Lines of Code

•Time to execute

•Time to understand failures

•Purpose

•Role@ntd2015, @RaimondSinivee

Page 13: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

How testers could use TDD when they code software that helps in testing?• Developing testing tools

• Duplication

• Naming

• Troubleshooting• Debugging vs. unit testing

@ntd2015, @RaimondSinivee

Page 14: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

What TDD gives to testers?

• Red – Green – Refactor mindset

• Testability: controllability and observability

• Fast feedback loop

• Do you practice what you talk about?

@ntd2015, @RaimondSinivee

Page 15: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Summary

• Red – Green – Refactor mindset

• Testability: controllability and observability

• Unit test before coding to test intent, remove duplication and improve naming

• Troubleshoot by writing unit tests

• @ntd2015, @RaimondSinivee

@ntd2015, @RaimondSinivee

Page 16: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Implementation ideas

• Add support for subdomain as input parameter to URL generation method in SeleniumExample• Input “www” returns http://www.google.de

• Input “” returns http://google.de

• Method to start specific driver.• IE, Chrome, Firefox, Safari

@ntd2015, @RaimondSinivee

Page 17: Why testers should know about TDD and how we can use it?nordictestingdays.eu/.../raimond_sinivee-why_testers.pdf · 2019-11-27 · Why testers should know about TDD and how we can

Appendix

• Open Lecture by James Bach on Software Testing https://www.youtube.com/watch?v=ILkT_HV9DVU

• Test Pyramid: Initial idea author Mike Cohn, Succeeding with Agile: Software Development Using Scrum

• Book: Design Patterns: Elements of Reusable Object-Oriented Software, Gang of four.

• Is TDD dead: https://www.youtube.com/results?search_query=is+tdd+dead

• https://www.youtube.com/watch?v=vqwyMaHcjQE James Bach about testing agile process

• TDD for Testers What does TDD mean for me, the Tester?http://www.ministryoftesting.com/2014/08/tdd-testers/

• Integration Tests Are a Scam http://www.infoq.com/presentations/integration-tests-scam

• 7 Popular Unit Test Naming Conventions http://java.dzone.com/articles/7-popular-unit-test-naming

@ntd2015, @RaimondSinivee