Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JS Software testing for beginners

JS Software testing for beginners

Lucas Santos

December 05, 2022
Tweet

More Decks by Lucas Santos

Other Decks in Programming

Transcript

  1. Software testing with JavaScript_ a quick guide

  2. who am I_ {twitter, youtube, linkedin…}.lsantos.dev software engineer_ [email protected]

  3. software testing

  4. software tests are untested software that tests your software

  5. why?

  6. why automated testing? ➔ Improves software quality ➔ Prevent errors

    before they're published ➔ Builds trust in the codebase ◆ Changes can be published faster
  7. tests should be ➔ Deterministic ➔ Self-contained ➔ Predictable ➔

    Small
  8. What to test?

  9. Functionality

  10. What not to test?

  11. Implementation

  12. let's hack!

  13. test runners_ giving us an edge on tests

  14. let's hack!

  15. test doubles_

  16. Types of doubles ➔ Spies ◆ Adds instrumentation to a

    function/object ◆ Actually calls the function but gathers metadata ➔ Stubs ◆ Replaces a function for a fake implementation ◆ Adds instrumentation ◆ Returns a fixed value ➔ Mocks ◆ "Smarter" stubs ◆ Have predefined expectations on interactions ◆ Focused on the interaction, not on behaviour
  17. let's hack!

  18. TDD Test Driven Development

  19. None
  20. thank you_ lsantos.dev