How to setup JUnit with SAP CX?

This article is about setting up JUnit with SAP CX (Hybris) under Intellij editor, many thanks to Dorra BARTAGUIZ (our TDD coach)

Step 0 : Intellij configuration (ignore this step if your are using Intellij for your SAP CX projects)

Step 1 : Test Creation

  • Go to the intellij’ module where you want to create the Junit class and under testsrc create a new class :

 

  • Write your Junit test

Step 2 : Configure Runner

  • Create a JUnit runner under menu (Run > Edit configuration )

Make sure that your are using the right module on “Use classpath of module” attribute and that “Shorten command line” is set to “classpth file -java…”

  • Link the runner with ant

 

Make sure that the working directory is setup to your module’s path !

Step 4 : Configure module’ classpath

The last step before running the test is to configure the module classpath

 

Step 3 : Run test

Run test from your IDE and enjoy !

 

 

Tagged , ,

Leave a Reply

Your email address will not be published. Required fields are marked *