Introduction

Earlier in my career if someone asked me about the quality of my software I would tell them that it could not be better. I thought anything could be written in a weekend and there was no problem just building it on my developer box and shipping it. I call this "F5" development. As I have matured as a developer and moved forward to thinking more as a true software engineer I've learned a few things.

One those things is unit testing. As I explained it to a good friend of mine that I never new how bad my code was until I started unit testing my code. I also didn't realize how much useless or excess code I wrote. I forced myself for the next three months really diving deep into unit testing and learn as much as I could. It really did change how I approached software development. The largest change in the amount of code I write. When you know you have to test it you will start writing less code. With this and a focus on writing testable code the quality of my software has increased dramatically.

Now I want to take that one step further. Now it's time to start doing my own integration testing.

Integration Testing

I have been working on a new open source project to assist developers in doing their own integration testing of web applications. This would allow you to write integration test to automate testing with the three major windows (desktop) based browsers. These are Internet Explorer, Chrome and Fire Fox. You can now make code changes, run unit tests, do a local deployment, then run a set of integration tests. After this you should be very confident that when you release a new version to Quality Assurance they should not find any issues. Now we are all human and there will always be something you may have missed. If QA finds as issue then go write a unit test or if it's an integration issue now you can add a new integration test to ensure it never happens again.

Show me the code

This code below will attach to an existing browser or create a new instance. The browser will be told to navigate to the bing.com site. Once there the browser will be told to search for "Bobby Cannon".

using (var browser = InternetExplorer.AttachOrCreate())
{
browser.NavigateTo("http://bing.com");
browser.Elements.TextInputs["sb_form_q"].TypeText("Bobby Cannon");
browser.Elements["sb_form_go"].Click();
browser.WaitForRedirect();
}

Now there much more you can do. You could validate the page contained certain elements and that the elements contained certain data. You can really the completed state of the page.

Feel free to download the code and check it out. Also I'd love to get feedback and pull request.

  • http://bobbycannon.github.io/TestR/
  • https://github.com/BobbyCannon/TestR

Also if you want to just use TestR then feel free to just use the nuget package "TestR".