Jenkins Error : SVN Checkout Error || java.io.IOException || java.nio.file.FileSystemException

Beginner Level Users of Jenkins might face a common svn checkout error time and again like this :-

SVN_Error_Jenkins

On seeing the console… you find the following error message – “The process cannot access the file because it is being used by another process.”. As far as my understanding goes this error is caused due to the .svn folder(which is hidden) created during checkout. We need to ensure that this folder is deleted before checkout or we need to ensure that the workspace itself is deleted completely before a fresh checkout. I employ the second option.

For this install a Jenkins plugin named ‘Workspace Cleanup Plugin’.

After installing this plugin go to Configure> Build Enivironment > Check ‘Delete workspace before build starts’ option.

Another thing you have to do is to set SVN to ‘Always checkout a fresh copy’ option

Hence the next time your job starts the workspace will be cleaned, and a fresh svn checkout happens. You will never encounter this error again.

All the best!

Regards,

VJ

Creating Jenkins Nodes dedicated for running Selenium Automation Scripts

If you are having problems running your Selenium Test-Suite on a remote node from Jenkins, you probably need this blog the most! After encountering a lot of wierd jenkins errors like :-

Headless Exception Error:-

I got this error when I was trying to execute my Selenium Scripts on a remote node using a SSH connection.

HeadlessExceptionforSSH

2.Another error saying ‘Channel stopped’ on Mac when node was communicated using SSH:-

JenkinsasaServiceError

3.Error when Jenkins node used as a service on Win:-

COM method IWebBrowser2::Navigate(2) failed

I observed this error in my stacktrace while trying to execute my Selenium script on Internet Explorer browser.

A lot of searching & googling, I finally come up with my solution!! Eureka!… hehe…

Setting up a Jenkins node dedicated for Automation Executions:-

1.Go to Jenkins > Manage Jenkins > Manage Node > New node

2.Enter node name , select dumb slave

3.Give remote working directory for your node.

4.Select ‘Launch Slave Agents via Java Web Start’ in Launch Method.This is very important for machines which run Selenium Automation Scripts.

5.I have 2 dedicated nodes i.e 1 Win Machine & 1 Mac Machine for running my automation test-suite. This method is the way to go for hassle-free execution.

Note:I previously tried running these scripts using SSH & as a windows service(for Win OS only) on my remote nodes , and the Automation Scripts would fail as Selenium webdrivers do not support automation processes which run as a Windows Service or a headless execution(in case of SSH).

Mapping a node for a particular job(for beginners):-

Enter the node name in the “Restrict where the project can be run” field in your Jenkins job and you are good to go!

Regards,

VJ

Selenium Scripts Integration with Jenkins

So this is my first tech blog!….haha…. Fingers crossed…. Here we go!

****************************************************************************************************************************************

There are many ways to trigger Selenium automation scripts which are collated into a test-suite. The method I have employed is as follows :-

1.’Mavenise the Project’ – I created a new Maven Project in my eclipse setup and copied all my automation scripts into the src/test/java/.

2.I create a ‘testng.xml‘ file which consists of the various tests I want to run as part of the test suite.

3.I resolve all the dependencies on my Maven Project using ‘mvn dependency:tree’.

4.In the pom.xml file , I give the name of this xml file.

5.I also enter various plugins needed for execution,report generation etc in the pom.xml file.

6.One such plugin is the maven-site-plugin. For more info goto http://maven.apache.org/plugins/maven-site-plugin/

7.Another plugin I use is the maven-surefire-plugin.  For more info goto http://maven.apache.org/surefire/maven-surefire-plugin/

8.Finally to run the test-suite I run the ‘mvn site’ command from the folder root directory.

9.The test-suite gets executed and the surefire report is generated in **/target/site/surefire-report.html

There are other ways of running test-suites as well like ant scripts etc, but I personally find this the easiest way to trigger a test automation suite and get a nice meaning report at the end of it! The surefire-report.html generated in the target/site folder is awesome!

Now if you want to run this test-suite as a part of a Continous Integration process using Jenkins you can do the following :-

1.Create a new Jenkins job (Select Maven Project).

2.Give the destination of the pom.xml file ( relative to the node root).

3.In the goals section enter ‘site’.

4.On building the project, you have your automation scripts running.

5.Next step is to append the surefire-report into the main Jenkins notification email.

All the best with whatever IT is that you are doing ( which redirected you here 🙂 )

Regards,

VJ