Uploaded image for project: 'mod-orders'
  1. mod-orders
  2. MODORDERS-562

MockServer refactoring

    XMLWordPrintable

Details

    • Tech Debt
    • Status: Open (View Workflow)
    • P3
    • Resolution: Unresolved
    • None
    • None
    • Thunderjet

    Description

      Purpose/Overview:

      As more unit tests are added regularly, they are getting hard to maintain because part of their implementation is in specific classes and part of it is in MockServer.java, which has grown to 2500 lines in mod-orders.

      We can start with mod-orders, but this issue should be addressed for all backend modules.

      Requirements/Scope:

      Unit test implementations should be more distributed, so that MockServer only contains minimal generic code and nothing related to a specific test.

      Approach:

      If a test needs the mock server to respond to a particular query with a given response, it should call a generic method of MockServer giving the request method, path and parameters (with regular expressions if needed), and the reply. If several tests in a test file are using the same request/response, setup can be added in the before() method.

      1. Replace MockServer with WireMock (look mod-organizations)
      2. All API stubs should be done directly in the test method.
      3. API tests name should end with "IT" and place in the package "it": orders.it.OrdersIT

      Acceptance criteria:

      • MockServer refactoring
      • All existing tests should still exist and pass

      TestRail: Results

        Attachments

          Activity

            People

              Unassigned Unassigned
              damieng Damien Guillaume
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                TestRail: Runs

                  TestRail: Cases