Importing Config Files with C# NUnit tests

How to use an NUnit Configuaration file to pass values to a test at runtime? Create your XML Configuration file using the format below. Add your Key,Value pairs in appSettings section Use the correct file name for your config file Add a reference to System.Configuration and add a corresponding using statement Use the ConfigurationManager object […]

Is your JUnit Assert class now deprecated?

Is your JUnit Assert class now deprecated? Well here’s how to fix it. JUnit have moved things around, and as a result the Assert class is now in a different location as and from JUnit 4.11 But fear not, rectifying this is a simple one-liner. Simply change your import statement from [code]import junit.framework.Assert; [/code] to […]

Setting up Maven on a Mac

When I started researching about Maven (What is it? Why do I need it? What does it do?) I came across a number of webpages that said that Maven came pre-installed on older version Macs. I have Mavericks on my iMac so I wasnt included in the group that came pre-installed with Maven. There are […]

C# Snippet: Random Number

Here is a useful snippet to generate a six digit random number in C# [code] // Generate a 6 digit random number Random r = new Random() randomNumber = r.Next(100000,999999); Console.WriteLine(“Your random number is: {0}”, randomNumber); // end [/code] Originally posted in /bloggarriv.

Basic C# NUnit Test Setup

This post will outline the basic structure of how to setup your C# NUnit test. First of all here is the code of the basic empty C# NUnit test file. I’ll explain all of the different parts below. [code] namespace MyWebDriverTest { [TestFixture] public class Class1 { [Test] public void TestCase01() { } } } […]

Adding using statements

As well as adding a reference to the project for Selenium WebDriver and NUnit, you must also add a “using” statement for the sections you are going to use in your test. A good start is to add the following using statements to your file: [code] using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using NUnit.Framework; [/code] Note: If […]

All Angles Covered

Well a lot of angles covered anyway. As I have a Mac at home and a Win8 PC in work I will be posting examples and tips from both setups. Hopefully it will be a fairly balanced approach. In work I’ll be using WebDriver with the C# programming language, Visual Studio 2013 and NUnit. From […]

How to install Apache Ant on a Mac

I found this useful answer on StackExchange on how to install Apache Ant on a Mac. Earlier versions of OSX came with Ant preinstalled but not so on my installation of Mavericks. Before we do anything we need to download the Ant files from http://ant.apache.org/. The code snippet below assumes that you download the .tar.gz […]

Creating your first C# WebDriver test

I use Microsoft Visual Studio 2013 to create my C# WebDriver tests. If you do not have this application then you can download Visual Studio Express from here. I think the most suitable option for our use is the “Express 2013 for Windows Desktop” version. Select File > New > Project from the menu and […]

Choosing your flavour of WebDriver

Deciding to write tests with WebDriver is only half the battle, you still need to pick a programming language, and possibly a test framework also. Most of the examples that I will be posting will be using C# and NUnit, but for the most part it should still be readable and easy to transfer to […]