Friday, 7 June 2013

Running TeamMentor WebAutomation UnitTests locally (using Selenium and ChromeDriver)

If you want to run the TeamMentor's WebAutomation UnitTests (for example to see how we use Selenium and the multiple WebDrivers, like ChromeDriver), there are couple gotchas that you will need to take into account.

This post shows how I went from a git clone to a full execution of all unit tests.

It all starts with a clone of the https://github.com/TeamMentor/UnitTests_WebAutomation repository

image

Once the clone completed, I opened the TeamMentor.WebAutomation.sln solution file in VisualStudio 2010

image

Chose to run all UnitTests , and:

image

.. the reason that all tests failed, was because I didn’t have the expected folder in my dev box:

image

Since I was was looking at the code, I might as well fix this and remove this hard-coded dependency from this test.

To do that, I refactored that string into the Settings.Settings file:

image

which puts the content on the app.config file:

image

With these changes, the UnitTests will start execution by opening up the Chrome WebDriver app:

image

Note that these tests are all running on a ‘live’ instance of TeamMentor:

image

... including the cases where Login is needed

image

Finally, once all tests execute we get the nice view of:

image

One important requirement (that is not going to be clear from the TeamMentor screenshots shown above), is that a) the current tests expect the OWASP and Top_Vulnerabilities Libraries to be the only libraries on the target server, and b) that some tests failed on first run (but succeeded when manually executed.
Post a Comment