Import-Module (".\" (Split-Path -Leaf $PSCommandPath).Replace(".tests.ps1", ".psd1")) I didn't check that in the first place because I believed the test adapter would just execute Invoke-Pester in the working directory I added Get-Location | Write-Host to 1 file and figured out that the working directory was C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE Any ideas how to load my module prior to running the tests? \MyProject.psd1 to the 1 file does not help. Here comes my problem: PowerShell Tools come with a test adapter and my test shows in Test Explorer.īut If I execute it, it always fails with The term Connect-Database is not recognized as cmdlet function script file or operable programĮven adding Import-Module. Passed: 1 Failed: 0 Skipped: 0 Pending: 0 Running a powershell console and executing $result = Connect-Database -host localhost -user admin -pass passĬonnect-Database is a function from MyProject.psm1 and is exported via MyProject.psd1 Running Pester Tests inside Visual Studio - visual-studio After installing PowerShell Tools for Visual Studio 2015 I created a new Powershell Module Project which creates a MyProject.psd1 a MyProject.psm1 and a 1 file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |