Saturday, 7 March 2020

TestNG tutorial

      Introduction to TestNG
      Install TestNG plugin in Eclipse
      Setup TestNG Project in Eclipse
      Basic Annotations
            @Test: Write test case
      @Test: run testcases in alphabetical order
                  Ignore or disable test cases from execution
                  Skip test cases
                  Specify timeout for the testcase
                  invocationCount: Invoke test method given number of times
                  Run independent test method in parallel
            @BeforeClass: Execute this method before executing test cases
            @AfterClass: Execute this method before executing all test cases
            @BeforeMethod: Execute before every test case
            AfterMethod: Execute after every test case executed
            @BeforeSuite: Run before all the tests in this suite run
            AfterSuite: Run after all the tests in this suite ran
            Run Test suite from xml file
            BeforeTest and AfterTest annotations
            Specify timeout at suite level
      Exploring Assertions
      assertTrue: Assert condition is true
      assertFalse: Assert condition is false
      assertEquals: Assert equality
      assertNotEquals: Check inequality
      assertNull: Assert null value
      assertNotNull: Assert object is not null
      assertSame: Asserts that two references refer to the same object
      assertNotSame: Asserts that two objects are not refer to same object
      Hard Assertions
      Soft Assertions
      Prioritize test methods execution order
      dependsOnMethods: Specify dependent test cases
      dependsOnGroups: Test method can dependent on groups
      Execute test cases from specific group or groups
      Group of groups
      @DataProvider: Pass parameters to test cases
      Access data provider defined in other class
      Provide test input based on method name
      ITestResult: Describe result of a test
      Working with ITestListener
      successPercentage: Specify success percentage
      IExecutionListener: Monitor test starts and ends.
      surefire reports
      Run test cases using maven
      Run Tests in parallel
      Run test methods in parallel
      Run test classes parallel
      Run tests inside a suite in parallel
      Run test classes parallel
Previous                                                    Next                                                    Home

No comments:

Post a Comment