Real life applications best practice to test and deploy ?
7
Not solved Solved
9 months ago

Hello guys,

We have learned how to build and deploy a new rails app but no so much things about testing and deploying a production app.

  1. How to make strong tests for my new version ?
  2. Should I test with a replication of the production DB ? If yes, how to get the data : (scripting ?) ?
  3. Could we automatized test within rails?
  4. What is the best process to deploy a live app after the test ?

Cheers ! Antoine

9 months ago

From the little info I have been able to gather:

  1. There are plenty of tutorials over the internet, you can start with rails guides
  2. 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)
  3. No idea
  4. 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 :)

9 months ago

Thx a lot @Virolea

9 months ago

Hi,

Here are a few tools to help you with the broad subject of testing.

  1. 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.
  2. 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.
  3. 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.
  4. 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 ! ;)

9 months ago

WOW thanks a lot @Sbfrr ! Monday is going to be tuff :) !

Cheers !

Cancel
Submit your answer