TestNG Tutorial

testng tutorials

TestNG (Next Generation) is a testing framework which, inspired by JUnit and NUnit, but introducing many new innovative functionality like dependency testing, grouping concept to make testing more powerful and easier to do. It is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc…

1. TestNG Tutorials

References

  1. TestNG Official Website

17 comments on “TestNG Tutorial

  1. I just want to test file read class with buffered reader. How can I do that?

    Reply
  2. Hi MKYong,

    Here is my scenario

    In My frame work i have “N” Number of test cases. i have one driver class which will controls all the test scripts.

    I need to loop through all these testcases until the last test case(Data driven Frame Work using POI).

    My condition is :

    in my driver script if i am clicking on run then it need to go to the loop and check for the first test case and need to navigate to the first test script and need to execute the first script. once the 1st script completed it need to come to the loop again and need to execute the second script ……like this till end it need to complete all the test scripts.

    Here is my loop. it is iterating but it not going to my test script.
    for (int i=2; i <= Sheet.getLastRowNum(); i++)
    {
    if(trueTest.equals(Sheet.getRow(i).getCell(1).getBooleanCellValue()))
    {
    System.out.println(Sheet.getRow(i).getCell(1).getBooleanCellValue());
    String envKey = Sheet.getRow(i).getCell(3).toString();
    String browser = Sheet.getRow(i).getCell(4).toString();
    if(browser.equals("FF"))
    {
    driver = new FirefoxDriver();
    }
    else if(browser.equals("IE"))
    {
    System.setProperty("webdriver.ie.driver", "D:\GCCOM_FRAMEWORK\Drivers\IEDriverServer.exe");
    driver=new InternetExplorerDriver();
    }
    else
    {
    browser.equals("CHROME");
    {
    System.setProperty("webdriver.chrome.driver", "D:\GCCOM_FRAMEWORK\Drivers\chromedriver.exe");
    driver = new ChromeDriver();
    }
    }
    String url = environmentURLMap.get(envKey);
    driver.get(url);
    }
    }
    }
    }

    Please suggest me with some code

    Reply
  3. How to proceed for API testing using TestNG ?

    Reply
  4. hai..this Tutorial very helpful for me..but i dn know how to do compatibility testing in testNG so pls help me..

    Reply
  5. That said: TestNG has so many bugs and few of them are getting fixed. I generally recommend to not use TestNG if it is not absolutely required.

    Reply
    1. What kind of bugs? I’m implemented in my projects, don’t find any major flaws.

      Reply
  6. Can you please explain the working of TestNG with Listeners & Reporters and XSLT Reports.

    Reply
  7. Hi mkyong, how to mock database with testng .. Am using struts2 framework .. Really got stuck .. Please do guide me ..

    Reply
  8. can u send the webdriver testcase for validation of registration page.(contains dropdown,editbox,radiobuttons,listbox,buttons.)

    Reply
  9. Thank you for this tutorial – quick and effective. This is exactly what I was looking for.

    Reply
  10. Hi yong,

    what is the best api for mock testing with testNG?

    Thanks,
    Manoj

    Reply
  11. I was using TestNG for running my Silk4J tests. I was able to run the individual tests, but while running as a suit i am facing some issues.

    While running as a suit, the methods in the @BeforeMethod and @AfterMethod sections are not working… What might be the reason for this…

    Reply
  12. Can testNG provide the output of on an ANDROID EMulator connected to Eclipse?

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *