Feb
10
Posted by:
Stefan Kamphuis
Wednesday, February 10, 2010 2:16 PM
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:

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:
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:
Step 3: Set up the environment
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.
- <?xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <appSettings>
- <!--Site Settings-->
- <add key="SiteURL" value="http://localhost/DNN_522/"/>
-
- <!--Browser Settings-->
- <add key="SilentMode" value="False"/>
- <add key="IETimeOut" value="180"/>
- <add key="AutoCloseIE" value="True"/>
-
- <!--Database Settings-->
- <add key="DatabaseName" value="DNN_522_Test"/>
- <add key="DatabaseServer" value="(local)"/>
-
- <!--Videos & Screen Capture Settings-->
- <add key="VideoEnabled" value="False"/>
- <add key="ScreenCaptureEnabled" value="False"/>
- <add key="VideoZoom" value="0.25"/>
- <add key="VideoFramesPerSec" value="5"/>
- <add key="CaptionFontSize" value="26"/>
-
- <!--Test File Locations-->
- <add key="TestRoot" value="D:\Tests"/>
- <add key="WebsitePath" value="Websites"/>
- <add key="PackagePath" value="Packages"/>
- <add key="DatabasePath" value="D:\\TestDatabases"/>
- </appSettings>
- </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:
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!
I 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.
6 comment(s) so far...
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
|
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
|
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
|
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
|
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
|
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
|