Ant is a build tool which could be used to have your tests running either from command line or from Hudson CI tool. There is detailed documentation available for ant here but probably you need to know only a little part of it for you selenium tests. The essentials which are needed to know are:
And the ant file is -
You may also like to use mail task in your build file so that test report is emailed after test execution. You could find on mail task here
- Project
- Target (ant execution point and collection of tasks)
- Tasks (could be as simple as compilation)
- setClassPath - so that ant knows where you jar files are
- loadTestNG - so that you could use testng task in ant and use it to execute testng tests from ant
- init - created the build file
- clean - delete the build file
- compile - compiles the selenium tests
- run - executes the selenium tests
And the ant file is -
You may also like to use mail task in your build file so that test report is emailed after test execution. You could find on mail task here
Hi Tarun,
ReplyDeleteYour selenium blog is excellent ..it helps a lot. I have a query regarding with ANT and Selenium.Do you any idea how to execute ant selenium framework on different environments. In Maven, i use profiles to build the project on diff environment. Any idea with ANT?..Plz assist me.
Looks like this answers your questions -
ReplyDeletehttp://stackoverflow.com/questions/926238/ant-equivalent-of-maven-profiles
I have configured hudson to run my test cases by invoking ant.
ReplyDeleteBut after my test cases ran successfully, build doesn't stop. I have manually stop the build. Is there a way I can fix this issue?
Not sure if there is an issue with version of ant your are using.
ReplyDeleteI suppose you mean to say that target execution never reaches completion, right?
Could you post your question here - http://www.seleniumtests.com/p/testing-forum.html
with the detail of your build and the target which runs infinitely
Hi
Deleteyour blog is very useful for the selenium beginners.
I initially used ant to run my selenium RC and Webdriver test cases using firefox browser and worked fine. But after firefox version 11 the ant build.xml file is not at all launching the firefox browser. The same problem for chrome browser, it opens the browser but not getting the specified URL and for IE i am getting Eval method not available (issue 217)
Do you have any suggestion?
Hi,
ReplyDeleteYour blog was very much useful for Selenium beginners.
Initially I used to run my selenium Webdriver and Selenium RC test cases using Ant with firefox browser ( it worked initially well)but now ( after firefox version 11)my ant build.xml file is not at all launching the firefox browser. and if at all i try some times,it fails and i had to restart my machine to run the test in eclipse atleast. The same problem with chrome it opens the browser but not pointing to the mentioned URL and with IE I am getting the error
Eval method not found. only HtmlUnitDriver works under ant.
do you have anyy suggestion?
Thanks in advance.
Arun
Could you add more details to your question and post it here - http://www.seleniumtests.com/p/selenium-1-forum.html
DeleteQ1 How can I run selenium script using ANT on MAC?
ReplyDeleteQ2 What all changes I need to do in build.xml file which I have created for windows but needs to run on MAC.