Skip to content

Comment on Ask HN: How did you learn to properly build tests?

Comments

The most important thing with testing is getting started. Over time you can build a better test infrastructure and tooling, but just start with it.

At Codeship we focus on functional tests first. We use Cucumber/Capybara/Selenium a lot to test the user facing functionality. This way we can be sure that the feature works on the highest level. For some parts you might need to go down to unit tests, but start with functional tests first.

If you want to get started with testing your system try the following:

Everyone in your team writes down his 7 most important workflows in the application from a users perspective and ranks them. Then put all of the workflows together and try to find the 7 most important ones your team agrees on. Then find a tool that helps you test those from a users perspective. Build the whole toolchain (Tetsing tools on every developer machine, Continuous Integration server/service, ...) so adding new tests is trivial.

Now there is no more excuse not to write tests.

For mocking take a look at a screencast we did a while ago:

http://blog.codeship.io/2013/06/11/testing-tuesday-9-stubbin...

But still the most important thing with testing is getting started and having the whole workflow in place. Even if there is just one test, getting to a point where it is easy to add new tests needs to be priority #1

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.