Menu

MockRunner & JUnit 4

2010-04-14
2013-04-15
  • Jethro Borsje

    Jethro Borsje - 2010-04-14

    Hi everybody,

    I am used to writing test cases using JUnit4 annotations all over the place. In my current project I have tried to use MockRunner to test my MDB's and I find MockRunner is a great tool. However, I am forced to use JUnit3, because all test adapters are JUnit3 style. Are there any plans to update MockRunner to JUnit4?

    Best regards,
    Jethro

     
  • Alwin Ibba

    Alwin Ibba - 2010-04-14

    You are by no way forced to extend the adapters. Excerpt from readme.txt

    "Please note, that all adapters just delegate to their corresponding module. If you
    don't want to extend a Mockrunner adapter, you can always create a module like this:

    JDBCMockObjectFactory factory = new JDBCMockObjectFactory();
    JDBCTestModule module = new JDBCTestModule(factory);"

    Just have a look at e.g. com.mockrunner.example.struts.OrderActionTest

    If you are in doubt how to do the setup and teardown work, look at the source code of the adapters.

    There are no plans to offer specific base classes for JUnit4 or other tools. Just use the modules.

     
  • Jethro Borsje

    Jethro Borsje - 2010-04-14

    Allright, that sound good! Do I need to create a new EJB test module for every test method or can I reuse an existing one?

     
  • Nobody/Anonymous

    It's better to create everything from scratch for every test method to prevent side effects. The adapers are designed to setup the whole environment in the setup method and to do necessary clean up work in teardown.

     

Log in to post a comment.

MongoDB Logo MongoDB