For example, sometimes I have tests that are operating system specific and don't necessarily make sense on other operating systems. Typically, I would do something like:
@Test
public void windowsSpecificTest() {
if ( System.getProperty("os.name").toLowerCase().contains("win") ) {
// do windows test
}
else {
LOGGER.warn("Test skipped because not on windows");
}
}
With the Assume class, you could do something like:
@Test
public void windowsSpecificTest() {
Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("win"));
// do windows test. if this is windows, the test will be ignored.
}
This isn't earth shattering, but it's another nifty little trick.
NIce Post, Thanks for sharing.
ReplyDelete-----------
.NET application Development