How can I run WebDriver script using Ant? - ant

I'm new to WebDriver. I have created data driven framework for Google calculator, Search, Sign in and sign up functionality with JUnit lib.
I want to run my script using Ant.
Below is the configuration for my environment:
OS: win8
Selenium-server-standalone-2.38.0.jar
Junit 4
Apache Ant 1.7
Please help.

Here are the steps to run it via ANT:
Check that you have ant installed in your system, properly. Open Command Prompt and type ant, if you have it installed perfectly it print in command prompt build.xml doesn't exist and/or Build failed
But if none of above messages displayed you need follow below steps:
1.1 Right Click My Computer icon and go to properties
1.2 Go to Advanced System Settings >> Advanced tab >> click Environment Variables under Start up and recovery
and create a new variable ANT_HOME and give ant directory path to it
1.3 Edit Path variable and add ant's bin directory path to it (do not add/remove path already present in their)<>See pictures below to set it properly:>
Once point one is done, go to your project's directory and open command prompt there (shift+right click will give option to open command prompt in working directory).
Now type ant "target name in your build.xml" example: ant run

Assuming you are aware of Ant you can run it through build.xml file.

Related

xjc with annox running from command prompt

I have tried to run a example from the website http://confluence.highsource.org/display/J2B/Annotate+Plugin#AnnotatePlugin-Activation. The very first schema provided in the webpage and I saved it as schema.xsd under c:\jaxb folder. Then, I ran the command 'xjc -extension schema.xsd' from command prompt and I get the similar error. Apparently xjc doesn't seem to understand this url http://annox.dev.java.net. How do I solve this?
You have to add the annotate plugin with all the dependencies to the classpath. See this Ant build file for what dependencies are
You have to activate the plugin using -Xannotate switch
Here's a sample Ant project. I'll assemble a command-line example for the next version.

workflow for xpages installation

I am trying to install prerequisties for workflow for xpages.I could not pass the below requirement. I installed ant, set the home pates, it works for a simple echo like "ant -build c:\test.xml"
Where is the setup folder to run "ant setup.activiti" command? it is not in ant"apache-ant-1.9.2" folder?
Make sure Apache Ant installed in the system, go to setup folder and run command(This
will download Activiti libraries needed in our project): ant setup.activiti
In setup there is the build.xml file ant uses. setup.activiti is a target inside that ant file. You only need to do that when you want to mess with the source build from source / contribute

Ant build tool installation not working properly!

i have downloaded the Ant distribution from the Ant web site.
apache-ant-1.7.0
and set environment variable specifying the location of the Ant installationas
ANT_HOME = C:\portal\apache-ant-1.7.0
PATH=;%ANT_HOME%\bin
But ant is not getting properly installed
Better use batch or shell scripts to start your ant files, f.e. =
windows
set JAVA_HOME=C:\java\jdk\1.6.0_xx
set ANT_HOME=C:\ant
set ANT_ARGS=-lib C:\ant_xtralibs;C:\ant_testlibs
set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;C:\cvsnt
:: default
call ant -f %1
:: debug
::call ant -debug -f %1
...
unix - don't forget the quotationmarks on the ANT_ARGS line !
...
ANT_ARGS="-lib /usr/local/ant_xtralibs:/usr/local/ant_testlibs"
export ANT_ARGS
...
Some advantages of starting ant like that :
ANT_ARGS is a special environment variable. Its content is automatically
added to the invocation of ant.
you may use your own ant settings on a machine where you have no admin rights
using a separate folder for your ant addon libs and load via -lib option
keeps your ant installation clean and avoids polluting the %ANT_HOME%/lib folder
Move the ';' to the end. Be sure that java is also correct installed (variable for classpath, etc.)
Depending on you verson of windows (win2k & win XP), you might need to reboot your computer to make your PATH modifications taken into account.

how do I use ant build to execute exportReleaseBuild task in Flash Builder 4

