Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DotNetNuke Unit Testing Facilities and Tutorials

Tags:

dotnetnuke

What is the standard, best practice way to perform unit testing in a dotnetnuke app? I have searched SO as well as the dnn website, and wasn't able to find much info about this. I assume dnn has something baked in for doing unit tests, or at the very least a library that can be plugged in. Where can I find more info? A tutorial on the subject would be ideal, but any resource at all would be appreciated.

Thanks!

like image 646
Jonah Avatar asked May 01 '12 19:05

Jonah


People also ask

What is xUnit testing in C#?

xUnit.net is a free, open source, community-focused unit testing tool for the . NET Framework. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other . NET languages. xUnit.net works with ReSharper, CodeRush, TestDriven.NET and Xamarin.

What is fact in unit testing?

Facts and theories While facts are used to test invariant conditions, theories are tests that are true for a particular set of data passed as argument to the method. You would typically use the [Fact] attribute to write unit tests that have no method arguments.


2 Answers

There isn't much information on testing within DotNetNuke. Being a WebForms based project, it hasn't been a strong concern of many of the developers in the community.

For examples, you can look at the unit testing projects within DNN's source, which have a number of different approaches used. They use MbUnit and Moq for unit testing, as well as Watin for testing the web frontent.

The main technique for making testable modules is to use the WebForms MVP integration, so that you have testable, loosely-coupled presenters that you can inject dependencies into easily. There's the start of a sample module on codeplex, but it's never been fully fleshed out. However, it does has some good background on its project page.

like image 101
bdukes Avatar answered Sep 18 '22 12:09

bdukes


For a data-driven unit testing approach, be aware of following:

  • Create app.config file for unit test project and copy sections related to "data", "caching" from web.config of DNN web app

  • Install caching provider before running any tests: ComponentFactory.InstallComponents(New ProviderInstaller("caching", GetType(CachingProvider)))

like image 26
Bob Dust Avatar answered Sep 20 '22 12:09

Bob Dust