找不到或加载主类com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner

时间:2018-07-27 08:07:58

标签: powershell batch-file soapui ready-api

我有一个Power Shell脚本,该脚本位于VM上,并创建到物理机的PSSession并运行批处理文件。直接在物理机上运行批处理文件可以按预期工作,但是当我尝试从VM远程运行该批处理文件时会抛出错误。

电源外壳:

$Username = "Domain\User"
$Password = ConvertTo-SecureString "Password*" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($Username, $password)
$session = New-PSSession -ComputerName "K2" -Credential $cred

Enter-PSSession -Session $session

Invoke-Command -ComputerName "K2" -ScriptBlock {
    Set-Location 'C:\Program Files\SmartBear\ReadyAPI-2.4.0\Go4Schools Tests\Test Runner'
    & '.\PSTR.bat'
}

Exit-PSSession
Get-PSSession | Remove-PSSession

批处理文件:

"C:\Program Files\SmartBear\ReadyAPI-2.4.0\bin\testrunner.bat" -A -j "-fC:\Users\administrator.HYPERSPHERIC\Desktop\Go4Schools Tests\Test Results" "-RJUnit-Style HTML Report" -FXML -EDevTest "C:\Users\administrator.HYPERSPHERIC\Desktop\Go4Schools Tests\Project Saves\SoapUI_Mobile_API_Project.xml"

错误:

PS C:\> C:\Users\administrator.HYPERSPHERIC\Desktop\PS_TR.ps1

C:\Program Files\SmartBear\ReadyAPI-2.4.0\Go4Schools Tests\Test Runner>"C:\Program Files\SmartBear\ReadyAPI-2.4.0\bin\testrunner.bat" -A -j "-fC:\Program Files\SmartBear\ReadyAPI-2.4.0\Go4Sch
ools Tests\Test Results" "-RJUnit-Style HTML Report" -FXML -EDevTest "C:\Program Files\SmartBear\ReadyAPI-2.4.0\Go4Schools Tests\Project Saves\SoapUI_Mobile_API_Project.xml" 
Error: Could not find or load main class com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner
    + CategoryInfo          : NotSpecified: (Error: Could no...oTestCaseRunner:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
    + PSComputerName        : K2

1 个答案:

答案 0 :(得分:0)

Ready API和soapUI在testrunner.bat中使用一些环境变量来设置依赖项等。因此,每当我从应用程序外部使用脚本执行testrunner.bat时,我总是首先将CD刻录到bin目录中:

cd <Ready API installation directory>\bin 
./testrunner.bat ...