0

I am in the middle of generating the summary report for test execution, but I am not sure where it went wrong.

Below is the code I used in the set up script: {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

Below is the code for tear down scripts:

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}

I am just trying to print the details in the log but I am not getting exact output.

Note: once i get the output I will be writing the HTML file for the same.

gudok
  • 4,029
  • 2
  • 20
  • 30
  • 1
    hello, what is actually your output ? which information is missing and which one do you get as expected ? – A.Joly Feb 12 '19 at 07:00
  • Currently the file is getting created and log.info shows only null values with some exception... My expectation is just to print the test case name and status from test suite.. so that it will be helpful for reporting part – Nagoor Meeran Feb 12 '19 at 18:58
  • @NagoorMeeran, can you please take a look at this thread to see if that helps? https://stackoverflow.com/questions/41700437/creating-a-test-report-from-project-level-tear-down-script/41759553#41759553 – Rao Feb 13 '19 at 07:31
  • Thanks @Rao it really helps me.hence closing this question – Nagoor Meeran Feb 14 '19 at 04:14

0 Answers0