Testing standards and style guidelines
This document describes various guidelines and best practices for automated testing of the GitLab project.
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.
Following are two great articles that everyone should read to understand what automated testing means, and what are its principles:
- Five Factor Testing: Why do we need tests?
- Principles of Automated Testing: Levels of testing. Prioritize tests. Cost of tests.
Learn about the different testing levels, and how to decide at what level your changes should be tested.
Everything you should know about how to write good tests: RSpec, FactoryGirl, system tests, parameterized tests etc.
Everything you should know about how to write good Frontend tests: Karma, testing promises, stubbing etc.
What are flaky tests, the different kind of flaky tests we encountered, and what we do about them.
How GitLab test suite is run in the CI context: setup, caches, artifacts, parallelization, monitoring.
Everything you should know about how to test Rake tasks.
Spinach (feature) tests
GitLab moved from Cucumber to Spinach for its feature/integration tests in September 2012.
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.