The goal of this WOD is to add a set of simple tests to your Digits application. You should create tests for the following use cases:
BasicRetrieval: Home page can be displayed.
Login: A user can go to home page, login, and logout.
NewContact: A user can go to home page, login, create new contact, and logout.
There are other important use cases (editing a pre-existing contact, deleting a contact, and ensuring that non-authenticated users cannot see contacts), but creating a comprehensive set of use case tests is not the goal of this WOD.
(Prior to starting this WOD, you should have downloaded and run the tests associated with the play-example-fluentlenium and play-example-form systems.)
Instructions
Start your timer.
Bring your master branch for the digits application up to date.
Create a branch off the master branch of your digits system called testing-1.
Add a small change to a file, then push a commit of this branch to GitHub with the message “Starting WOD”.
Delete ApplicationTest.java. We focus on integration tests.
Create a method called testBasicRetrieval() in the IntegrationTest class. It should just test to see that the home (index) page can be retrieved. This verifies that the testing framework is working.
Create a method called testLogin() in the IntegrationTest class. This method should: go to the index page, click on the login link, fill out the login form, login, check to make sure that the login process was successful, logout, and check to make sure that logout was successful. Use the page object pattern (which requires the creation of an IndexPage class and a LoginPage class to encapsulate all page-related behaviors.
Create a method called testNewContact in the IntegrationTest class. This method should go to the index page, login, go to the New Contact page, create a new contact, and verify that the new contact now appears in the index page. Following the page object pattern, you will need to create a NewContactPage class to encapsulate the behavior associated with this page.
When you have verified that the tests work, push your enhanced code to your branch on GitHub with the message “Finished WOD”. The difference between the timestamps associated with the two commits represent your WOD time, and the code diffs represent your implementation.
When finished, stop your timer, and record how many minutes it took you to complete the WOD.
Rx: < 40 minAv: 40-50 minSd: 50-60 minDNF: 60+ min
Demonstration
Once you’ve finished doing the WOD a single time, watch me do it:
Standard WOD Caveats
You’ll learn significantly less from watching me solve the
WOD if you haven’t attempted the WOD yourself first.
While it’s an achievement to finish the WOD no matter how long it takes, you
might experience “diminishing returns” if you work longer than the DNF
time. Thus, it might be strategic to stop working at the DNF time and watch
my solution.
After watching my solution, I recommend that you repeat the WOD if you
have not achieved at least Av performance. If so, be sure to:
Delete your old project so you cannot refer to it;
Don’t look at my screencast while you WOD; and
Reset your timer.
Feel free to keep trying until you make Rx if that’s of interest to you.