Forum Discussion
TNeuschwanger
10 months agoChampion Level 1
Hello deanding
def pName = context.currentStep.testCase.testSuite.project.name //get project name
def pDate = new Date().format( 'yyyyMMdd' )//get current date
def sDate = pDate.toString()//convert date to string
def pTestSuite = context.currentStep.testCase.testSuite.name//get TestSuite name
def pTestCase = context.currentStep.testCase.name//get TestCase name
pTestCase = pTestCase.replaceAll("\\W", "-");
def filePath = 'E:/Data/Dean Ding/CRD files/CRD_results_test/'+pName+'_'+sDate+'/'+pTestSuite+'/'+pTestCase+'/'//compose the folder path
File file = new File(filePath)
if (!file.exists()) file.mkdirs()//create the destination folder
fos = new FileOutputStream(filePath+ testStepResult.testStep.label + '.txt', true)
pw = new PrintWriter( fos )
testStepResult.writeTo( pw )
pw.close()
fos.close()
Regards,
Todd
- deanding10 months agoNew Contributor
TNeuschwanger Thanks, I tried your code but still not worked,the step name is still not the name what I specified and not replace these special symbols, the test result file is empty as we;;
Related Content
- 2 years ago
- 2 years ago
- 6 years ago
- 2 years ago