Jenkins + Selenium Webdriver + C# + NUnit

4,868 views
Skip to first unread message

Johnny

unread,
Apr 24, 2012, 7:15:00 PM4/24/12
to webdriver, fra...@newsgator.com
I have an objective in mind, please let me know if I'm way off, it's
not possible or I need to make substitutions.

Current:
1. coding selenium webdriver test in .net using C#
2. Currently executing my test using NUnit

Objective:
1. Continue coding my test in .net using C#
2. Use Jenkins to schedule running these tests with the various
browsers webdriver supports

Questions:
1. Is this possible?
2. Do I need to look at Selenium Grid 2 (I've never used this)?
3. Is it possible to not use Selenium Grid and just have Jenkins
execute my current tests using something like NUnit or TestDriven?

Notes:
1. My knowledge of using a continuous integration server is virtually
zilch
2. During this process trying to determine if this is possible I've
created 2 projects in Jenkins to build my project's solution using
MS.build and NAnt

*It seems the community for .net/C# for selenium is almost non-
existent, is that a factual statement?

Can anyone provide assistance, blogs, whitepapers, or sites I can
gather some more information to achieve my objective if it's possible

Thanks in advance!

Krishnan Mahadevan

unread,
Apr 25, 2012, 3:29:12 AM4/25/12
to webd...@googlegroups.com
Johnny,

My limited understanding included Inline.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Wed, Apr 25, 2012 at 4:45 AM, Johnny <franki...@gmail.com> wrote:
I have an objective in mind, please let me know if I'm way off, it's
not possible or I need to make substitutions.

Current:
1. coding selenium webdriver test in .net using C#
2. Currently executing my test using NUnit

Objective:
1. Continue coding my test in .net using C#
2. Use Jenkins to schedule running these tests with the various
browsers webdriver supports

Questions:
1. Is this possible?
If you are going to bring in Jenkins (Continuous Integration) you would need your code to be made available in some version control system like SVN or git etc., Once you are done with that, you should be able to do it. But I dont know if maven can do C# builds and can also kick off NUnit tests for Unit Testing. From a quick google, I figured that this can be possible. Here's a tutorial that I stumbled into [ http://jenkinsheaven.blogspot.in/2011/04/plugins-for-net-builds-part-1.html ]

2. Do I need to look at Selenium Grid 2 (I've never used this)?
Depends on where you are hosting your Jenkins instance. If it is a windows instance, then I dont think you would need the Grid and I think you can work with FirefoxDriver, IEDriver, ChromeDriver etc., But if you are working with Linux box then its better to take the Grid route, because the Linux box can be a headless box as well. Personally I have always worked with the Grid. So just giving you what I know of, as options.
3. Is it possible to not use Selenium Grid and just have Jenkins
execute my current tests using something like NUnit or TestDriven?

Yes this is possible provided your Jenkins runs on a windows instance. I am guessing that if its on a windows machine then it shouldnt run into headless setup configuration issues and all that.

Notes:
1. My knowledge of using a continuous integration server is virtually
zilch
2. During this process trying to determine if this is possible I've
created 2 projects in Jenkins to build my project's solution using
MS.build and NAnt

*It seems the community for .net/C# for selenium is almost non-
existent, is that a factual statement?

Can anyone provide assistance, blogs, whitepapers, or sites I can
gather some more information to achieve my objective if it's possible

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


Mark Collin

unread,
Apr 25, 2012, 4:27:42 AM4/25/12
to webd...@googlegroups.com
Jenkins is essentially just a way to run your local build in an automated
fashion triggered by a check in. What you propose sounds very doable if you
already have a build process (which I assume you do).

You could use Grid in Jenkins (I think there is also a selenium plugin, but
I don't know how up to date it is/which versions of Selenium it supports).
Previously I have personally avoided the Grid as it was not amazingly stable
as Grid 1. I haven't used Grid 2 and I hear it has come on a long way, but
if you don't want to use the Grid you can set machines up as slaves in
Jenkins and we used this to set up a series of VM's as Jenkins slaves to run
Selenium tests. Each slave was a different OS/browser combination that gave
us a full range (apart from OSX, we had problems finding an OSX VM and used
a real mac as a slave for OSX testing).

I'm not a .NET person my self but a quick google brought this up which seems
sane:

http://jenkinsheaven.blogspot.co.uk/2011/04/building-build-first-net-build.h
tml

Good luck.

Thanks in advance!

--

Krishnan Mahadevan

unread,
Apr 25, 2012, 4:34:39 AM4/25/12
to webd...@googlegroups.com
Mark,
Out of curiosity :

So in your setup, you don't use grid, but rely on the Jenkins clustered environment to run tests. So does that mean that the slaves would essentially be servicing instantiating of the browsers via (IEDriver, ChromeDriver, FirefoxDriver) etc ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Mark Collin

unread,
Apr 25, 2012, 4:44:40 AM4/25/12
to webd...@googlegroups.com

We had Jenkins check out the codebase on the slaves and run the tests. 

 

At the time our codebase had a series of ant scripts that could run the build so it was literally tell the slave to check out the code and run an ant script.  We had to set up the java class path and copy the required jar’s across to each machine but it was pretty easy to do.  If I had to do it again I would probably do something similar, but my test codebase is now mavenised which would probably makes it even easier because maven can pull down all the dependencies so the only prepping the environments would need would be to install maven.

Ross Patterson

unread,
Apr 25, 2012, 10:33:39 AM4/25/12
to webd...@googlegroups.com
Questions:
1) Yes. We do the same thing, using JetBrains' TeamCity CI system instead of Jenkins. It works very well. Our tests are annotated for NUnit ("[TestFixture]", "[Test]", etc.), and TeamCity gives us test-by-test success/failure visibility.

2) Only if you want to. It certainly seems to do the job, but most CI systems have "job" and "worker machine" concepts, and you may find that large test suites (ours is about 1,400 and still growing) are better served by breaking them up into smaller chunks and running the jobs in parallel.

3) Probably. See #1 :-)

