To prevent spam users, you can only post on this forum after registration, which is by invitation. If you want to post on the forum, please send me a mail (h DOT m DOT w DOT verbeek AT tue DOT nl) and I'll send you an invitation in return for an account.

testing plug-ins

Wiebe
edited March 2011 in - Development
Hi all,

I want to test a plug-in outside the ProM 6.0 interface from a main method in a Java test class. (No JUnit, it's ad hoc testing.)
For this I need to execute a number of other plug-ins amongst which the log import plug-in.

The following compiles but does not work since the pluginContext is not initialized correctly, as well as many other things in the framework such as extension management.

CLIContext context = new CLIContext();
CLIPluginContext pluginContext = new CLIPluginContext(context, "test");
OpenLogFilePlugin olfp = new OpenLogFilePlugin();
XLog log = (XLog) olfp.importFile(pluginContext, inputLogFile);

Being able to test plug-ins this way would save much time.

Is there a proper way to test plug-ins without starting ProM 6.0?

Comments

  • Hi, 

    I have the exact same problem. I looked into this topic a while ago but had no time to dig deeper. So I played around the later day, but I couldn't figure out how to properly initialize all required components. Altough ProM tries to make use of a Plug-In architecture (which is quite nice) they pretty much mixed up "business logic" with other UI and other components.  

    I tought that it wouldn't be bad tough - mock up dependent but unused components (such as a progress bar). However, in the contexts it is not possible to set such custom made mock-ups. They are initialized differently. 

    I think thats the reason why there are no real unit tests. 

    Would be nice go get some feedback and suggestions from the developers. 

    I think it would be a plus to be able to access mining algorithms programatically to play around with them.

    Cheers!

    SJ
  • I know that one of the main reasons ProM 6.0 was developed almost from scratch is that the framework, ui and plug-ins would be decoupled.
    http://fluxicon.com/blog/2010/11/why-we-love-prom-6/

    I did find a way to filter a log using the filter class in the "Log" package: org.processmining.plugins.log.logfilters.LogFilter.java

    I used code from the log import and export plug-ins and had to create a dummy Process class for updating a progress bar. I attached both files. I would however still be easier to invoke plug-ins directly.

    I think you may have to execute a boot method in the org.processmining.framework.boot.Boot class using the CLIPluginContext class ("CLI" would be command line interface) and find your relevant plug-ins using the the PluginManager, but I am not sure what the exact setup should look like. I've gone back to testing plug-ins from the UI.

    Maybe a more seasoned ProM developer can give some clarity.
  • Hi, 

    I did almost the same thing now  - For the ProgressBar I created a MockUp. 

    But I changed the plugins that Im interested in (Alpha) so that whenever you hand in a context that is NULL, the required dependent Plugin is created directly. 

    Cheers!

    SJ
  • It should not be necessary (in an ideal world) to change the plug-ins.

    I will forward this issue to more seasoned ProM developers who will hopefully provide an answer/solution.
    Joos Buijs

    Senior Data Scientist and process mining expert at APG (Dutch pension fund executor).
    Previously Assistant Professor in Process Mining at Eindhoven University of Technology
  • Hi, 

    I saw that some plugins do it the right way. If you hand in NULL instead of a context there are IF statements that handle them which allows you to use just the "business logic" of the plugin without the "stuff" around it. 

    This is for instance not the case with AlphaMiner!

    SJ
  • Maybe this message about testing your ProM 6 plug-ins can also help you:
    http://www.win.tue.nl/promforum/discussion/96/prom-developers-test-cases-for-prom
    Joos Buijs

    Senior Data Scientist and process mining expert at APG (Dutch pension fund executor).
    Previously Assistant Professor in Process Mining at Eindhoven University of Technology
Sign In or Register to comment.