Forum Discussion
TNeuschwanger
2 years 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
- deanding2 years 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
- 7 years ago
- 9 years ago
- 9 months ago
Recent Discussions
- 4 days ago
- 9 days ago