Skip to content

JUnit RestFuse program flow

Guus edited this page Jan 13, 2015 · 1 revision

JUnit/RestFuse program flow

  • Call @BeforeClass method

For each TestCase-Method JUnit Init-Phase:

  • @Rule RequestContext

    • getNewRequestContext()
    • optionally prefill the RequestContext object
    • AddRequestObject()
  • @Rule Destination

    • getNewDestination()
    • optionally prefill the Destination object and update the RequestContext object
    • AddPathSegment()

Remark: At this stage the JUnit-Statement and Description infos are not available yet!

JUnit Apply-Phase:

  • RequestContext.apply()

    • Fill RequestContext with Data from HttpTest Annotations
    • Retrieve PathSegment Items not provided in Init-phase via getters in TestCase class
    • Retrieve RequestObject Items not provided in Init-phase via getters in TestCase class
    • Optionally replace JUnit-Statement with our own. (NYI)
  • Destination.apply()

    • Update RequestContext in case it was not processed as a Rule
    • Replace JUnit-Statement with our own HttpStatement (which overrides evaluate()).
  • HttpStatement.evaluate()

    • Build initial HttpRequest from RequestContext (which is copied to an InternalRequest object)
    • Optionally call ProcessRequest
    • Send HttpRequest
      ==> Inject HttpRequest-Response into the @Context response object
  • JUnit-Base-Statement.evaluate()

    • Call TestCase-Method
    • Optionally update TestClass fields from Response (e.g. Added DB-Objects, UUIDs etc.) for further reference in upcomming TestCase-Methods.

Clone this wiki locally