How do I pass a CLI argument to a Cucumber Java test suit?
up vote
1
down vote
favorite
I have a test suite that test my web service, I want to sent a custom IP as a CLI argument from maven to the test suite so instead of having a hard-coded IP like in the example below:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer("localhost", 5776);
serverConnection.open();
}
I want to have a variable IP like this:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer(IPArgumentFromMaven, 5776);
serverConnection.open();
}
java maven cucumber cucumber-jvm cucumber-java
add a comment |
up vote
1
down vote
favorite
I have a test suite that test my web service, I want to sent a custom IP as a CLI argument from maven to the test suite so instead of having a hard-coded IP like in the example below:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer("localhost", 5776);
serverConnection.open();
}
I want to have a variable IP like this:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer(IPArgumentFromMaven, 5776);
serverConnection.open();
}
java maven cucumber cucumber-jvm cucumber-java
2
You can probably do this by setting a system property - been a while since I used Maven, but maven.apache.org/surefire/maven-surefire-plugin/examples/… might help. Then you can use System.getProperty(...) in your Java code.
– BretC
2 hours ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a test suite that test my web service, I want to sent a custom IP as a CLI argument from maven to the test suite so instead of having a hard-coded IP like in the example below:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer("localhost", 5776);
serverConnection.open();
}
I want to have a variable IP like this:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer(IPArgumentFromMaven, 5776);
serverConnection.open();
}
java maven cucumber cucumber-jvm cucumber-java
I have a test suite that test my web service, I want to sent a custom IP as a CLI argument from maven to the test suite so instead of having a hard-coded IP like in the example below:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer("localhost", 5776);
serverConnection.open();
}
I want to have a variable IP like this:
@Before
public void server_connection() {
ConnectionToServer serverConnection = new ConnectionToServer(IPArgumentFromMaven, 5776);
serverConnection.open();
}
java maven cucumber cucumber-jvm cucumber-java
java maven cucumber cucumber-jvm cucumber-java
asked 2 hours ago
Gatito
213
213
2
You can probably do this by setting a system property - been a while since I used Maven, but maven.apache.org/surefire/maven-surefire-plugin/examples/… might help. Then you can use System.getProperty(...) in your Java code.
– BretC
2 hours ago
add a comment |
2
You can probably do this by setting a system property - been a while since I used Maven, but maven.apache.org/surefire/maven-surefire-plugin/examples/… might help. Then you can use System.getProperty(...) in your Java code.
– BretC
2 hours ago
2
2
You can probably do this by setting a system property - been a while since I used Maven, but maven.apache.org/surefire/maven-surefire-plugin/examples/… might help. Then you can use System.getProperty(...) in your Java code.
– BretC
2 hours ago
You can probably do this by setting a system property - been a while since I used Maven, but maven.apache.org/surefire/maven-surefire-plugin/examples/… might help. Then you can use System.getProperty(...) in your Java code.
– BretC
2 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416000%2fhow-do-i-pass-a-cli-argument-to-a-cucumber-java-test-suit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You can probably do this by setting a system property - been a while since I used Maven, but maven.apache.org/surefire/maven-surefire-plugin/examples/… might help. Then you can use System.getProperty(...) in your Java code.
– BretC
2 hours ago