Testing
A key factor to maintainability and scaling
Why Do We Test Our Code?
Most of the benefits of testing appears with time, but it has benefits even in the short term:
To make sure that the code you just wrote behaves as expected
To provide some specifications about the correct behaviour of your code
To give you confidence when refactoring existing code
To make sure that developers will see when they brake existing behaviour
What Do We Test?
At this point, our focus is on testing the backend, not much is done on the frontend side.
Here is the minimal expectations we have regarding specs into the backend:
specs for API endpoints
specs for service methods
For the frontend:
specs for new utils, helpers and macros.
How Do We Run Test ?
If you want to test only one file, run the following command:
bundle exec rspec insert_path_of_your_file
.If you want to keep track of your changes, simply run :
guard
. The tool will watch the changes you do and will automatically run tests linked to those changes.If you want to run all the tests, run
guard
and when it's done, simply runall
.
PS: just run exit
to get out of Guard.
Last updated