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 are launched.

    @Test
    public void testIE() throws GeneralLeanFtException {
    	String url = "www.mysite.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)
- Java SDK

https://admhelp.microfocus.com Functional Testing for Developers 8942
Tips to improve your search results... OpenText™ Functional Testing for Developers Help Center OpenText™ Functional Testing for Developers Help 25.2 All View Local Help Center View Online Help Center Version: