Slide 1

Slide 1 text

UNIT TESTING GETTING STARTED WITH BY LALIT VIJAY

Slide 2

Slide 2 text

THE KEY ELEMENTS BASICS HAND ON TESTING PITFALLS 01 02 03

Slide 3

Slide 3 text

WHAT IS UNIT TESTING? Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. Unit testing can be done manually but is often automated. BASICS

Slide 4

Slide 4 text

01 Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. BASICS WHAT’S TDD?

Slide 5

Slide 5 text

WHERE TO START 1. Start easy 2. Solve your current pain 3. Its easy to write bad unit tests

Slide 6

Slide 6 text

WHAT TO TEST FIRST? If you feel a need of dd or var_dump, you can unit test for that You always now what's the output right? Output is the first test

Slide 7

Slide 7 text

TOOLS FOR TESTING? DIEGO MARTIN Use Framework, No need to reinvent the wheel. For most of the languages, we have unit testing frameworks, Unit testing is not about the language it's about improving your codebase and architecture. For today its PHPUnit

Slide 8

Slide 8 text

Use Framework, No need to reinvent the wheel. PHPUnit Mocha(JS) TOOLS FOR TESTING?

Slide 9

Slide 9 text

02 You need the ability to look at all the different aspects of a problem. GREATLY HANDS-ON GO BEYOND The more you are able to loop through, the higher chance you have for good results. ALWAYS ITERATIVE LOOP THROUGH

Slide 10

Slide 10 text

03 PITFALLS TO AVOID Unit testing is not about finding bugs Testing Obsession Don't Test too many things in One Test Case Don’t make unnecessary assertions Not Mocking external services and state

Slide 11

Slide 11 text

Some Good habbit Make each test independent to others Name your unit tests clearly Don’t unit test configuration settings Practice makes a man perfect

Slide 12

Slide 12 text

THANKS A LOT