Step 3: Make Your Assertions

Finally. The fun part! Now that we’ve done the heavy lifting and written all our selectors, here’s where we get to sit down and write an honest-to-goodness test.

Assertions are truths we express about our software in the form of code—in our case, automated tests.

Here it would be good if we made two assertions about our login page:

  • People with valid credentials can log in.
  • People without valid credentials can’t log in.

Let’s start with the first one.

Testing the Valid Credentials


Judging by this story’s acceptance criteria, it looks like there are three things we’re going to want to test for here:

  • A redirection to a Welcome ...

Get The Way of the Web Tester now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.