QUnit4SharePoint NuGet Package

I hope most of you SharePoint developers already know NuGet. For those of you who don’t know NuGet – here just a few sentences about NuGet.

NuGet is a package manager for .NET. By using NuGet you can easily setup your projects with your favorite third party libs within no time. In addition to the visual NuGet Package Manager it also adds the Package-Manager-Console to Visual Studio 2010. The Package-Manager Console is just a PowerShell host, which allows you to script your NuGet tasks using PowerShell.

QUnit is a powerful and easy-to-use testing framework for JavaScript. QUnit is maintained by Jörn Zaefferer and the jQuery Testing Team. The entire QUnit source is located at github.

QUnit4SharePoint automatically integrates QUnit in a SharePoint 2010 project. It adds all the required things to your new project.

First you have to open up the NuGet Package Manager – or what I prefer – the NuGet Package Manager Console ( VIEW | OTHER WINDOWS | PACKAGE MANAGER CONSOLE ). Within the Package Manager Console you’ve just to use the Install-Package cmdlet and pass the entire name of my package “DotNetRocks.QUnit4SharePoint”

clip_image002

After downloading the package from the official NuGet repository it adds the required JavaScript files, the style sheet and a sample TestSuite to the layouts folder. In addition to these items also a “QUnit4SharePoint” Element is added to your project.

clip_image003

This SharePoint Element contains a CustomAction which displays a HyperLink within the SharePoint Ribbon Menu to guarantee ease of access. Unfortunately Visual Studio tools for SharePoint do not automatically add this Element to a SharePoint Feature. So in the case that you’d like to see the CustomAction in your environment you have to open up the Feature Designer ( in this example for the “QUnit” Feature) and add the QUnit4SharePoint node.

clip_image005

 

After completing this you could deploy the WSP. The sample TestSuite shows some simple QUnit tests – just to get an idea of how to use QUnit.

clip_image007

 

Happy testing

 

Technorati Tags: ,,
DotNetKicks-DE Image
Published Mittwoch, 4. Januar 2012 01:03 von ThorstenHans

Kommentare

Keine Kommentare

Kommentar abgeben

(verpflichtend) 
(verpflichtend) 
(optional)
(verpflichtend)