GitSwarm 2016.3-2 Documentation


Testing Standards and Style Guidelines

This guide outlines standards and best practices for automated testing of GitSwarm CE and EE.

It is meant to be an extension of the thoughtbot testing styleguide. If this guide defines a rule that contradicts the thoughtbot guide, this guide takes precedence. Some guidelines may be repeated verbatim to stress their importance.

Factories

GitSwarm uses factory_girl as a test fixture replacement.

JavaScript

GitSwarm uses Teaspoon to run its Jasmine JavaScript specs. They can be run on the command line via bundle exec teaspoon, or via a web browser at http://localhost:3000/teaspoon when the Rails server is running.

RSpec

General Guidelines

let variables

GitSwarm's RSpec suite has made extensive use of let variables to reduce duplication. However, this sometimes comes at the cost of clarity, so we need to set some guidelines for their use going forward:

Test speed

GitSwarm has a massive test suite that, without parallelization, can take more than an hour to run. It's important that we make an effort to write tests that are accurate and effective as well as fast.

Here are some things to keep in mind regarding test performance:

Features / Integration

Spinach (feature) tests

GitSwarm moved from Cucumber to Spinach for its feature/integration tests in September 2012.

As of March 2016, we are trying to avoid adding new Spinach tests going forward, opting for RSpec feature specs.

Adding new Spinach scenarios is acceptable only if the new scenario requires no more than one new step definition. If more than that is required, the test should be re-implemented using RSpec instead.


Return to Development documentation