Added possibility to pass tests script as string to address cases whe…#972
Added possibility to pass tests script as string to address cases whe…#972nohwnd merged 7 commits intopester:masterfrom
Conversation
…n powershell scripts and tests for them are stored not on FileSystem but in some storage like DataBase and executed in Temp folder. Example is Sitecore CMS, where we use SPE (Sitecore Powershell Extensions) module to create and run PS scripts. We store scripts and tests as Items in content tree and SPE executes them when needed in Temp folder on the server.
it-praktyk
left a comment
There was a problem hiding this comment.
Please add tests which confirm that Pester executed with the new parameter really works.
| [Parameter(Position = 0)] | ||
| [string] $Path, | ||
|
|
||
| [string] $Script, #in order to allow passing test script as a string |
There was a problem hiding this comment.
An added parameter is not explained in the comment based help.
There was a problem hiding this comment.
I removed it from here. Mentioned usage of this parameter in example (line 661). Do you think it understandable enough?
There was a problem hiding this comment.
@it-praktyk Could you please review my PR again? I`ve added test and description for parameter. Changes are backward compatible.
| ) | ||
|
|
||
| & $Path @Parameters @Arguments | ||
| if(![string]::IsNullOrEmpty($Path)) |
There was a problem hiding this comment.
Please use -not instead !
…d by running tests locally)
|
@Chekusty It fails on the build server on PowerShell 2 with this error: |
|
@nohwnd I think I need a little bit of your help, because I cannot find error locally, and error message is not descriptive.. Do you have any idea what can be wrong? |
|
@Chekusty, it's internal error of the TeamCity instance. |
|
@it-praktyk Ok. Can I expect that someone will fix this internal error? |
|
@it-praktyk Great! Thank you, guys! |
|
I've found the reason why some tests fail under PowerShell 2.0 |
|
@it-praktyk Great. That is the line I thought will be the case. Weird that it does not print the whole error message in the TC output, I will try to enhance that first, and then fix this error. |
|
I could not push into your master, so I am merging this as is, and will merge a fix for the problems there were on PowerShell 2 shortly after. Thanks for the change. Next time please make a branch for the change instead of making a pull-request from your master, if you don't know how to do it please ask 🙂 |
|
OMG, thank you very much! I lost my hope this summer 😄 Now we will finally be able to switch to Pester, not ChekustyCustomPester 😌 Thank you! |
|
@Chekusty Sorry it took so long, I will release it in few days. 😊 |
Added possibility to pass tests script as string to address cases when powershell scripts and tests for them are stored not on FileSystem but in some storage like DataBase and executed in Temp folder.
Example is Sitecore CMS, where we use SPE (Sitecore Powershell Extensions) module to create and run PS scripts. We store scripts and tests as Items in content tree and SPE executes them when needed in Temp folder on the server.
Will try to add Pester tests later this week.