1 package test.issue107; 2 3 import org.testng.Assert; 4 import org.testng.annotations.Listeners; 5 import org.testng.annotations.Optional; 6 import org.testng.annotations.Parameters; 7 import org.testng.annotations.Test; 8 9 @Listeners(MySuiteListener.class) 10 public class TestTestngCounter { 11 12 public static final String PARAMETER_NAME = "key1"; 13 public static final String EXPECTED_VALUE = "zzz"; 14 15 @Parameters({PARAMETER_NAME}) 16 @Test testParameter(String key)17 public void testParameter(String key) { 18 Assert.assertEquals(key, EXPECTED_VALUE); 19 } 20 21 @Parameters({PARAMETER_NAME}) 22 @Test testParameterAsOptional(@ptional"Unknown") String key)23 public void testParameterAsOptional(@Optional("Unknown") String key) { 24 Assert.assertEquals(key, EXPECTED_VALUE); 25 } 26 } 27