TestNG @Test Priority in Selenium (hard)
30 Questions
2 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which types of test designs does TestNG cover?

  • Unit test
  • Functional test
  • End to end test
  • All of the above (correct)

By default, what priority does TestNG assign to test cases when no priority is defined?

  • 1
  • No priority is assigned
  • 2
  • 0 (correct)

What is the scheduling order for test cases with different priorities in TestNG?

  • Lower priority first (correct)
  • Alphabetical order
  • Random order
  • Higher priority first

What is the purpose of setting priority in TestNG methods?

<p>To determine the execution order of test cases (C)</p> Signup and view all the answers

What is the recommended approach for writing code steps in TestNG?

<p>Write each step in separate methods (C)</p> Signup and view all the answers

What is the scenario described in the text?

<p>Performing a Google search with a specific keyword (A)</p> Signup and view all the answers

What types of test cases are covered in TestNG code?

<p>All of the above (D)</p> Signup and view all the answers

Which method in the TestNG_Priority_Annotations class is executed first?

<p>e_method (A)</p> Signup and view all the answers

What is the output of the TestNG_Priority_Annotations class when run?

<p>I'm in method E, I'm in method A, I'm in method D, I'm in method C, I'm in method B (B)</p> Signup and view all the answers

What is the output of the TestNG_Priority_Annotations class when the methods a_method and c_method have the same priority value?

<p>I'm in method A, I'm in method C (B)</p> Signup and view all the answers

Which method in the TestNG_Priority_Annotations class is executed last?

<p>b_method (A)</p> Signup and view all the answers

What is the output of the TestNG_Priority_Annotations class when the methods a_method and d_method have the same priority value?

<p>I'm in method A, I'm in method D (C)</p> Signup and view all the answers

What is the output of the TestNG_Priority_Annotations class when the methods b_method and c_method have the same priority value?

<p>I'm in method B, I'm in method C (A)</p> Signup and view all the answers

What is the output of the TestNG_Priority_Annotations class when the methods c_method, b_method, and a_method do not have priority values assigned?

<p>I'm in method B, I'm in method C, I'm in method A (D)</p> Signup and view all the answers

Which method is responsible for launching Google.com?

<p>launchGoogle (D)</p> Signup and view all the answers

What is the purpose of the method 'peformSeachAndClick1stLink'?

<p>To perform a search using 'Facebook' (D)</p> Signup and view all the answers

Why is the test case 'FaceBookPageTitleVerification' failing?

<p>There is a dependency on a previous test case (C)</p> Signup and view all the answers

What is the default order of execution of test methods in TestNG?

<p>Alphabetical order of their method names (B)</p> Signup and view all the answers

How can you set the priority of test methods in TestNG?

<p>By using the 'priority' parameter (D)</p> Signup and view all the answers

Which method has the highest priority in the 'Priority_In_testNG' class?

<p>launchGoogle (D)</p> Signup and view all the answers

What is the purpose of the method 'c_method' in the 'TestNG_Priority_Annotations' class?

<p>To print 'I'm in method C' (D)</p> Signup and view all the answers

Which syntax will result in a compilation error when defining priority in TestNG?

<p>@Test(PRIORITY=1) (B)</p> Signup and view all the answers

What is the purpose of using priority in TestNG?

<p>To define the order in which test cases should be executed (B)</p> Signup and view all the answers

What will happen if you don't specify a priority for a test case in TestNG?

<p>The test case will be executed randomly (C)</p> Signup and view all the answers

Which of the following is NOT a valid way to define priority in TestNG?

<p>@Test(priority='high') (D)</p> Signup and view all the answers

What is the consequence of not using the correct syntax for defining priority in TestNG?

<p>The test case will not be executed (C)</p> Signup and view all the answers

How can you ensure a specific execution order for a set of test cases in TestNG?

<p>By using the '@Test(priority=value)' annotation (A)</p> Signup and view all the answers

What is the recommended way to define priority in TestNG?

<p>@Test(priority=2) (C)</p> Signup and view all the answers

What is the purpose of using TestNG as a run tool?

<p>To execute test cases in a specific sequence (B)</p> Signup and view all the answers

What will happen if two test cases have the same priority value in TestNG?

<p>The test cases will be executed in the order they were defined (C)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser