我正在为测试执行生成摘要报告,但是我不确定它出了什么问题。
以下是我在设置脚本中使用的代码: {code}
groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
projectPath = groovyUtils.projectPath
Date date = new Date()
dateTime = date.format('ddMMyy_hhmmss_S').toString()
folderCreate = new File(groovyUtils.projectPath+"\\MySummaryReports");
if(!folderCreate.exists()) {
folderCreate.mkdirs();
}
context.testSteps=0
context.runners = []
context.testcasenames = []
context.testcasedescription = []
context.filenames = []
context.testcaseStatus = []
context.testcasesTimeTaken = []
context.rowIndex = []
context.prevTime = 0.00
以下是拆卸脚本的代码:
Date date = new Date()
dateTime = date.format('ddMMyy_hhmmss_S').toString()
groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
projectPath = groovyUtils.projectPath
def totalNoOfSuccessTestcases = 0
def totalNoOfFailedTestcases = 0
double totalTime = 0.0;
for(status in context.testcaseStatus)
{
if(status.toString()=="FAILED")
{
totalNoOfFailedTestcases++
}
}
try
{
totalNoOfSuccessTestcases = context.testcasenames.size() - totalNoOfFailedTestcases;
context.totalNoOfSuccessTestcases = totalNoOfSuccessTestcases
context.totalNoOfFailedTestcases = totalNoOfFailedTestcases
}catch (Throwable e)
{
log.info "error: "+e;
}
for(time in context.testcasesTimeTaken){
totalTime = totalTime+time;
}
int totalTime1 = totalTime.round()
log.info "totalTime1: "+totalTime1
int hours = totalTime1 / 3600;
int minutes = (totalTime1 % 3600) / 60;
int seconds = totalTime1 % 60;
//context.suiteTime = twoDigitString(hours) + ":" + twoDigitString(minutes) + ":" + twoDigitString(seconds);
//log.info "SuiteTime: "+context.suiteTime;
groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def testSuiteName = testRunner.testCase.testSuite.name
try
{
def tcCount = 0;
for( runner in context.testcasenames )
{
log.info(context.testcaseStatus[tcCount].toString() + " " + context.testcasenames[tcCount] )
if(context.testcaseStatus[tcCount].toString()=="FAILED")
{
log.info "test case failed";
}
else
{
log.info "test case passed";
}
tcCount++;
}
//writer.write("</TABLE>")
//writer.write("</html>")
//writer.flush();
//writer.close();
}
catch (Throwable e)
{
log.info "error: "+e;
}
{code}
我只是试图在日志中打印详细信息,但没有得到确切的输出。
注意:一旦获得输出,我将为该文件编写HTML文件。