Selenium Integration in Builds

Hi All,

I have this scenario in place:

  1. I have checked in Selenium Java files (Test cases) into my usual build and they are getting compiled in .class files.

  2. I also have a build.xml which is used to run these tests. It basically has this:

RELEASE_ROOT this has been set to the Java Project folder.

o SRC which defines the source folder of the project

o LIB which defines the lib folder of the project

o BIN which defines the binary folder where the classes needs to be pasted after compiling

o REPORT folder which defines the report folder where the test execution reports will be generated.

  1. Now I want to integrate the tests as standard process of the builds.

All i have is a build.xml, java tests. How to achieve it? Thanks in advance

---------- Post updated at 06:14 PM ---------- Previous update was at 04:49 PM ----------

Any help guys?

---------- Post updated 08-13-13 at 09:51 AM ---------- Previous update was 08-12-13 at 06:14 PM ----------

Any Help?

Not sure what you are asking for.
It seems that you will have a complete solution on a big problem, you will not get that here.
Like I need help to create a rocket that take me to Mars and back, who to bild it, where to start etc.

What have you tried?

My code is on the server. I am not sure how to run the build.xml from UNIX box. I guess build.xml will invoke the browser and tests and hence a new report will be there.

I have attached my build.xml also.

Thanks

What build framework is being used ? Apache Ant ?

You could check this link
Running Selenium Tests - Wiki - Liferay.com

Thanks a lot rajamadhavan for this link. I will have a go through and keep posted for queries. Yes we are using apache ant for this.

Hi,

You can use Jenkins-ci to achieve this.

Jenkins CI

Hi

Yeah I am already using JENKINS for my regular builds. But as I understood after reading from net, jenkins Hudson plugin has automation only for HTML Recordings of Selenium. I have JAVA programs that run the test on a browser. If you have further info, can you please kindly share?

Thanks in Advance

Pls read this link

http://www.packtpub.com/sites/default/files/downloads/Integration\_with\_Other_Tools.pdf

1 Like

Hi

The link was very helpful and it was able to do most of the tasks.

If you see the build.xml :

  <target name="run">
                  <java jar="${RELEASE_ROOT}/lib/selenium-server-standalone-2.26.0.jar" fork="true">
  </target>            

I was trying to run the selenium jar before compiling or running the tests. However on Running the build.xml via ant .....it gets stuck and doesnt move to compile. :

Output of Bash:

bash-3.2$ ant -f /files0/nlae_dev_atg/environment_build/scripts/envbuild/build-selenium.xml run-batch-test
Buildfile: /files0/nlae_dev_atg/environment_build/scripts/envbuild/build-selenium.xml

run:
     [java] Loading EUNumberFormatProvider
     [java] Loading EUDecimalFormatSymbols
     [java] Aug 23, 2013 6:29:52 AM org.openqa.grid.selenium.GridLauncher main
     [java] INFO: Launching a standalone server
     [java] 06:29:52.606 INFO - Java: Sun Microsystems Inc. 20.4-b02
     [java] 06:29:52.608 INFO - OS: Linux 2.6.18-348.el5 amd64
     [java] 06:29:52.620 INFO - v2.26.0, with Core v2.26.0. Built from revision 18041
     [java] 06:29:52.758 INFO - RemoteWebDriver instances should connect to: OpenX
     [java] 06:29:52.760 INFO - Version Jetty/5.1.x
     [java] 06:29:52.761 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
     [java] 06:29:52.762 INFO - Started HttpContext[/selenium-server,/selenium-server]
     [java] 06:29:52.762 INFO - Started HttpContext[/,/]
     [java] 06:29:52.793 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@744a6cbf
     [java] 06:29:52.793 INFO - Started HttpContext[/wd,/wd]
     [java] 06:29:52.797 INFO - Started SocketListener on 0.0.0.0:4444
     [java] 06:29:52.798 INFO - Started org.openqa.jetty.jetty.Server@29173ef
bash-3.2$ ant -f /files0/nlae_dev_atg/environment_build/scripts/envbuild/build-selenium.xml run-batch-test
Buildfile: /files0/nlae_dev_atg/environment_build/scripts/envbuild/build-selenium.xml

run:
     [java] Loading EUNumberFormatProvider
     [java] Loading EUDecimalFormatSymbols
     [java] Aug 23, 2013 6:31:38 AM org.openqa.grid.selenium.GridLauncher main
     [java] INFO: Launching a standalone server
     [java] 06:31:39.072 INFO - Java: Sun Microsystems Inc. 20.4-b02
     [java] 06:31:39.073 INFO - OS: Linux 2.6.18-348.el5 amd64
     [java] 06:31:39.085 INFO - v2.26.0, with Core v2.26.0. Built from revision 18041
     [java] 06:31:39.199 INFO - RemoteWebDriver instances should connect to: OpenX
     [java] 06:31:39.200 INFO - Version Jetty/5.1.x
     [java] 06:31:39.201 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
     [java] 06:31:39.202 INFO - Started HttpContext[/selenium-server,/selenium-server]
     [java] 06:31:39.202 INFO - Started HttpContext[/,/]
     [java] 06:31:39.216 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@210a6ae2
     [java] 06:31:39.217 INFO - Started HttpContext[/wd,/wd]
     [java] 06:31:39.221 INFO - Started SocketListener on 0.0.0.0:4444
     [java] 06:31:39.221 INFO - Started org.openqa.jetty.jetty.Server@29173ef

Cananybody help me on this:

How to run a jar file from build.xml so that the corresponding server is started and then it performs next steps?

Can you close the tag and try ?

<target name="run">
                  <java jar="${RELEASE_ROOT}/lib/selenium-server-standalone-2.26.0.jar" fork="true">
</java>
  </target>            

Hi

Its still stuck after trying what you suggested. I guess I need to start it separately as a process. Any suggestions on this?

No, start server/run tests/stop server should work within the same ant script.

refer this link and see if you are missing anything while defining targets

Automating Selenium testing with TestNG, Ant and CruiseControl | Hedley Proctor