How to pass parameters to a Junit test case from the Ant build tool?

0 votes
I'm using JUnit under Ant to execute my Selenium test cases. My test cases need to read the files which contain some test data. I don't mind having the files names embedded in the test cases, but I'd like to have the name of the directory where the data files are stored in the build.xml file.

What's the best way to pass information like that from a build.xml file down into the test cases? Is it a good idea to use the ant property here? Is it possible to inject the Junit4 parameter from the build.xml file?
Mar 6 in Selenium by Surya
• 860 points
28 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The JUnit task accepts nested system property elements.

<junit fork="no">
  <sysproperty key="mydatadir" value="${some piece of }"/>
  ...
</junit>

You can access these from within the tests using System.getProperty().

answered Mar 6 by Vaishnavi
• 860 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to run Selenium test case file from command line?

You’ll need Selenium RC for this: http://seleniumhq.org/download/  And the ...READ MORE

answered Apr 23, 2018 in Selenium by Vardy
• 2,280 points
2,178 views
0 votes
1 answer

How to get the text from a website using selenium?

hey, you can use get.text() method to ...READ MORE

answered Dec 31, 2018 in Selenium by Sudhanshu
106 views
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
130 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
519 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
118 views
0 votes
1 answer
0 votes
1 answer

How to get the WebDriver version during test run?

Hi friend, It is possible by reading the VERSION.txt ...READ MORE

answered May 28 in Selenium by Vaishnavi
• 860 points
11 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.