0

PowerShellスクリプトを呼び出してSelenium WebDriverテストを実行するには、Octopus Deployのプロセスステップがありますが、エラーが発生します。Octopus PowerShellスクリプトを実行しないでデプロイ

次のようにPowerShellスクリプトは次のとおりです。

set nunitPath="C:\AutomatedTests" 
cd %nunitPath%\ 
nunit-console SiteCore.nunit /include:BulkyWasteTests 

展開が行われ、スクリプトを実行するプロセスステップが行われ、次のエラーが発生した場合:

Set-Location : Cannot find path 'C:\Octopus\Work\20170110115049-7\%nunitPath%\' because it does not exist. 

At C:\Octopus\Work\20170110115049-7\Script.ps1:2 char:3 

+ cd %nunitPath%\ 

+ CategoryInfo   : ObjectNotFound: (C:\Octopus\Work...-7\%nunitPath %\:String) [Set-Location], ItemNotFoundException 
+ FullyQualifiedErrorId :  PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand 

The remote script failed with exit code 1 

私はしないでくださいエラーがPowerShellスクリプトで指定された場所に別の場所を報告している理由を理解してください。 ご迷惑をおかけして申し訳ございません。

答えて

0

cdは、Set-Locationのエイリアスです。cdは、エラーを調べて変更する必要がある2行目であることがわかります。あなたのCD行は、nunitPathスクリプト変数ではなく、%nunitpath%環境変数に場所を設定しようとしています。

4c74356b41追加正しいコメント@で編集
set nunitPath "C:\AutomatedTests" 
cd $nunitpath 
nunit-console SiteCore.nunit /include:BulkyWasteTests 

:だからあなたのスクリプトは次のようになりますスクリプト変数を使用する$ nunitpath

を参照するために

+0

setは、set-variableのエイリアスであるため、powershellで動作しません。 'set nunitPath" C:\ AutomatedTests "' – 4c74356b41

+0

スクリプトの構文を正しく変更しましたが、それでも同じエラーが発生します。おそらくそれはサーバー上の許可問題ですか? –

+0

少なくとも違うエラーが出ているはずですか? –

0

PowerShellでは、文字列内の環境変数参照を拡張するために、%variablename%構文を使用していません。それはcmd.exeの構文です。 PowerShellでは、代わりに$env:variablenameと記述します。

+0

ありがとうございます –

関連する問題