As to the Selenium/.NET community, there are a bunch of us out here, but we tend to be experienced and quiet. One rarely finds .NET newbies these days, and if you can grok IIS-based web services and web apps, Selenium in .NET is pretty simple.

Ross

-----Original Message-----
From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On Behalf Of Johnny
Sent: Tuesday, April 24, 2012 7:15 PM
To: webdriver
Cc: fra...@newsgator.com
Subject: [webdriver] Jenkins + Selenium Webdriver + C# + NUnit

Moises Siles

unread,
Apr 25, 2012, 11:26:34 AM4/25/12
to webd...@googlegroups.com
Hi Ross,

thanks for your info.... currently I'm using TeamCity in order to run my C# MsTest.... I just want to confirm to you, so, you are saying that I can create some jobs using team city in order to run my test remotely in parallel, is that right? Currently I'm looking for a way to save some time during my test execution...... We have around 300 Script and we're still creating more..... 


Ross Patterson

unread,
Apr 30, 2012, 8:46:59 AM4/30/12
to webd...@googlegroups.com

Yes, that’s right.  Here’s what we do:

 

·         We configure TeamCity to use Amazon’s EC2 cloud for our build grid, so it can create and destroy machines as needed to manage the build workload.

·         We have a build machine AMI, which has everything we need pre-installed except our product.  Since we’re a mostly-.NET shop, that means a Windows Server system with SQL Server, IIS, MSMQ, NHibernate, NAnt, the .NET compilers, etc., but also Apache Solr, Selenium, and a few other things.

·         Every source code check-in causes TeamCity to run a collection of about 23 builds.  We start with a “compile everything from scratch” build, and if it succeeds, there’s a “build all the installers from the compilation output” build. 

·         If the installer build succeeds, a lot of testing builds run.  Every testing build starts with an uninstall-clean-install-start sequence, using the installers we just built and a database dump that contains our current schema and test data.  The database dump is created as part of a separate set of TeamCity builds in a different Subversion repository, but the key point is that it’s version-controlled and the builds know which version they need.

·         Each testing build uses a completely isolated environment – we run the test, browser, Selenium server, web tier, app tier, ancillary services, and database all on a single EC2 build machine.  That means at any given time, each “system” is running exactly one test, which means that the test’s results are predictable.  For certain tests, we even restore the database before and after the test, because they depend on conditions we have trouble recreating “naturally”.

·         The automated testing builds use TeamCity’s NUnit Runner to select and run the tests.  All our tests have a [Category(...)] annotation at the class level, and each of the builds runs a different category.  We currently have 16 categories.  We do our best to group classes such that each build takes 30-45 minutes when the tests are passing, but we have a couple that run considerably longer (we need to refactor those classes).

 

This lets us run about 1,400 tests from start to finish in about 2 hours if the grid isn’t doing anything else.  The total execution time is just over 18 hours for these builds.

 

Ross

Ross Patterson

unread,
Aug 3, 2012, 1:53:59 PM8/3/12
to webd...@googlegroups.com

We just run the Selenium server the same way we would on our own machines, and follow the details below.

 

Ross

 

From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On Behalf Of steve
Sent: Wednesday, August 01, 2012 10:04 PM
To: webd...@googlegroups.com
Subject: Re: [webdriver] Jenkins + Selenium Webdriver + C# + NUnit

 

Hi Ross
Can you please help lay out how do u guys set up Selenium with Teamcity?(Step by step preferred) I'm newbie and want to set up my own C# selenium with Nunit to run in TeamCity periodically. Thanks in advance.

--

You received this message because you are subscribed to the Google Groups "webdriver" group.

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/mZ-JqAm8kXEJ.

Reply all
Reply to author
Forward
0 new messages