-1

-------------------- Test that needs to be run----------------

@org.testng.annotations.Test(groups = { "Regression" },parameters = {"environment"})

  public void As_a_User_I_can_Login_to_System(String environment){

       Users user = new Users("SID_SMITH");

      String name = loginHandler.success_login(user);

      System.out.print("Environment" + environment);

      Assert.assertEquals(name, user.getUserFullName(), "Success");

  }

I want to run above test by passing variable environment as input from shell script. Kindly give a guidance

geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
Ted87
  • 81
  • 8
  • Note that `parameters` is deprecated and you should use [`@Parameters`](https://jitpack.io/com/github/cbeust/testng/master-6.12-g317a92d-133/javadoc/index.html) – assylias Oct 23 '17 at 10:35

1 Answers1

0

You can run your test from shell using following command

mvn clean test -Dtest={testName} -Dgroups={groupName} -Denv={envname}

You can run multiple test by specifying test name separated by comma

mvn clean test -Dtest={test1},{test2}
Zak
  • 101
  • 3