01: package test.parameters;
02:
03: /**
04: * @author Cedric Beust, Jul 22, 2004
05: */
06: public class ParameterSample {
07: /**
08: * @testng.configuration beforeTestMethod = "true" parameters="first-name"
09: * @param firstName
10: */
11: public void beforeTestDeprecated(String firstName) {
12: // System.out.println("[ParameterSample] Invoked beforeTestMethod with: " + firstName);
13: assert "Cedric".equals(firstName) : "Expected Cedric, got "
14: + firstName;
15: }
16:
17: /**
18: * @testng.test groups="singleString" parameters="first-name"
19: */
20: public void testSingleStringDeprecated(String firstName) {
21: // System.out.println("[ParameterSample] Invoked testString " + firstName);
22: assert "Cedric".equals(firstName);
23: }
24:
25: /**
26: * @testng.parameters value = "first-name"
27: * @testng.before-method
28: */
29: public void beforeTest(String firstName) {
30: // System.out.println("[ParameterSample] Invoked beforeTestMethod with: " + firstName);
31: assert "Cedric".equals(firstName) : "Expected Cedric, got "
32: + firstName;
33: }
34:
35: /**
36: * @testng.parameters value = "first-name"
37: * @testng.test groups="singleString"
38: */
39: public void testSingleString(String firstName) {
40: // System.out.println("[ParameterSample] Invoked testString " + firstName);
41: assert "Cedric".equals(firstName);
42: }
43: }
|