Can I use Knapsack Pro locally in a development environment?
It is not recommended to use
knapsack_pro locally on a developer machine.
knapsack_pro was not designed to be used in a development environment because you don't have isolated parallel machines in development with their own CPU/RAM/disk. In development, you won't have enough resources to run tests as fast as is possible on the CI server.
knapsack_prowas designed to work in a CI environment. Its main purpose is to run tests in parallel on CI. You can learn more about it here.
To benefit from
knapsack_proyou need a CI server because CI provides you:
- isolated parallel machines (also known as parallel containers/parallel jobs/parallel nodes)
- each parallel machine must be isolated, it must have its DB, its own CPU/RAM/disk, etc. Thanks to that you can spread the tests work with
knapsack_probetween parallel CI nodes' resources and run tests fast.
knapsack_pro and CI server are 2 components that are needed to run tests fast.
Our users use CI to run tests with
knapsack_pro. They don't use
knapsack_pro in development.
Other tools allow you to run tests in development in parallel like the
parallel_tests gem which allows you to configure separate databases in development so you could run tests against 2 different test databases in development.
knapsack_pro does not take care of configuring isolated databases in development for you. That's why you need other tools like a CI server or
parallel_tests gem to do it for you.
If you are considering using
knapsack_pro at the same time then please read this.
A single powerful CI server
Some of our users don't have the option to run parallel nodes on CI and they only have a single powerful CI server with a lot of CPU/RAM. For instance, they use Jenkins. In such a scenario, they could use
parallel_tests gem to run tests, see this.
This is the only configuration that could also work in the development environment if you would like to force
knapsack_pro to do so. Most likely using only
parallel_tests gem would be enough for development purposes. The biggest limitation of test suite execution speed in development will be available CPU/RAM/disk speed.
Debugging in development
Another use case when you would like to run
knapsack_pro in development is when you have some issue on CI and you have a problem fixing it on the CI. Then you could check these tips.
Please keep in mind that these are only for debugging purposes. Not for daily usage in development.