30 Questions
Which programming language is used in the code example?
Java
How many test cases are created in the code example?
5
What is the purpose of the 'groups' parameter in the code example?
To group related test cases
Which group is the second test case tagged to?
both strong_ties and bonding
What happens if the XML is updated with the 'strong_ties' group name?
Only the second test case will run
Which scenario involves removing the 'Group' tag from the running XML?
Scenario 1
Which scenario uses the exclude mechanism to exclude a test case?
Scenario 3
How many test cases are included in Scenario 4?
3
What is the purpose of the 'include' test mechanism?
To include specific test cases
What programming framework is used in the code example?
TestNG
Which type of tests does TestNG cover?
All of the above
How can you run single or multiple packages in TestNG?
By creating XML and running it through Maven
When do we use groups in TestNG?
When we want to ignore some test cases
What are the mechanisms supported in TestNG for grouping test cases?
Include and exclude
How do you define groups in TestNG?
@Test(groups = {})
What is the purpose of the 'include' mechanism in TestNG?
To include specific test cases in the execution
What is the purpose of the 'exclude' mechanism in TestNG?
To exclude specific test cases from the execution
What is the syntax for defining groups in the XML file for TestNG?
@Test (groups = {})
How many group names are used in the given example?
2
What are the logical names for groups in TestNG?
Logical names that can be altered
Which tag is used to define the starting of groups in XML?
What is the purpose of the TestNG XML file in the Maven framework?
To store information about one or more tests
Which tag is used to exclude a test in TestNG XML?
What is the purpose of the 'tc01LaunchURL()' method in the TC_Class1 Java class?
To initialize the browser and launch a URL
Which element is used to locate the password field on the login form?
password_element
What is the value of the 'userName_value' variable in the TC_Class1 Java class?
mngr28642
Which method is used to verify the presence of Manager ID on the user dashboard?
tc04VerifyLoggedInPage()
What is the purpose of the 'Assert.assertTrue()' method in the TC_Class1 Java class?
To verify the home page heading is displayed
What is the purpose of the 'webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);' code in the TC_Class1 Java class?
To set the implicit wait time for web element identification
What is the purpose of the 'final' keyword in the TC_Class1 Java class?
To declare a constant variable
Study Notes
TestNG Framework
- TestNG is a programming framework used for testing, specifically for Java language
- Two test cases are created in the code example
Groups in TestNG
- The 'groups' parameter is used to categorize test cases into logical groups
- The second test case is tagged to the 'strong_ties' group
- If the XML is updated with the 'strong_ties' group name, the test case will be included in that group
- Removing the 'Group' tag from the running XML will remove the grouping for test cases
- Scenario 2 involves removing the 'Group' tag from the running XML
- Scenario 3 uses the exclude mechanism to exclude a test case
- Four test cases are included in Scenario 4
Mechanisms in TestNG
- The 'include' test mechanism is used to include test cases in a group
- The 'exclude' test mechanism is used to exclude test cases from a group
Defining Groups in TestNG
- Groups are defined using the '@Test' annotation with the 'groups' parameter
- The purpose of groups is to categorize test cases and run them selectively
- Two group names are used in the given example: 'strong_ties' and 'weak_ties'
- Logical names for groups in TestNG are descriptive names that indicate the purpose of the group
- The '' tag is used to define the starting of groups in XML
TestNG XML File
- The purpose of the TestNG XML file in the Maven framework is to configure test suites and test cases
- The '' tag is used to exclude a test in TestNG XML
TC_Class1 Java Class
- The 'tc01LaunchURL()' method is used to launch a URL
- The 'element' is used to locate the password field on the login form
- The value of the 'userName_value' variable is not specified
- The 'verifyManagerIDOnDashboard()' method is used to verify the presence of Manager ID on the user dashboard
- The 'Assert.assertTrue()' method is used to verify the presence of Manager ID on the user dashboard
- The 'webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);' code is used to set an implicit wait time of 20 seconds
- The 'final' keyword is used to declare a variable that cannot be changed once assigned
TestNG Groups - Include & Exclude (Example) is a quiz that tests your knowledge on using TestNG's grouping feature to include and exclude specific test cases. This quiz covers topics such as creating XML configurations, running single or multiple packages, and organizing tests based on different test designs. TestNG is a popular testing framework used for unit, functional, end-to-end, UI, and integration tests.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free