Testing / Karate Framework Interview questions
How does the Karate Runner decide which features and tags to execute?
The Runner determines what to run based on a combination of the classpath/path expression given, an optional tag expression, and any additional filtering configured on the run.
Karate testSuite() { return Karate.run("classpath:tests") .tags("@regression", "~@wip") .parallel(50); }
The path expression (classpath:tests above) determines which directory of feature files is even considered. The tag expression then filters within that set: "@regression" includes only scenarios tagged with it, while "~@wip" excludes anything tagged @wip, and multiple tag expressions are combined together (typically as AND logic across the listed expressions, with each individual expression itself potentially containing OR logic).
Scenarios with no matching tag simply don't run under a tag-restricted execution, which is what makes it practical to keep work-in-progress or environment-specific scenarios in the same codebase as the rest of the suite without them accidentally executing in contexts where they shouldn't.
More Related questions...