Skip to main content



      Home
Home » Eclipse Projects » Kura » JUnit Tests with Kura(JUnit Tests with Kura)
icon3.gif  JUnit Tests with Kura [message #1645771] Mon, 02 March 2015 12:36 Go to next message
Eclipse UserFriend
Hi,

There is a way to create JUnit Tests and execute them using Services provided by Kura?

For example I want to create something like this:

@Test
public void testGetPrimaryMacAddress() {
String actual = sService.getPrimaryMacAddress();
System.out.println("MAC: " + actual);

Pattern regex = Pattern.compile("[0-9a-fA-F:]{12}");
java.util.regex.Matcher match = regex.matcher(actual);
assertEquals("getPrimaryMacAddress() length", 17, actual.length());
assertTrue("getPrimaryMacAddress() is string with colons", match.find());
}
/* ------------------------------------------
* --- NetworkService handlers ---
* ------------------------------------------ */
protected void setSystemService(SystemService sService){
this.sService = sService;
}
protected void unsetSystemService(SystemService sService){
this.sService = null;
}

Where SystemService is the Service included in Kura.


How can I do it?
Re: JUnit Tests with Kura [message #1648365 is a reply to message #1645771] Tue, 03 March 2015 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Yes, you can use JUnit to test your Kura bundles. Please see the below references. Let me know if you have questions after reviewing these items.

Kura Core test bundle: https://github.com/eclipse/kura/tree/develop/kura/org.eclipse.kura.core.test
Kura Example test: https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.core.test/src/main/java/org/eclipse/kura/core/test/ExampleTest.java
Kura NetworkService test: https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.core.test/src/main/java/org/eclipse/kura/core/test/NetworkServiceTest.java

Thanks,
--Dave
Re: JUnit Tests with Kura [message #1652482 is a reply to message #1648365] Thu, 05 March 2015 17:30 Go to previous message
Eclipse UserFriend
Ok. Thank you. I'll try as soon as I can.
Previous Topic:Error loading latest snapshot
Next Topic:Using JNI
Goto Forum:
  


Current Time: Fri Jul 04 14:09:38 EDT 2025

Powered by FUDForum. Page generated in 0.04896 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top