Many tests exist, such as Manual, E2E (end to end), Unit, Acceptance, Regression, and Integration. Where do you start? What importance should you place on each test? Enter the testing pyramid; the pyramid provides a visual representation of test type importance. The primary factor behind its creation was to work with the agile methodology, and it is used every day throughout the industry. The bottom of the pyramid represents the most critical test type, while the top represents the least. All are important, but with time constraints, the pyramid provides a guideline on where to focus your efforts.

For every minute spent organizing, an hour is earned.- unknown

Unit Testing

Developers typically write Unit Tests themselves as they code. These tests ensure that specific method functions work as expected when changed or run. Unit Tests allow the team to make changes without as much fear and code more aggressively.

PROS
  • It catches flaws much quicker
  • Increase confidence in changing/maintaining code
  • It makes code more reliable
  • Easier to debug issues
CONS
  • Can miss bugs that only occur when integrated into the rest of the codebase
  • The time expense is significant when implementing into an already existing codebase

Integration Testing

Integration tests are the next tier of the pyramid. Similar to unit testing, this is focused more on a specific area. For example, take an e-commerce site, now say a new feature changes how coupons work or function. This type of test would mean focusing on all coupon functionality, ensuring it works as expected. In addition, since coupons would be part of the checkout flow, it should fall into the category of regression testing, where the tester will check the entire flow for unintended consequences. The test could use automation, manual, or both.

PROS
  • Catch unintended consequences
  • Ensures new features run reliably
CONS
  • The pitfall of automated testing; if something was added or the flow was changed the test would need to be updated adding to technical debt

End to End Testing

As the name suggests, this type of test runs through typical user flows from beginning to end. For example, a user loads the homepage, searches for a product, adds the product to the cart, and checks out. This test essentially provides the final green light that a release is ready for production and where automated testing comes into play.

PROS
  • Automated tests are faster than manual testing and free up other testing resources
  • Automated tests can be set to run multiple times and can continue outside of working hours
CONS
  • Automated testing, and Selenium (A framework with a near-monopoly on test automation), can be flakey. For example, something as simple as changing the name or class of a button can cause a test to fail while the process is still working as intended. Routine maintenance on these tests should be expected and accounted for in planning
  • An automated test can tell you that an element exists and is interactable; however, it may not be able to tell you about any visual oddities

Manual Testing

The final manual walkthrough of the site mainly looks for visual problems and oddities in behavior and crawls through some basic flows. This test is where the human element is most important; you'll need to think outside the box and how a human may interpret things or behave.

PROS
  • Catch UI problems missed by other tests
  • Assurance that an actual person has verified things
CONS
  • It can be very time consuming