-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class that prepopulates database for tests #9
Comments
@Iprogrammerr Hi Igor! That's a good idea, but won't break this rule? |
@fabriciofx the rule "Test Methods Must Share Nothing" is not 100% right, IMHO. You can share data/code among the tests, but you cannot do this in a specific order like "method A should run before B, then C". |
@mdbs99 Thanks for sharing your knowledge with us! But when you're saying "method A should run before B, then C" and "if you share data among tests, you need to guarantee that the data should came back to its initial state before use it in another test." there isn't a conflict between them, because I should use setup() and teardown() methods to achieve it? |
If there is not conflict (eg. the data is readonly, it's always in the same state), you don't need to use setup() and teardown(). |
@fabriciofx In this case table/tables with some records is precondition for testing classes from specific package(rset in this case). So this rule does not apply here. Moreover, we can make this class configurable so if will prepopulate databse with table that can be defined dynamically, so that our test will not depend on some specific table. |
I find it very difficult to test classes from com.github.fabriciofx.cactoos.jdbc.rset, because real data in database is required. In SelectTest.select() there is a code that can be used for that purpose. How about moving it to object that will make possible to reuse it?
The text was updated successfully, but these errors were encountered: