Sometimes you might want to skip tests based on a condition. Following snippet shows a simple way to do it by throwing a testngSkipException. This integrates seamlessly with test reports and skipped tests are counted displayed correctly in it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//....code snippet..... | |
// Filter out bad tests | |
for (String c : conditions) { | |
if(c.matches("some condition 1") || c.matches("some other condition")){ | |
throw new org.testngSkipException(c); | |
} | |
} | |
//....code snippet..... |
No comments:
Post a Comment