Red Argyle Logo

Patterns
The Salesforce Blog with Tailored Goodness

Testing an App: Test Plans & Automated Scripts

Testing your app is important. It ensures that the customer will be receiving what was promised. It also ensures a smooth and seamless user experience which result in higher adoption rates. Overall testing makes for a better product. Now that that’s been said, how do we test an app?

PLANNING Your Testing

You should start thinking about testing when you start planning your app. Create User Stories and Test Plans while writing out the descriptions of the requirements. Not only will this save effort when the time comes for testing, but it is helpful for your admins and developers to know the intended user interaction and result.

DESCRIPTIVE Test Plans

When writing your User Stories and Test Plans, be descriptive. If you are vague, your Admins and developers will have questions. This may end up costing you more time than you thought you could save by writing a Test Plan thinking “they can figure this out”. There are a few main questions to answer when writing your User Stories and Test Plans:

What Will The User See?

When the user opens the app or a page in it, what are they supposed to see? This is where you describe the UI, at least describe what page they should be on so they know they are in the right place. As an example,

User navigates to https://google.com, beneath the Google logo is the search bar, enter your criteria here and click the “search” button.

What Should The User Do?

What actions should the user perform to complete the User Story or Test Plan? This can be anything from filling out a form to clicking a button, to whatever the most complex task will be within your app. Depending on your target audience will determine how complex your app will be. As an example,

User opens the “Home Page” by clicking the house icon in the top left corner of the navigation bar. The navigation bar is the solid gray menu below the page header, “Your Page”.

What should the result be?

When the user completes the actions specified in your User Stories or Test Plans, what should their expected result be? Describe what they will see or what actions are now enabled. For Test Plans you should also describe what happens behind the scenes. For example,

User clicks “Sign Up” link in the top right corner of the navigation bar. User now see the Sign Up page. User fills out the form with at least the required fields: first name, last name, email address, birthdate. User clicks “Sign Me Up!” button. A new user is created with the information entered by the user. The system auto-generates a username based on the first name and email address. An email is sent to the user, welcoming them to the site and containing a temporary password.

 Salesforce Unit Tests

Code Coverage isn’t just about getting to 75% to be able to deploy to production, it can be one of the main avenues of functional testing. Write specific tests for each User Story or Test Plan. Test to pass and test to fail (not actually fail, just assert that your results are failing appropriately). If you test for failing results, then you can plan accordingly with error messages or blockers to disallow those failures to happen to the user. I promise if you write tests for each story, then you will have 100% code coverage.

Casperjs

Writing scripts to automate your testing can take care of your navigation, content, performance, and even usability testing needs. This means that you don’t have to assign the task of having someone fill in every form and click every link and button, capture screenshots, and review content each time a test is performed. You write the script and run it. Your results will be printed on the screen. I recommend trying it out, you may just fall in love.

Don’t underestimate the importance of a well thought out test plan for your app. One of the most important things to keep in mind while testing, whomever wrote the code should not be the one testing their own work. Get another team member. It is even prudent to have someone unfamiliar with the app to do some testing as well. They can give you the most unbiased results and provide insights you may be to close to see. Leave a comment and let us know how you test your apps.