Tools
- Visual Studio 2010 C# Express
- NUnit 2.5
- PowerShell 2
Setup
I have a solution that contains two projects, one with my PowerShell scripts and the other with my tests just to keep things clean.
Scripts project
My PowerShell scripts are all part of a module so for my integration tests I install this module in the user directory. I am just using a build event to do this
rmdir %USERPROFILE%\Documents\WindowsPowerShell\modules\DevPipeline\ /s /q
mkdir %USERPROFILE%\Documents\WindowsPowerShell\modules\DevPipeline\
xcopy $(ProjectDir)\PowerShellModule %USERPROFILE%\Documents\windowspowershell\modules\DevPipeline
My PowerShell scripts are all part of a module so for my integration tests I install this module in the user directory. I am just using a build event to do this
rmdir %USERPROFILE%\Documents\WindowsPowerShell\modules\DevPipeline\ /s /q
mkdir %USERPROFILE%\Documents\WindowsPowerShell\modules\DevPipeline\
xcopy $(ProjectDir)\PowerShellModule %USERPROFILE%\Documents\windowspowershell\modules\DevPipeline
Tests project
To run tests in Visual Studio express I use the following work around after setting the project to be a Console Application rather than a library.
And then to run the command for my test I use the following class
Integration Tests
As I mentioned above I am treating these tests as integration tests and I import the module as part of the setup.
An example of the integration tests is below
No comments:
Post a Comment