Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 17:36 Go to next message
Gianvito Morena is currently offline Gianvito MorenaFriend
Messages: 4
Registered: March 2015
Junior Member
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 22:18 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
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 22:30 Go to previous message
Gianvito Morena is currently offline Gianvito MorenaFriend
Messages: 4
Registered: March 2015
Junior Member
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 Apr 26 08:32:59 GMT 2024

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

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

Back to the top