> For the complete documentation index, see [llms.txt](https://omalab.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://omalab.gitbook.io/guide/engineering-wiki/testing/test-best-practices.md).

# Test Best Practices

> TLDR Put your support in the support folder. Write each test with DRY guidelines.

## Style Guidelines

* Please review the style guidelines at ReachLocal [ReachLocal RSpec Design Specs](https://github.com/reachlocal/rspec-style-guide)

  .
* Describe describes a case
* Context should have a positive and a negative case, or its a 'describe'
* Use xit when you are temporarily in a test. If you are skipping a test and pushing to production use 'pending' with the rationale.

## OMAlab increments on top of the standard RSPEC

* Use todo method to define a task that needs done, but you aren't doing it yet. You can review todos by typing bin/todo.sh

## Testing "levels"

* Test the "happy path"
* Test the "unhappy path"
* Test the edge cases
* Test for the bug fixes

## Integration versus Unit tests

* Tests go in spec/lib/etc. following the path
* Integration tests go in the spec/integration folder

## Examples

* [RSpec Todo Item](https://github.com/omalab/oma/wiki/RSpec-Todo-Item)

## Fixing Mistakes

* `git filter-branch --index-filter 'git rm --cached --ignore-unmatch $1' HEAD~5..HEAD`# removes the $1 file from last 5 commits (for large files)
