Configure JUnit + CI pipelines for LBR iiwa project

  • We are currently working with KUKA LBR iiwa arm to develop and test different complex concepts. While working with KUKA Java API is in general not as bad as it might have been (despite no documentation at all ...), testing all the code on the hardware is really slowing us down. My question is: how to appropriately write unit tests (preferably with JUnit + some mocking framework) for KBR iiwa project and how to execute them?


    I have already noticed, that in Sunrise Workbench it is possible to create a new "JUnit Test Case/Suite", but I guess that it is possible only because of Eclipse backend. In the Workbench itself I can find no way of actually running the written apps (unit tests especially). Unless you synchronize your project with the robot and then run it on hardware - but this is not what I look for.


    Since it is Java, I thought that it should be possible to just compile the particular class by hand and then just run it locally, but then again I encountered a lot of linking problems, even though my classpath seems to be correct. Example:


    (yeah ... unfortunately on Windows, but Sunrise doesn't seem to work on anything else)

    Code
    javac -cp "src;KUKAJavaLib\*.jar;ROSJavaLib\*.jar" src\examplePackage\exampleApp.java


    executed from the root project directory fails to compile, because it doesn't find any packages that are inside com.kuka.roboticsAPI (not only):


    Code
    src\examplePackage\exampleApp.java:9: error: package com.kuka.roboticsAPI.applicationModel does not exist
    import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication;


    Of course, in the considered directories I Have the appropriate file: com.kuka.roboticsAPI_1.15.1.8.jar


    Now, even IF I would finally figure out how to compile and execute the simple unit test, I would like to know how to write my KUKA application to actually be testable, which doesn't really seem to be a trivial case. I ask that, because in the KUKA Java API most of the major classes that I use to control the robot does not have any interfaces, therefore cannot be mocked. Perhaps I just didn't look close enough (reminder: there is no documentation to the API, apart from not really descriptive javaDocs), but for now I was only able to find the concrete classes to be used. Example:


    I would like to use some methods from this class:

    Code
    public abstract class com.kuka.roboticsAPI.deviceModel.LBR extends com.kuka.roboticsAPI.deviceModel.Robot implements com.kuka.roboticsAPI.deviceModel.ITorqueSensitiveRobot, com.kuka.roboticsAPI.deviceModel.IForceSensitiveRobot


    but couldn't find any interface (or multiple interfaces) that will cover the basic functionalities. LBR itself cannot be mocked of course - even though it's abstract.


    I would appreciate any answers/comments on this topic. Unit-testing the robotic applications seems like "must-be" and I am really surprised that Sunrise doesn't offer any obvious way for it.

Advertising from our partners