How to Write a Good Test Case
Write the test case:
Please frame your test case in the following format to help us fix this more quickly:
Scenario:
Given I
When I
Then I
Example:
Scenario: The login form allows existing logged out user to log in
Given I am a user with an active Open edX account that is logged out
When I navigate to the landing page and click the login button
Then I am directed to a login form
And when I fill in the required fields of the login form with my correct account information and click the login button
Then I am able to login to Open edX, I am directed to the My Courses page, and I see my account name towards the top of the page
Review your test case and consider: does the test case need more detailed setup instructions?
Using the example above, I could go above and beyond and provide the URL for the landing page where they should conduct the test, and make sure to reiterate that I should be logged out of the sandbox to perform this test.
Using the example above, I might add the following Setup instructions:
Ensure that you’re logged out of the testing sandbox
Navigate to: /
Review your test case and consider: does the test case need to be re-written/expanded? Have you only considered the best-case-scenario or the “happy path”?
Using the example above, I might update the test case to the following (underlined portion has been added):
Scenario: The login form allows existing logged out user to log in
Given I am a user with an active Open edX account that is logged out
When I navigate to the landing page and click the login button
Then I am directed to a login form
And when I fill in the required fields of the login form with my correct account information and click the login button
Then I am able to login to Open edX, I am directed to the My Courses page, and I see my account name towards the top of the page
And when I… log out, navigate back to the login from and fill in the required fields of the login form with my correct username and the incorrect password and click the login button
Then I see an error message at the top of the form and I am not able to log in
And when I… log out, navigate back to the login from and fill in the required fields of the login form with the incorrect username and the correct password and click the login button
Then I see an error message at the top of the form and I am not able to log in