Issue
I have a selenium project in Java using JUnit5. I have some suites and several tests with tags. I want to have a suite that runs all tests with both tags
An example of a suite is:
@SelectClasses(ScreenshotComparisonTests.class)
@IncludeTags({"CC"})
@ExcludeTags({"CASH", "FINANCIAL", "HACCP", "HRM", "INVENTORY", "OPERATIONS", "PURCHASING", "REPORTING"})
@Suite
@SuiteDisplayName("C User Menu Screenshots Comparison Tests")
public class CUserMenuScreenshotComparisonSuite {
}
But instead of listing all of the tags to exclude, I'd rather have something like:
@SelectClasses(ScreenshotComparisonTests.class)
@IncludeTags({"CC" & "USERMENU"})
@Suite
@SuiteDisplayName("C User Menu Screenshots Comparison Tests")
public class CUserMenuScreenshotComparisonSuite {
}
But intellij highlights that & as not allowed here. I have read that this is acceptable here https://junit.org/junit5/docs/current/user-guide/#running-tests-tag-expressions
Tried using:
- @IncludeTags("CC" & "USERMENU")
- @IncludeTags{("CC" & "USERMENU")}
- @IncludeTags{"CC" & "USERMENU"}
- @IncludeTags{("CC" && "USERMENU")}
java: bad operand types for binary operator '&'
first type: java.lang.String
second type: java.lang.String
Solution
Instead of
@IncludeTags({"CC" & "USERMENU"})
try
@IncludeTags({"CC&USERMENU"})
Answered By - johanneslink
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.