Batch file 通过批处理文件执行SOAP测试时未生成自定义文本文件

Batch file 通过批处理文件执行SOAP测试时未生成自定义文本文件,batch-file,cmd,command-line,soapui,Batch File,Cmd,Command Line,Soapui,我为我的测试套件编写了一个分解脚本,其中我正在将通过/失败的测试用例和步骤写入文本文件。当我通过SOAPUIGUI或命令行执行测试套件时,我能够看到在所需位置生成的文本文件。但当我执行批处理文件时,基本上和我在命令行中使用的代码相同,文本文件并没有生成 用于拆卸脚本的代码,以供参考 def failedTestCases = 0 def successTestCases = 0 def failedTestSteps = 0 def successTestSteps = 0 def failed

我为我的测试套件编写了一个分解脚本,其中我正在将通过/失败的测试用例和步骤写入文本文件。当我通过SOAPUIGUI或命令行执行测试套件时,我能够看到在所需位置生成的文本文件。但当我执行批处理文件时,基本上和我在命令行中使用的代码相同,文本文件并没有生成

用于拆卸脚本的代码,以供参考

def failedTestCases = 0
def successTestCases = 0
def failedTestSteps = 0
def successTestSteps = 0
def failedAssertions = 0
def successAssertions = 0

File file = new File("C:/tmp/testcase_results_SearchService.txt")
file.text=''
runner.results.each { testCaseResult ->
    def caseName = testCaseResult.testCase.name
        def caseStatus = testCaseResult.status.toString()
        if(caseStatus == 'FAILED'){
             failedTestCases ++
             file << "Test Case: $caseName" + " has failed \n \n"
             }
     else {
        successTestCases ++
        file << "Test Case: $caseName" + " has passed \n \n"}
        // file << "Test Case: $caseName $caseStatus \n" 
     //log.info "Test Case: $caseName $caseStatus" 

     testCaseResult.results.each{ testStepResults ->
        testStepResults.messages.each() { msg -> log.info msg }
        def stepName = testStepResults.testStep.name
        def stepStatus =  testStepResults.status.toString()
        if(stepStatus == 'FAILED'){failedTestSteps ++
        file << "Test Step: $stepName" + " - Fail \n" }
        else{successTestSteps ++
        file << "Test Step: $stepName"+" - Pass \n" }


        if (testStepResults.testStep.config.type == 'request')
        {
            testStepResults.testStep.getAssertionList().each{
                def assertLabel = it.label
                def assertStatus = it.status
                if (assertStatus == 'VALID') { successAssertions ++ }
                else {failedAssertions ++ }

            }
        }
    }
}

通过命令行执行这些命令时,我可以看到文本文件是作为拆卸脚本的一部分生成的,而不是作为批处理文件的一部分生成的。

为什么其中一个开关和参数之间有空格?您没有将路径括在引号中,而且几个开关之间没有空格。您应该包括该命令的语法。不是解决方案,而是在批处理文件中用
cd/D
替换
cd
。。。
cd C:\Program Files\SmartBear\SoapUI-5.4.0\bin\
testrunner.bat -ehttp://SearchService.asmx -r -a -fC:\ABC\Report -s"SearchServiceSoapTS"  -I "C:\Users\ABC\Documents\SearchService_Test.xml"