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 philipp.dormeier@siemens.com » 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?

Image

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

Code: Select all
-Xmx8000M
-Xss1024K
-XX:PermSize=60M
-XX:MaxPermSize=200M
-Dosgi.framework.extensions=reference:${file_uri:${workspace_loc:/MagicDraw/MAGIC_DRAW_INSTALL_DIRECTORY/lib/bundles}}/com.nomagic.magicdraw.osgi.fragment
-Dosgi.bundlefile.limit=500
-DLOCALCONFIG=true
-Dmd.class.path="${project_classpath:MagicDraw with all plugins}"
-Dcom.nomagic.osgi.config.dir="${resource_loc:MagicDraw/MAGIC_DRAW_INSTALL_DIRECTORY}/configuration"
-Desi.system.config="${resource_loc:MagicDraw/MAGIC_DRAW_INSTALL_DIRECTORY}/data/application.conf"
-Dlogback.configurationFile="${resource_loc:MagicDraw/MAGIC_DRAW_INSTALL_DIRECTORY}/data/logback.xml"
-Dinstall.root="${resource_loc:MagicDraw/MAGIC_DRAW_INSTALL_DIRECTORY}"
-Dmd.plugins.dir="${resource_loc:MagicDraw/MAGIC_DRAW_INSTALL_DIRECTORY}/plugins;${workspace_loc}"


Thanks in advance for any help and suggestions!
philipp.dormeier@siemens.com
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

cron