Debugging test Script with powerShell ISE

Apr 27, 2010 at 12:07 PM

How is it possible to debug the unit test script?

Wouldn’t it be better to call the ps unit test script “dot sourced” instead of “Invoke-Expression”.

 

I’ve changed the PSUnit.Run.ps1 file from

 

#Loading test functions into global scope

$ScriptLines = Get-Content -Path $PSUnitTestFile -Encoding "UTF8"

$ScriptText = [String]::Join("`r`n", $ScriptLines)

Invoke-Expression $ScriptText

 

To

 #Loading test functions into global scope

. $PSUnitTestFile

 

 Then it is possible to debug the test script with powerShell ISE.

Coordinator
Apr 27, 2010 at 6:33 PM

Thanks for your feedback JochenAxt.

I made the change and I am now running some tests before I commit it.

It seems to work fine so far.

Being able to step trough your code in the debugger is a huge improvement.


Klaus