0
0
Selenium Javatesting~10 mins

TestNG default reports 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 import the TestNG annotation for test methods.

Selenium Java
import org.testng.annotations.[1];
Drag options to blanks, or click blank then click option'
ATestCase
BTestAnnotation
CTestMethod
DTest
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect annotation names like @TestCase or @TestMethod.
Forgetting to import the annotation.
2fill in blank
medium

Complete the code to define a simple TestNG test method.

Selenium Java
@[1]
public void sampleTest() {
    System.out.println("Test running");
}
Drag options to blanks, or click blank then click option'
ATestCase
BTest
CTestMethod
DTestAnnotation
Attempts:
3 left
💡 Hint
Common Mistakes
Using @TestCase or other incorrect annotations.
Missing the @ symbol before the annotation.
3fill in blank
hard

Fix the error in the TestNG test method to enable default reporting.

Selenium Java
@Test
public void testMethod() {
    int expected = 5;
    int actual = 3 + 2;
    Assert.[1](expected, actual);
}
Drag options to blanks, or click blank then click option'
AassertEquals
BassertTrue
CassertFalse
DassertNull
Attempts:
3 left
💡 Hint
Common Mistakes
Using assertTrue with two arguments causes errors.
Using assertNull when values are not null.
4fill in blank
hard

Fill in the blank to create a TestNG test that fails and logs a message.

Selenium Java
@Test
public void testFailure() {
    Assert.[1]("test failed");
}
Drag options to blanks, or click blank then click option'
Afail
BassertTrue
CassertFalse
DassertEquals
Attempts:
3 left
💡 Hint
Common Mistakes
Using assertTrue(false) instead of fail() to fail a test.
Not providing a failure message.
5fill in blank
hard

Fill all three blanks to create a TestNG test with a priority and description.

Selenium Java
@Test(priority = [1], description = "[2]")
public void testPriority() {
    Assert.[3](true);
}
Drag options to blanks, or click blank then click option'
A1
BThis test checks priority
CassertTrue
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using priority as a string instead of a number.
Missing the description string.
Using assertFalse(true) which fails the test.