We have learned how to build and deploy a new rails app but no so much things about testing and deploying a production app.
- How to make strong tests for my new version ?
- Should I test with a replication of the production DB ? If yes, how to get the data : (scripting ?) ?
- Could we automatized test within rails?
- What is the best process to deploy a live app after the test ?
Cheers ! Antoine
From the little info I have been able to gather:
- There are plenty of tutorials over the internet, you can start with rails guides
- Tests will be more accurate if you run them on a replica of your production database. You can copy your database from your production app to your staging app, the process is explained here (assuming you use Postgre)
- No idea
- Use Continuous Integration, once all your tests are passed, your app is automatically deployed. Travis is a good Continuous integrator, but the free plan needs your app to be open-source on github...
This is note extensive explanation as I am trying to figure all this testing thing out myself, but I hope it helps :)
Here are a few tools to help you with the broad subject of testing.
How to make strong tests for my new version ?
- A good point is when you're sure that the feature is working without trying it for real ;) But it's a target really hard to achieve. Simplecov is a tool that helps you to have a significant test suite, and identify the part of your app that are missing tests.
Should I test with a replication of the production DB ? If yes, how to get the data : (scripting ?) ?
- IMHO not necessarily. You need to use a replication in terms of schema (run the same migrations) but it's not necessary to duplicate all your data.
Could we automatized test within rails?
- Depends on what you're calling automatized test ;) A good starting point is Watchman, a tools you can configure to watch the files you're editing and run the corresponding test every time you save.
What is the best process to deploy a live app after the test ?
- CircleCI : a service you can connect to your github repo and your heroku app through web hooks. Then, every time the build hook is started, circleCi pulls the code, create your DB and start your application inside of a docker container and run the tests (with rspec or minitest according to the testing tools you're using) . If all tests pass, your app is deployed to heroku. There are a lot of alternatives to this service such as Wercker or Semaphore
- Heroku Pipelines : a feature of heroku that let you configure how you're staging/sandbox/prod app are related to each other.
GLHF ! ;)