Slide 1

Slide 1 text

Testing strategies beyond TDD PHPMad -

Slide 2

Slide 2 text

Hello! I am Matheus Marabesi You can find me at @MatheusMarabesi ✌

Slide 3

Slide 3 text

Agenda ▣ Software testing definitions ▣ Strategies □ Monolith □ Api + Frontend ▣ Tools ▣ Takeaway

Slide 4

Slide 4 text

Developer Testing in the IDE: Patterns, Beliefs, and Behavior Beller M. et al. Developer Testing in the IDE: Patterns, Beliefs, and Behavior. In IEEE Transactions on Software Engineering, p. 261 - 284 (2019)

Slide 5

Slide 5 text

1. DEFINITIONS

Slide 6

Slide 6 text

‘’ Testing is intended to show that a program does what it is intended to do and to discover program defects before it is put into use. Sommerville Ian, Software Engineering (10th Edition). 2016. p. 227.

Slide 7

Slide 7 text

Bug free Testing doesn't mean bug free.

Slide 8

Slide 8 text

‘’ Professional testers must still perform investigative testing. R. Jeffries, G. Melnik, Guest Editors' Introduction: TDD--The Art of Fearless Programming. 2017, p. 24 - 30.

Slide 9

Slide 9 text

M. Cohn, SUCCEEDING WITH AGILE. 2010, p. 312.

Slide 10

Slide 10 text

M. Cohn, SUCCEEDING WITH AGILE. 2010, p. 312.

Slide 11

Slide 11 text

‘’ Automated user interface testing is placed at the top of the test automation pyramid because we want to do as little of it as possible. M. Cohn, SUCCEEDING WITH AGILE. 2010, p. 312.

Slide 12

Slide 12 text

M. Cohn, SUCCEEDING WITH AGILE. 2010, p. 312.

Slide 13

Slide 13 text

‘’ Service-level testing is about testing the services of an application separately from its user interface. M. Cohn, SUCCEEDING WITH AGILE. 2010, p. 313.

Slide 14

Slide 14 text

M. Cohn, SUCCEEDING WITH AGILE. 2010, p. 312.

Slide 15

Slide 15 text

‘’ Unit testing is the process of testing program components, such as methods or object classes. Individual functions or methods are the simplest type of component. Sommerville Ian, Software Engineering (10th Edition). 2016. p. 232.

Slide 16

Slide 16 text

R. S. Pressman, B. R. Maxim, SOFTWARE ENGINEERING - A Practitioner's Approach. 2015, p. 470.

Slide 17

Slide 17 text

Similarities Testing strategy starts from unit moving onward to integration.

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Integration Functional Acceptance e2e

Slide 20

Slide 20 text

Integration

Slide 21

Slide 21 text

‘’ For some people integration testing means to test through the entire stack of your application connected to other applications within your system. Ham Vocke, The Practical Test Pyramid, 2018, https://martinfowler.com/articles/practical-test-pyramid.html

Slide 22

Slide 22 text

72: Taylor Otwell - Testing Laravel Applications 72: Taylor Otwell - Testing Laravel Applications, http://www.fullstackradio.com/72

Slide 23

Slide 23 text

PHPT

Slide 24

Slide 24 text

Functional

Slide 25

Slide 25 text

Acceptance

Slide 26

Slide 26 text

‘’ Sometimes you'll hear the terms functional test or acceptance test for these kinds of tests. Sometimes people will tell you that functional and acceptance tests are different things. Sometimes the terms are conflated. Ham Vocke, The Practical Test Pyramid, 2018, https://martinfowler.com/articles/practical-test-pyramid.html

Slide 27

Slide 27 text

e2e It's a term often related to front end instead of backend

Slide 28

Slide 28 text

‘’ End-to-end tests (also called Broad Stack Tests) give you the biggest confidence when you need to decide if your software is working or not. Ham Vocke, The Practical Test Pyramid, 2018, https://martinfowler.com/articles/practical-test-pyramid.html

Slide 29

Slide 29 text

Functional, Acceptance, e2e

Slide 30

Slide 30 text

‘’ Now that we’ve written some acceptance tests, functional tests are almost the same, with one major difference: Functional tests don’t require a web server. Codeception, Functional testing, https://codeception.com/docs/04-FunctionalTests

Slide 31

Slide 31 text

Pyramid (redefine) A modern approach

Slide 32

Slide 32 text

e2e Unit - Application - Classes - Methods - Events - Components Frontend Integration

Slide 33

Slide 33 text

Acceptance Integration Unit - Classes - Methods - Events - Database - File system - External services Backend - Application

Slide 34

Slide 34 text

2. STRATEGIES

Slide 35

Slide 35 text

TDD, Unit test Terms often used together

Slide 36

Slide 36 text

‘’ We drive development with automated tests, a style of development called Test-Driven Development (TDD). Beck Kent, Test-Driven Development By Example. 2002, p. 9.

Slide 37

Slide 37 text

Often this is not the case 72: Taylor Otwell - Testing Laravel Applications, http://www.fullstackradio.com/72

Slide 38

Slide 38 text

‘’ Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. M. Fowler, K. Beck, J. Brant, W. Opdyke, D. Roberts, Addison-Wesley Professional. 1999, p. 9.

Slide 39

Slide 39 text

Monolith (legacy) Adding new features or maintenance tasks often leads to behavior change

Slide 40

Slide 40 text

Alister Scott, Software Testing Ice-Cream Cone. https://watirmelon.blog/testing-pyramids

Slide 41

Slide 41 text

Monolith (legacy) e2e Refactor Unit

Slide 42

Slide 42 text

Alister Scott, Software Testing Ice-Cream Cone. https://watirmelon.blog/testing-pyramids Anti pattern

Slide 43

Slide 43 text

API + Frontend Frontend and backend

Slide 44

Slide 44 text

API Unit Integration Acceptance

Slide 45

Slide 45 text

Frontend Unit Integration e2e

Slide 46

Slide 46 text

TDD != UNIT TEST When to not use TDD? Playing with new technology

Slide 47

Slide 47 text

TDD != UNIT TEST When to not use TDD? Playing with new technology The goal is not clear

Slide 48

Slide 48 text

TDD != UNIT TEST When to not use TDD? Playing with new technology The goal is not clear P.O.C

Slide 49

Slide 49 text

3. TOOLS

Slide 50

Slide 50 text

PHPunit PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. https://phpunit.de

Slide 51

Slide 51 text

Codeception Codeception collects and shares best practices and solutions for testing PHP web applications. With a flexible set of included modules tests are easy to write, easy to use and easy to maintain. https://codeception.com

Slide 52

Slide 52 text

Cypress Fast, easy and reliable testing for anything that runs in a browser. https://www.cypress.io

Slide 53

Slide 53 text

4. TAKEAWAY

Slide 54

Slide 54 text

Definitions

Slide 55

Slide 55 text

Bug free Testing doesn't mean bug free.

Slide 56

Slide 56 text

Tools

Slide 57

Slide 57 text

Bye! I am Matheus Marabesi You can find me at @MatheusMarabesi