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
• 820 points
17 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
• 720 points

Related Questions In Selenium

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,001 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
65 views
0 votes
1 answer
0 votes
1 answer

How to write a test case in Selenium IDE?

Hey Sam, to write a test case ...READ MORE

answered May 13 in Selenium by Pratibha
• 2,520 points
5 views
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,030 points
75 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
448 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
56 views
0 votes
1 answer
0 votes
1 answer

How to auto-refresh the ChromeDriver using Selenium Webdriver?

You can use this command. Also, refresh ...READ MORE

answered May 10 in Selenium by Vaishnavi
• 720 points

edited May 10 by Omkar 32 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.