Vinoth
Vinoth

Reputation: 21

How to pass parameter from jenkins to selenium

I'm using jenkins and selenium.

I need to send the testing url to selenium server from jenkins.

Under General Tab

Jenkins String parameter: Name = APP, Default Value = http://localhost/basecode/

Under Post-build Actions

Trigger parameterized build on other projects -> Predefined parameters -> Parameters -> SEL_APP=$APP

Above mentioned SEL_APP value needs to be written in the selenium bat file.

Suggestions are most welcome :-)

Upvotes: 2

Views: 5869

Answers (3)

richard mendonca
richard mendonca

Reputation: 231

Use %parameter_name% in your bat file, it would directly pick it from Jenkins.

Upvotes: 0

KKK
KKK

Reputation: 121

If you are using maven then you can pass the parameters through maven command.

mvn clean test -Duser=value1 -Dpass=value2

If you are building the Jenkins job with parameters then you can use jenkins parameters in maven command as

clean test -Duser=$jenkinsparam1 -Dpass=$jenkinsparam1

jenkinsparam1 - Jenkins parameter while building a job.

In the code you can use them as

String s1 = System.getProperty("user");
String s2 = System.getProperty("pass");

Upvotes: 3

Suresh
Suresh

Reputation: 750

Use File Operations Plugin to create a bat file.

Add File Operations build step and with in it add File Create Operation. It creates the bat file with the contents provided in text area.

Upvotes: 0

Related Questions