Forum Discussion
pford90
11 years agoOccasional 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();
}
}
}
Related Content
- 2 years agoKimdongart1