Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are many different types of testing that you can use to make sure that changes to your code are working as expected. Not all testing is equal, though, and we will see here how the main testing practices differ from each other.

Pros and cons of testing

Pros:

  • More reusable code and easier debugging.
  • Reduce the cost of bug-fixing.
  • Errors can be detected at the early stages.
  • Increased efficiency of code improvement and maintenance.
  • Tests help find problems and resolve them.
  • Tests can check whether application does what was assumed in a first place (TDD based approach - tests firsts)
  • Tests can serve as an API documentation - by looking at tests, other developers can learn how API really works.

...

  • The process of testing can be time-consuming.
  • Not all errors can be detected.

Manual vs. automated testing

At a high level, we need to make the distinction between manual and automated tests. Manual testing is done in person, by clicking through the application or interacting with the software and APIs with the appropriate tooling. This is very expensive as it requires someone to set up an environment and execute the tests themselves, and it can be prone to human error as the tester might make typos or omit steps in the test script.

...

Automated testing is a key component of continuous integration and continuous delivery and it's a great way to scale your QA process as you add new features to your application. But there's still value in doing some manual testing with what is called exploratory testing as we will see in this guide.


Unit vs Integration tests

Unit tests are based on low level code, close to the source of your application. They consist of testing individual methods/functions/routines. Unit tests are in general quite cheap to automate and can be run very quickly by a continuous integration server. Additional benefit of Unit tests is that they can quickly locate regressions (bugs that were once fixed and show up again). Ideally, each and every bug that was found has its corresponding test that becomes a part of Unit testing framework.

...