Forum Discussion

pford90's avatar
pford90
Occasional Contributor
11 years ago

does not create log file if teststep name too long

Hello all,

After running my testsuites I log the results of each of those test steps. However when I have a REST Test Request that contains a long name (* over 25 characters) it does not log the result of that test step or the results of any test step that follows it.

*Note I only have this problem with REST Request, with Groovy Test Step SoapUI logs the results without any problems, regardless of test step name length.

If you could take a look into this it would be greatly apperciated.

Thank you

4 Replies

  • Hi,

    How are you logging the results of the test step? In the TestSuite Log tab in the GUI the results of the test steps are there if a REST request test step name is longer than 25 characters.
  • pford90's avatar
    pford90
    Occasional Contributor
    I wrote a tear down script at the end of the project that saves all the TestStep's results into files
  • pford90's avatar
    pford90
    Occasional Contributor
    def homeDir = project.getPropertyValue("HomeDirectory");

    def failedTestSuiteDir = new File( homeDir + "\\" + "Failed TestSuites" );
    def passedTestSuiteDir = new File( homeDir + "\\" + "Passed TestSuites" );

    failedTestSuiteDir.mkdir();
    passedTestSuiteDir.mkdir();

    for( testSuiteRunner in runner.results )
    {
    def testSuite = testSuiteRunner.getTestSuite();
    def status = testSuiteRunner.getStatus().toString();
    def path = passedTestSuiteDir.absolutePath

    if( status == "FAILED" )
    {
    path = failedTestSuiteDir.absolutePath;
    }

    def testSuiteDir = new File( path + "\\" + testSuite.name );
    testSuiteDir.mkdir();

    def errorsDir = new File( testSuiteDir.absolutePath + "\\" + "errors\\" );
    def finishedDir = new File( testSuiteDir.absolutePath + "\\" + "success\\" );

    errorsDir.mkdir();
    finishedDir.mkdir();

    for( testCaseResult in testSuiteRunner.getResults() )
    {
    def testCasePath = finishedDir.absolutePath;

    if( testCaseResult.getStatus().toString() == 'FAILED' )
    {
    testCasePath = errorsDir.absolutePath;
    }

    def testCaseDir = new File( testCasePath + "\\" + testCaseResult.getTestCase().name );
    testCaseDir.mkdir();

    for( testStepResult in testCaseResult.getResults() )
    {
    def testStepResultFile = new FileOutputStream( testCaseDir.absolutePath + '//' + testStepResult.testStep.label + '.txt', true );

    def pw_testStepResultFile = new PrintWriter( testStepResultFile );
    testStepResult.writeTo( pw_testStepResultFile )
    pw_testStepResultFile.close();
    testStepResultFile.close();
    }
    }
    }