Note that there are some explanatory texts on larger screens.

plurals
  1. POIntegration test best practices
    primarykey
    data
    text
    <p>I looked in stackoverflow and could fine <a href="https://stackoverflow.com/questions/1328730/integration-testing-best-practices">one</a> or <a href="https://stackoverflow.com/questions/7433627/integration-test-best-practice">two</a> questions that have a similar title than this one, but none of it answers what I'm asking. Sorry if this is duplicated.</p> <p>In unity tests, there is a guideline that says "<a href="http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html" rel="nofollow noreferrer">One assertion per test</a>". By reading around stackoverflow and the internet, it is commonly accepted that this rule can be relaxed a bit, but every unit test should test one aspect of the code, or one behavior. This works well because when a test fails you can immediately see what failed and fixing it most likely the test will not fail again in other point in the future.</p> <p>This works well for Rails unit tests, and I have been using it for functional testing as well without any problem. But when it comes to integration tests, it is somewhat implicit that you should have many assertions in your tests. Apart from that, they usually repeat tests that are already done once in functional and in unit tests. </p> <p>So, what are considered good practices when writing integration tests in these two factors:</p> <ol> <li><strong>Length of the integration tests</strong>: How to measure when a integration test should be splited in two? Number of requests? Or larger is always better</li> <li><strong>Number of assertions on integration tests</strong>: Should it repeat the assertions presented on unit tests and functional tests about the current state of the system every time, or should it have only 5 or so asserts on the end to test if the correct output was generated?</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload