How to unit test an EPiServer site?

by: Peter Hultgren (Sogeti)

I'm currently trying to unit test some classes in my EPiServer site. All I'm getting when running a test against a method that requires database access (ie ALL OF THEM) the testing framework, be it Microsoft's own or NUnit, it just tries to find a web.config in the /bin/Debug of the unit test project. Like this:

System.IO.FileNotFoundException: Could not find file 'C:\[PathToUnitTestProject]\bin\Debugweb.config'.

Does anyone know why this happens? Non DB-accessing methods work fine, and I have no problems unit testing other web apps on my computer, but the EPiServer ones are sure tricky.

18 January 2008

Tags:


    Comments

    1. Hi Peter! Have you check the settings in Project>Edit in NUnit? You can set the the base folder for you appdomain and also specify the name of the config fil. Another tool to use if you want to test from the outside is NUnitAsp (http://nunitasp.sourceforge.net/) or start your own cassini webserver inside you testfixature (http://www.hanselman.com/blog/NUnitUnitTestingOfASPNETPagesBaseClassesControlsAndOtherWidgetryUsingCassiniASPNETWebMatrixVisualStudioWebDeveloper.aspx) Regards, Fredrik Haglund, INEXOR AB - http://blog.fredrikhaglund.se
    Post a comment    
    User verification Image for user verification  

    About me

    I am a 27 years old consultant at Sogeti in Stockholm, Sweden. I am working mainly with developing solutions in EPiServer, which I've been doing since 2006. I also write at Microserf and you can e-mail me at this address: peter.microserf@gmail.com.

    Syndications


    Archive


    Tag cloud

    EPiTrace logger