Code Monkey home page Code Monkey logo

Comments (5)

fabriciofx avatar fabriciofx commented on June 7, 2024

@Iprogrammerr Hi Igor! That's a good idea, but won't break this rule?

from cactoos-jdbc.

mdbs99 avatar mdbs99 commented on June 7, 2024

@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".
Another thing is: 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.

from cactoos-jdbc.

fabriciofx avatar fabriciofx commented on June 7, 2024

@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?

from cactoos-jdbc.

mdbs99 avatar mdbs99 commented on June 7, 2024

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().

from cactoos-jdbc.

Iprogrammerr avatar Iprogrammerr commented on June 7, 2024

@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.

from cactoos-jdbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.