Classpath error during JUnit Test - Normal execution works

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Classpath error during JUnit Test - Normal execution works

Postby » Tue May 04, 2021 1:03 am

Hello together,

I am currently developing a Plug-In for MagicDraw 19.0 in Eclipse Oxygen 4.7.1.
As the code got more complex, the ability to at least Unit Test the Plug-In became more important.

My first question is: Should it be possible to simply run JUnit by right-clicking in Eclipse and the choosing "Run As > JUnit Test"? Or do we always have to start the whole MagicDraw Application (which takes an uncomfortable amount of time for quickly engineering JUnit test cases)?
In the last case: can we keep a MagicDraw instance running and re-run JUnit tests much faster using this instance?

The provided example project "My Plugin 1" together with "My Plugin 1 Test" does fail with a NoClassDefFoundError but at least starts executing (with the inconvenience of completely starting up MD even for the tiniest Unit test).

My actual question is the following - when trying to unit test a class with "JUnit Test" (not "JUnit Plug-In Test") I get the following error in eclipse even though the patch.jar is there and the Plug-In works fine when executed outside of JUnit test. How can I fix that?


The corresponding Run Configuration has the same VM arguments as the "Start MagicDraw with all Plugins.launch" file:

Code: Select all
-Dmd.class.path="${project_classpath:MagicDraw with all plugins}"

Thanks in advance for any help and suggestions!
Forum Newbie
Forum Newbie
Posts: 1
Posts Rating:0
Joined: Tue May 04, 2021 12:39 am

Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 1 guest