OFBiz
  1. OFBiz
  2. OFBIZ-1463

JUnit test case for various application components

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: Trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015

      Description

      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.

        Issue Links

        1.
        JUnit test case for Creating a Purchase Order Sub-task Closed Marco Risaliti
         
        2.
        JUnit Test Case fro "Receive Other Shipment" Sub-task Closed Marco Risaliti
         
        3.
        JUnit Test Case for "Physical Inventory Adjustment" Sub-task Closed Marco Risaliti
         
        4.
        JUNIT test case for finding and editing a party(DemoCustomer) Sub-task Closed Vikas Mayur
         
        5.
        JUNIT test case for party communication Sub-task Closed Marco Risaliti
         
        6.
        JUnit test case for Creating a Sales Order Sub-task Closed Vikas Mayur
         
        7.
        JUnit Test Case for Stock Moves Sub-task Closed Vikas Mayur
         
        8.
        JUnit Test Case for Inventory Items Transfer Sub-task Closed Vikas Mayur
         
        9.
        JUnit Test case for Receive Inventory. Sub-task Closed Marco Risaliti
         
        10. JUnit Test case for update and return order. Sub-task Open Unassigned
         
        11. Credits, Refunds... Sub-task Open Unassigned
         
        12. Fulfillment with Picker & Packer Roles : Order Picking Sub-task Open Unassigned
         
        13.
        Fulfillment with Picker & Packer Roles : Packing and Shipping Sub-task Closed Vikas Mayur
         
        14.
        Marketing Manager Role : Create and Maintain Contact Lists Sub-task Closed Vikas Mayur
         
        15. Warehouse Manager Role : Receive Purchase Order Sub-task Open Unassigned
         
        16.
        JUnit Test Case for "Shipment process" Sub-task Closed Vikas Mayur
         
        17.
        Junit Test case for purchase order receipts... Sub-task Closed Jacques Le Roux
         
        18.
        Junit test case for Purchase Invoices: editing, adding taxes and shipping charges and posting to GL... Sub-task Closed Vikas Mayur
         
        19.
        Junit test case for Payments sent to suppliers for Purchase Invoices.... Sub-task Closed Vikas Mayur
         
        20.
        Junit tesr case for sales order shipments... Sub-task Closed Vikas Mayur
         
        21.
        Junit test case for generate a sales invoice ... Sub-task Closed Vikas Mayur
         
        22.
        Junit test case for Payments received from customers for Sales Invoices... Sub-task Closed Vikas Mayur
         
        23.
        Junit Test case for Manufacturing :- Production Runs: materials issuances from the warehouse Sub-task Closed Vikas Mayur
         
        24.
        Junit test case for Manufacturing :- Production Runs: actual manufacturing costs Sub-task Closed Vikas Mayur
         
        25.
        Junit Test case Manufacturing :- Production Runs: Add finished products into the warehouse Sub-task Closed Vikas Mayur
         
        26.
        Junit tests for the AR Batch Payments Sub-task Closed Anil K Patel
         
        27.
        Junit test case for Accounting - Void Payment and Cancel Invoice services. Sub-task Closed Ashish Vijaywargiya
         
        28.
        (Accounting - AP)Junit test case to test the service which creates payment group for given invoices along with its payment and application. Sub-task Closed Ashish Vijaywargiya
         
        29.
        (Accounting - AP)Junit test case to test the service which will cancle the issued check group(PaymentGroup with type CHECK_RUN). Sub-task Closed Ashish Vijaywargiya
         
        30.
        Junit test for the "depositWithdrawPayments" Sub-task Closed Anil K Patel
         
        31.
        (Accounting) Junit test case for servic - setFinAccountTransStatus. Sub-task Closed Anil K Patel
         
        32.
        Accounting - Void Payment and Check Run. Sub-task Closed Anil K Patel
         
        33.
        Accounting - Cancel Invoice and Cancel Chck Run. Sub-task Closed Ashish Vijaywargiya
         
        34.
        Introduce unit tests to the start component Sub-task Closed Taher Alkhateeb
         

          Activity

          Hide
          Vikas Mayur added a comment -

          Marco, you are most welcome to review and commit these patches.

          Show
          Vikas Mayur added a comment - Marco, you are most welcome to review and commit these patches.
          Hide
          Taher Alkhateeb added a comment -

          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.

          Show
          Taher Alkhateeb added a comment - 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.
          Hide
          Jacques Le Roux added a comment -

          I know it's totally out of subject and certainly premature but should we not do that with http://junit.org/junit5/ in mind? Or even maybe play daredevils and use it already (after all it's trunk)?

          Show
          Jacques Le Roux added a comment - I know it's totally out of subject and certainly premature but should we not do that with http://junit.org/junit5/ in mind? Or even maybe play daredevils and use it already (after all it's trunk)?
          Hide
          Taher Alkhateeb added a comment -

          Hmmmmm, It is certainly doable with gradle. I think the technology is still beta and we are expected to make a release branch soon. Perhaps we can upgrade junit after the branch? As far as I know the syntax is very much the same and only new features are added such as the ability to use lambda expressions in assertions. So I think an upgrade is not difficult.

          Show
          Taher Alkhateeb added a comment - Hmmmmm, It is certainly doable with gradle. I think the technology is still beta and we are expected to make a release branch soon. Perhaps we can upgrade junit after the branch? As far as I know the syntax is very much the same and only new features are added such as the ability to use lambda expressions in assertions. So I think an upgrade is not difficult.
          Hide
          Pierre Smits added a comment - - edited

          We all know trunk can be a volatile branch and things can get broken from time to time, but that doesn't mean that is should be used as a testbed for some piece of 3rd party software the community has no experience with.

          That being said, why don't you do a Proof of Concept first in your own dev environment and share results with the community? So that it can look for follow-up actions.

          Show
          Pierre Smits added a comment - - edited We all know trunk can be a volatile branch and things can get broken from time to time, but that doesn't mean that is should be used as a testbed for some piece of 3rd party software the community has no experience with. That being said, why don't you do a Proof of Concept first in your own dev environment and share results with the community? So that it can look for follow-up actions.
          Hide
          Taher Alkhateeb added a comment - - edited

          Hello everyone, I've introduced unit tests to the start component in OFBIZ-7897 which helped me actually detect some minor errors in the code. If you wish you can use these tests as a reference of how to introduce unit tests utilizing gradle. These tests automatically run every time you call build, test, or run any of the server commands (upon any code change). If no change in the code is detected then the tests are cached and not run again (just like ant or any other build system)

          Show
          Taher Alkhateeb added a comment - - edited Hello everyone, I've introduced unit tests to the start component in OFBIZ-7897 which helped me actually detect some minor errors in the code. If you wish you can use these tests as a reference of how to introduce unit tests utilizing gradle. These tests automatically run every time you call build, test, or run any of the server commands (upon any code change). If no change in the code is detected then the tests are cached and not run again (just like ant or any other build system)

            People

            • Assignee:
              Unassigned
              Reporter:
              Vikas Mayur
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development

                  Agile