3

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?

2
  • 3
    Have you seen this wiki entry -> www-10.lotus.com/ldd/ddwiki.nsf/dx/… and www-10.lotus.com/ldd/ddwiki.nsf/dx/… Aug 30, 2013 at 6:31
  • 1
    Simple explanation: all code in NSF is in "virtual file system", which is not accessible for common Java frameworks working with file based access (source control, JUnit or JavaDoc...) You can sync your NSF via "Team Development" right-click menu (bundled in R9, need to install in 8.5.3), what synchronizes content of NSF to filesystem, and then you can run JUnits on mirrored Java project. Aug 30, 2013 at 8:48

2 Answers 2

2

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.

0
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.