Oracle Developer Cloud Service provides you with following capabilities as far as JUnit is concerned


  • Viewing the list of all executed tests and the cumulative test metrics
  • Test Result History to track the history of all tests in a graphical form


This blog contains a simple JPA based project which uses an in-memory Derby database to execute JUnit tests. You will see how to


  • Setup the source code in your Developer Cloud service instance Git repository
  • Configure the build process along with the JUnit test related actions
  • Execute the build and track the test results





Unit test


The JUnit test case


public class JSRRepositoryTest {

    public JSRRepositoryTest() {
    static Map<String, String> props = new HashMap<>();
    final static String PU_NAME = "derby-in-memory-PU";

    public static void setUpClass() {

        props.put("javax.persistence.jdbc.url", "jdbc:derby:target/derbydb;create=true");
        props.put("javax.persistence.jdbc.driver", "org.apache.derby.jdbc.EmbeddedDriver");
        JPAFacade.bootstrapEMF(PU_NAME, props);


    public static void tearDownClass() {
        props = null;


    JSRRepository cut;

    public void setUp() {
        cut = new JSRRepository();

    public void tearDown() {
        //nothing to do

    public void getSingleJSRTest() {
        JavaEESpecification spec = cut.get("123");
        assertNotNull("Spec was null!", spec);
        assertEquals("Wrong spec id", spec.getJsrId(), new Integer(123));
        assertEquals("Wrong spec name", spec.getName(), "jsonb");

    @Test(expected = RuntimeException.class)
    public void getSingleJSRTestForNullValue() {


    @Test(expected = RuntimeException.class)
    public void getSingleJSRTestForBlankValue() {


    public void getSingleJSRTestForInvalidValue() {
        JavaEESpecification spec = cut.get("007");
        assertNull("Spec was not null!", spec);

    public void getAllJSRsTest() {
        List<JavaEESpecification> specs = cut.all();
        assertNotNull("Specs list was null!", specs);
        assertEquals("2 specs were not found", specs.size(), 2);

    public void createNewJSRTest() {
        JavaEESpecification newSpec = new JavaEESpecification(366, "Java EE Platform", "8");
        JavaEESpecification spec = cut.get("366");
        assertNotNull("Spec was null!", spec);
        assertEquals("Wrong spec id", spec.getJsrId(), new Integer(366));
        assertEquals("Wrong spec name", spec.getName(), "Java EE Platform");
        assertEquals("Wrong spec version", spec.getVersion(), "8");

    public void updateJSRDescTest() {

        String specID = "375";
        String oldDesc = "security for the Java EE platform";
        String newDesc = "updated desc on " + new Date();

        JavaEESpecification newSpec = new JavaEESpecification(Integer.parseInt(specID), oldDesc, "Security", "1.0");
        JavaEESpecification updatedSpec = new JavaEESpecification(Integer.parseInt(specID), newDesc, "Security", "1.0");

        JavaEESpecification spec = cut.get(specID);

        assertNotNull("Spec was null!", spec);
        assertEquals("Description was not updated", spec.getDescription(), newDesc);
        assertEquals("Wrong spec id", spec.getJsrId(), new Integer(specID));
        assertEquals("Wrong spec name", spec.getName(), "Security");
        assertEquals("Wrong spec version", spec.getVersion(), "1.0");


Project & code repository creation


Create a project in your Oracle Developer Cloud instance








Create a Git repository – browse to the Home tab, click New Repository and follow the steps






You should see your new repository created


Populating the Git repo


Push the project from your local system to your Developer Cloud Git repo you just created. We will do this via command line and all you need is Git client installed on your local machine. You can use this or any other tool of your choice


cd <project_folder> 
git init
git remote add origin <developer_cloud_git_repo>
git add .
git commit -m "first commit"
git push -u origin master  //Please enter the password for your Oracle Developer Cloud account when prompted


You should be able to see the code in your Developer Cloud console




Configure build job










Activate the following post build actions


  • Publishing of JUnit test result reports
  • Archiving of test reports (if needed)





Trigger build



Check test results


After the build process is over (it will fail in this case), check the top right corner of your build page and click Tests



Overall metrics



Failed tests snapshot



Failed test details



Example of a passed test



Result History





**The views expressed in this post are my own and do not necessarily reflect the views of Oracle.