DNN Blog

Feb 10

Posted by: Stefan Kamphuis
Wednesday, February 10, 2010 2:16 PM  RssIcon

The DotNetNuke Quality Team has been working on Automated GUI Testing for several months now. A project has of course been created on CodePlex. Tools of choice are Gallio, MbUnit and WatiN. We’ve been lucky to get Jeroen van Menen aboard the project, as he is the creator and leader of the WatiN project. You will need to install Gallio and MbUnit before you start. Installing WatiN is also a good idea, but since the binaries are included, that’s not strictly nessecary.

In this post, I’ll be showing how to get started with the DotNetNue Automation Project, ultimately to be able to start writing your own automated tests.

Step 1: get the sources

You need to get the sourcefiles of the CodePlex project. Personally, I prefer to use Tortoise and SVN to connect to CodePlex:

image  image

As you can see I’m using a checkout command to get the sources. Since the download is almost 40MB, it might take a few minutes to download.

What we have now, is a folder containing all the sources:

image

 Step 2: Open the solution

Next, we’ll open up the solution DotNetNuke_WatiN_Tests which resides in the root of the AutomationTests folder. If you don’t have TFS Explorer installed, you’ll get a warning about that because the are TFS bindings in the solution:

image

Step 3: Set up the environment

image In the solution explorer, navigate to the DotNetNuke.Tests.WatiN project and open up the app.config file. Without getting into all the details of the configuration file, there’s a few elements we need to have a look at.

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3.   <appSettings>
  4.     <!--Site Settings-->
  5.     <add key="SiteURL" value="http://localhost/DNN_522/"/>
  6.  
  7.     <!--Browser Settings-->
  8.     <add key="SilentMode" value="False"/>
  9.     <add key="IETimeOut" value="180"/>
  10.     <add key="AutoCloseIE" value="True"/>
  11.     
  12.     <!--Database Settings-->
  13.     <add key="DatabaseName" value="DNN_522_Test"/>    
  14.     <add key="DatabaseServer" value="(local)"/>
  15.     
  16.     <!--Videos & Screen Capture Settings-->
  17.     <add key="VideoEnabled" value="False"/>
  18.     <add key="ScreenCaptureEnabled" value="False"/>
  19.     <add key="VideoZoom" value="0.25"/>
  20.     <add key="VideoFramesPerSec" value="5"/>
  21.     <add key="CaptionFontSize" value="26"/>
  22.     
  23.     <!--Test File Locations-->
  24.     <add key="TestRoot" value="D:\Tests"/>
  25.     <add key="WebsitePath" value="Websites"/>
  26.     <add key="PackagePath" value="Packages"/>
  27.     <add key="DatabasePath" value="D:\\TestDatabases"/>
  28.   </appSettings>
  29. </configuration>

First, there’s the SiteURL settings. Although you can of course change the setting to suit your own needs, I’ll just stick to this one and create a brand new DotNetNuke CE 5.2.2 installation at this URL.

The same goes for the database: while I could create a database with any name, I’ll take the easy way out here and just name it DNN_522_Test. You might want to change the DatabaseServer setting too by the way.

Next we’ll need to make sure the test file location settings are correct. Since I don’t have a D drive, I’ll have to change these settings. You can choose to name your path without drive specification, in which case it will be assumed to be a subfolder of TestRoot, or specify a fully qualified path.

Finally, we need to put the “clean” database files in the folder specified in “DatabasePath”. This is used to assure that the tests are always run on the same DotNetNuke installation, and that it doesn’t get “dirty” from running tests over and over again. De files we need to copy to the folder, are the detached databasefiles. If you navigate to your database in SQL Server Management Studio, right-click it, then Tasks, then Detach to get the Detach Database dialog. Make sure you know where those files are before you detach them. You can find that out on the Database Properties Dialog:

image

Once you have detached the files, you can copy them to the “DatabasePath” folder and Attach the database files again in SSMS.

Step 4: Test!

image

imageI chose to click the Gallio icon next to the class declaration for the LoginTests class to run the tests. After some compiling you will notice that Internet Explorer will run and navigate to your test site. After all tests are completed you can read the test report to see if anything went wrong.

In my case, on of the tests failed but that’s just a minor detail…

 

Step 5: Write your own test!

Using this setup, you can easily start writing your own test. We encourage you to do so. Let’s hear about all the great tests your wrote and keep running them on each and every beta release of DotNetNuke.

Tags:
Categories:

6 comment(s) so far...


Gravatar

Re: DotNetNuke Automated GUI Testing

Nice blog posting. That will help us to do our (Events team) automated testwork as well.

By Ernst Peter Tamminga on   Thursday, February 11, 2010 9:38 AM
Gravatar

Re: DotNetNuke Automated GUI Testing

In case it wasn't intentional - There are no releases for the project on CodePlex.
I had to use SVN to get the files.

By Baatezu on   Thursday, February 11, 2010 9:39 AM
Gravatar

Re: DotNetNuke Automated GUI Testing

We're not releasing just yet, but nevertheless we wanted to encourage anyone to get their hands dirty :-)

Tnx for noticing though.

By Stefan Kamphuis on   Thursday, February 11, 2010 9:40 AM
Gravatar

Re: DotNetNuke Automated GUI Testing

I don't think we'll do release as we will be constsntly writing new tests and updating existing tests each week.

By Philip Beadle on   Sunday, February 14, 2010 11:01 PM
Gravatar

Re: DotNetNuke Automated GUI Testing

Why use this testing platform and not MSTEST? It would be nice if we could integrate this into the MSBuild and use the tools from Microsoft. Any plans for doing a MSTEST version of any of this?

Ryan
www.ArrowDesigns.com

By Ryan Morgan on   Monday, February 15, 2010 4:55 PM
Gravatar

Re: DotNetNuke Automated GUI Testing

Ryan, we chose MbUnit and Galio mostly because we didn't want to exclude VSE users from taking advantage of the tests.

Although I haven't tried I do believe you can integrate these tests in MSBuild too: www.bing.com/search?q=mbunit+msbuild

By Stefan Kamphuis on   Monday, February 15, 2010 4:58 PM
Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.