I'm trying to do an Ant build with FlashBuilder 4 for an Export Release Build. There is supposed to be a new (in FB4) ant task fb.exportReleaseBuild that will execute the release build. Reference to the usage is here:
http://help.adobe.com/en_US/flashbuilder/using/WSbde04e3d3e6474c4-59108b2e1215eb9d5e4-8000.html
When I include a target
..target name="exportRelease"
fb.exportReleaseBuild project="${flexproject}" ...
I generate an error indicating that the task can't be found:
Problem: failed to create task or type fb.exportReleaseBuild
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any presetde/macrodef declarations have taken place.
I look in flexTasks.jar and it doesn't include any flex.ant.exportReleaseBuild class despite having the latest jar.
Am I wrong in assuming I can run the exportReleaseBuild from an ant script?
You have probably solved this by now, but here's the answer in case someone else needs it.
The Ant compiler is telling you that it can't find the ExportReleaseBuild task. The reason is that when Ant is run from the IDE, it runs as a separate process to Flash Builder. When you run it from the command line it runs in the same process, which is why it works.
To get this to work in the IDE:
Open the build.xml file in Flash Builder
Go to Run -> External Tools -> External Tools Configuration...
Select Ant, then click the New Launch Configuration button
Enter a name for the build task
Select the Main tab:
Browse to the location of the build file
Browse to the location of the workspace
Select the JRE tab, then tick "run in the same JRE as this Workspace" (see image below)
Click Apply, then click Run
In future you can run the the task using the icon on the toolbar:
Just came across this situation myself, and after tweeting w/ #renaun (his blog post has some info as well: http://renaun.com/blog/2010/09/command-line-build-a-flash-builder-4-premium-feature/), it's pretty much useless for a CI build, unless you want to install FB4 premium, you can't run this task.
I was able to get it to run on my OSX environment by following the Adobe docs for it, but it doesn't mention that you have to basically run it from the command line tool. The ant that is installed as a plugin w/ the premium version has an importexport-ant.jar that is being referenced by Eclipse (standalone or plugin).
The only way I got it to run was via cmd line/terminal. It is tedious, and not really useful for a CI build. I did try to just grab the jar file, place it in the right spot, reference that in my ant script and build directly, but that made my compiler angry :(
I think I cracked it by setting up a shell script, and calling the shell script from an ant task.
This way you * are * using the headless Flash Builder modus, from within Flash Builder.
Full working example at:
https://gist.github.com/1077715
Thanks for the link lordB8r, that one got me thinking : )

Installing Ant on Cygwin

I'm having some trouble figuring out how to install Ant on Cygwin. I want to use Ant to build Nutch. I've looked through a bunch of tutorials but I can't find anything that is low level enough for me to understand. I need something like...
Download ant, put it here
Open Cygwin
type "export ANT_HOME=..."
...
Can anyone help me out here?
Assuming you have a JDK already installed, you can do this:
$ export ANT_HOME=/cygdrive/c/apache-ant-1.7.1
which assumes you've unzipped Ant into C:\apache-ant-1.7.1. Then:
$ export PATH=$ANT_HOME/bin:$PATH
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
In Windows, add the path to your ant /bin directory to the Path system variable. This can easily be done by right clicking on Computer > Properties > Advanced System Settings > Environment Variables, click on Path in the System Variables, click on Edit and add ; followed by the path to your ant bin directory to the end of the Variable value.
Start or restart Cygwin.
Type ant -version The version should be displayed.
Here's a step-by-step guide:
simply download and unzip ANT binaries say into c:\apache-ant-1.8.1
download and unzip NUTCH sources say into: c:\apache-nutch-1.2
open the command prompt and run the following:
cd c:\apache-nutch-1.2
c:\apache-ant-1.8.1\bin\ant
the same would work from the Bash shell, just use Cygwin-style paths:
cd /cygdrive/c/apache-nutch-1.2
./cygdrive/c/apache-ant-1.8.1/bin/ant
That's it, you will find a new directory build containing the output.
For convenience, you might want to add the Ant bin directory to the PATH environment variable so that you don't have to give the full path each time, but that's optional.
BTW I just did those exact steps, and all went fine.
Finally, follow this tutorial to get started.

Resources