[
https://issues.apache.org/jira/browse/OFBIZ-1463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15381956#comment-15381956 ]
Taher Alkhateeb commented on OFBIZ-1463:
----------------------------------------
Hello everyone,
It is important to note in here that the old OFBiz tests are really integration tests, not unit tests. Therefore, please note the following comments / recommendations:
- If your test does not need a database or some environment context, then convert it to a unit test
- Real unit tests are very fast, if it takes time (because of using external resources) then keep it as an integration test
- Unit tests are automatically run everytime you call ./gradlew build or run any server commands.
- Unit tests can be explicitly called by the command ./gradlew test
- Recommend to keep the JUnit tests as pure junit (nothing OFBiz related)
- Recommend using the annotations instead of starting each test name with test...
- Highly recommend using _ExpectedException_ and _assertThat(actual, expected) API over other older classical test methods.
- You might need to create mock objects for your tests. This is where mockito might be helpful. I will propose something on the ML once I hit a test requirement to introduce it.
I will create a Sub-JIRA to commit some tests for the Start component which you can use as a reference If you like to.
> JUnit test case for various application components
> --------------------------------------------------
>
> Key: OFBIZ-1463
> URL:
https://issues.apache.org/jira/browse/OFBIZ-1463> Project: OFBiz
> Issue Type: New Feature
> Components: framework
> Affects Versions: Trunk
> Reporter: Vikas Mayur
> Priority: Minor
>
> This is an effort to create JUnit test suites for various bussiness processes in Ofbiz.
> It would be good to have such tests in place so that we can test Ofbiz on a certain day.
> These tests are in initial stage, so I would like community members to post there comments so that we can move
> ahead with them to make these test even better.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)