...

/

Your First Story

Your First Story

Start writing your own tests, and learn what makes a test useful.

What is a story?

As mentioned earlier, we will be building a simple task list app to learn how to test. Our first step would be to let users create tasks. Let’s call it a story because that’s the term used in Agile environments.

Each story must have an acceptance criteria. The acceptance criteria is a description of a feature that must be implemented to complete the story. In our case, it is described like this: user must be able to open an app, enter the name of the task, press enter and see his task in the list of tasks.

Why is it so important to have an acceptance criteria? This is for one very good reason: it is used to write the very first integration test. Based on the integration test, we write the unit tests. After the unit tests are written and fail, we begin writing code to fix the unit tests. Once all unit tests are fixed, the integration test should also pass.

Writing integration tests

Writing integration tests is actually pretty simple. You should just read off the acceptance criteria (or any English description of the feature), and translate it into JavaScript. To do this, you will need to know a few Selenium functions:

  • driver.get(url): Open a webpage.
...