0
0
Selenium Javatesting~10 mins

Test groups in Selenium Java - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign the test to the group named "smoke".

Selenium Java
@Test(groups = {"[1]"})
public void testLogin() {
    // test code here
}
Drag options to blanks, or click blank then click option'
Asmoke
Bperformance
Cintegration
Dregression
Attempts:
3 left
💡 Hint
Common Mistakes
Using a group name that does not match the test purpose.
Forgetting to put the group name inside quotes.
2fill in blank
medium

Complete the code to run only tests in the "regression" group using TestNG XML.

Selenium Java
<suite name="Suite1">
  <test name="Test1">
    <groups>
      <run>
        <include name="[1]"/>
      </run>
    </groups>
    <classes>
      <class name="tests.LoginTest"/>
    </classes>
  </test>
</suite>
Drag options to blanks, or click blank then click option'
Asmoke
Bintegration
Cregression
Dperformance
Attempts:
3 left
💡 Hint
Common Mistakes
Using a group name not defined in the tests.
Forgetting to include the tag inside .
3fill in blank
hard

Fix the error in the TestNG XML to exclude the "performance" group.

Selenium Java
<suite name="Suite2">
  <test name="Test2">
    <groups>
      <run>
        <exclude name="[1]"/>
      </run>
    </groups>
    <classes>
      <class name="tests.PaymentTest"/>
    </classes>
  </test>
</suite>
Drag options to blanks, or click blank then click option'
Aperformance
Bregression
Csmoke
Dintegration
Attempts:
3 left
💡 Hint
Common Mistakes
Using instead of to exclude groups.
Misspelling the group name.
4fill in blank
hard

Fill both blanks to assign the test to both "smoke" and "regression" groups.

Selenium Java
@Test(groups = {"[1]", "[2]"})
public void testCheckout() {
    // test code here
}
Drag options to blanks, or click blank then click option'
Asmoke
Bregression
Cperformance
Dintegration
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put group names inside quotes.
Using only one group name when multiple are needed.
5fill in blank
hard

Fill all three blanks to create a TestNG XML that runs "smoke" and "regression" groups but excludes "performance".

Selenium Java
<suite name="Suite3">
  <test name="Test3">
    <groups>
      <run>
        <include name="[1]"/>
        <include name="[2]"/>
        <exclude name="[3]"/>
      </run>
    </groups>
    <classes>
      <class name="tests.OrderTest"/>
    </classes>
  </test>
</suite>
Drag options to blanks, or click blank then click option'
Aperformance
Bsmoke
Cregression
Dintegration
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up include and exclude tags.
Using wrong group names or misspelling them.