Share this page

# TestNG code samples (Java SDK)

In this topic:

## Simple TestNG test

The following is an example of a Java test to be used together with the suite XML file below.

Only the methods specified in the XML file will be launched.

    @Test
    public void testIE() throws GeneralLeanFtException {
    	String url = "www.hpe.com";
    	Browser browser = BrowserFactory.launch(BrowserType.INTERNET_EXPLORER);
    	browser.navigate(url);
    }

Suite XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

    <suite name="suite1">
    	<test name="test1">
    	  <classes>
    		<class name="com.hp.leanft.examples.testng.SimpleTest">
    		<methods>
    			<include name="testIE"/>
    		</methods>
    		</class>
    	  </classes>
    	</test>
    </suite>

Back to top

See also:

- Parallel testing code samples (Java SDK)
- UFT Developer Java SDK Reference

Tips to improve your search results... UFT Developer Java SDK Reference Version 15.0-15.0.2 UFT Developer SDK Reference All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: