Question

I do the following:

  1. From the Package Explorer I select "New, Other, JUnit Test Case"
  2. I write this code:

    package dk.sample;
    
    import org.junit.*;
    import static org.junit.Assert.*;
    
    public class TestCase {
    
        @Test
        public void alwaysTrue(){
            assertTrue( true );
        }
    
    }
    
  3. I then select "Run As, JUnit test"

  4. Get this error: "Class not found dk.sample.TestCase java.lang.ClassNotFoundException: ...."

What do I miss? Have tried with different Run Configurations - but it seems like I miss a classpath somewhere? But to what and where?

Was it helpful?

Solution

To make JUnit work within Domino Designer you need to perform few additional steps:

  1. set up source control for your application
  2. adjust the on-disk project to be recognized as Java application
  3. run JUnit tests within your on-disk project

Please note that java agents have to be tested in a different way..

You can find more detailed explanation about enabling JUnit for both XPages and Agents in the following blog post: Unit Tests for Lotus Domino Applications

Here's also a great how-to on this topic.

OTHER TIPS

Coundn't get JUnit to work inside the Domino Designer. Instead of running the tests from DDE, I now run the tests from a XPages. This works like a dream. Made my own 'JUnit runner' class - that is, I just call the JUnit runners but handles the result my self in order to display it as html on the XPage.
Code can be found here: http://xpages.dk/wp-content/uploads/2013/10/junitrunner.txt
Danish blog post here: http://xpages.dk/?p=1162

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top