Bird
0
0

You want to run tests that belong to both 'smoke' and 'regression' groups together. How should you configure your TestNG XML to achieve this?

hard📝 framework Q8 of 15
Selenium Java - TestNG Integration
You want to run tests that belong to both 'smoke' and 'regression' groups together. How should you configure your TestNG XML to achieve this?
ARun tests without specifying groups; all tests will run
BUse two <include> tags inside <run>: one for 'smoke' and one for 'regression'
CUse <exclude> tags for all other groups except 'smoke' and 'regression'
DUse a single <include> tag with name="smoke,regression"
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to include multiple groups

    TestNG XML allows multiple <include> tags inside <run> to specify multiple groups.
  2. Step 2: Identify correct XML usage

    Using two <include> tags for 'smoke' and 'regression' runs tests in either group.
  3. Final Answer:

    Use two <include> tags inside <run>: one for 'smoke' and one for 'regression' -> Option B
  4. Quick Check:

    Multiple groups = multiple <include> tags [OK]
Quick Trick: Include each group separately inside to run multiple groups [OK]
Common Mistakes:
  • Combining group names in one include tag
  • Using exclude instead of include
  • Running all tests without filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes