30 Questions
Which method in the code initializes the Firefox browser?
openBrowser
Which method in the code launches the Google.com website?
launchGoogle
Which method in the code performs a search using the term 'Facebook'?
peformSeachAndClick1stLink
Which method in the code verifies the Google search page title?
FaceBookPageTitleVerification
What is the reason for the test cases failing in the code?
Failure to pass dependencies
What is the default order of execution for @Test methods in TestNG?
Alphabetical order
How can the execution order of @Test methods be controlled in TestNG?
By setting priorities
Which types of test designs does TestNG cover?
Unit test, functional test, end to end test, UI test and integration test
What priority does TestNG assign to @Test if not defined?
Zero (0)
Which test cases will be scheduled first when running multiple test cases with TestNG?
Lower priorities
What is the purpose of setting priority in TestNG methods?
To specify the order in which the methods should be executed
In the given scenario, what is the expected result of the test case?
Browser title should be changed to "Facebook – Google Search"
What should each step of the code be in the given scenario?
Separate methods
What is the purpose of Method 2 in the given scenario?
To launch Google
Which annotation is used to define the priority of a test case in TestNG?
@Test(priority=4)
What will happen if you define the priority of a test case using a different syntax?
It will show a compilation error
What is the purpose of using priority in TestNG?
To define the order in which test cases are executed
Which of the following is a standard syntax for defining the priority in TestNG?
@Test(priority=4)
What will happen if you don't specify the priority of a test case in TestNG?
It will run the test case in default order
Can you use any value for the priority of a test case in TestNG?
Yes, you can use any value
What will happen if two test cases have the same priority in TestNG?
The order of execution will be based on the order of test case declaration
Is it possible to change the priority of a test case at runtime in TestNG?
No, the priority cannot be changed once defined
What is the conclusion regarding running a set of test cases in a specific sequence using TestNG?
It can be easily done using priority in TestNG
Which annotation is used to assign priority to test cases in TestNG?
@Test
What is the output of the code snippet in the first example?
PASSED: openBrowser PASSED: launchGoogle PASSED: peformSearchAndClick1stLink PASSED: FaceBookPageTitleVerification
What is the purpose of assigning priorities to test cases in TestNG?
To specify the order in which test cases should be executed
What happens when two test cases have the same priority value in TestNG?
The test cases are executed in alphabetical order of their method names
What is the output of the code snippet in the second example?
I'm in method E I'm in method D I'm in method A I'm in method C I'm in method B
What is the output of the code snippet in the third example?
I'm in method B I'm in method C I'm in method E I'm in method A I'm in method D
What is the purpose of the @Test annotation in TestNG?
To define a test case
Study Notes
TestNG Summary
TestNG Methods
- The
WebDriver
method initializes the Firefox browser. - The
get
method launches the Google.com website. - The
findElement
method performs a search using the term 'Facebook'. - The
getTitle
method verifies the Google search page title.
TestNG Execution
- The default order of execution for
@Test
methods in TestNG is alphabetical. - The execution order of
@Test
methods can be controlled in TestNG by assigning priority using thepriority
attribute.
TestNG Priority
- TestNG assigns a priority of 0 to
@Test
if not defined. - Test cases with lower priority values are scheduled first when running multiple test cases.
- The purpose of setting priority in TestNG methods is to control the execution order.
- The
priority
attribute is used to define the priority of a test case in TestNG.
TestNG Test Cases
- The expected result of a test case depends on the test scenario.
- Each step of the code should be a separate
@Test
method in the given scenario. - The purpose of Method 2 in the given scenario is to perform a specific action.
TestNG Syntax
- The standard syntax for defining the priority in TestNG is
@Test(priority = value)
. - If you don't specify the priority of a test case in TestNG, it will be assigned a priority of 0.
- You can use any positive integer value for the priority of a test case in TestNG.
- If two test cases have the same priority in TestNG, they will be executed in alphabetical order.
- It is not possible to change the priority of a test case at runtime in TestNG.
TestNG Conclusion
- Running a set of test cases in a specific sequence using TestNG requires assigning priority to test cases.
- The
@Test
annotation is used to assign priority to test cases in TestNG. - The purpose of assigning priorities to test cases in TestNG is to control the execution order.
- When two test cases have the same priority value in TestNG, they will be executed in alphabetical order.
- The output of the code snippets depends on the specific test scenario.
- The
@Test
annotation in TestNG is used to define a test case.
Facebook Search and Page Verification Quiz: Test your knowledge of performing searches on Facebook and verifying page titles. Learn how to use xpath and verify search results. Challenge yourself with different scenarios and improve your skills in navigating Facebook.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free