Wednesday, 16 January 2013

Creating Custom Report File

Creating Custom Report File
(Reference: CreateXML)
(See Previous Blog)
'*******************************************************************************************************************************************
'*  Function     : createCustomReportFile
'*******************************************************************************************************************************************
Function createCustomReportFile(ByVAL Desc)

 Desc = Desc & "->" & Now
 'Initializing the file system object
 Set objFile = createobject("Scripting.FileSystemObject")

 On Error Resume Next
 If objFile.FileExists(Environment.Value("REPORT_NAME"))  Then 
  Set customReport = XMLUtil.CreateXML()
  customReport.LoadFile Environment.Value("REPORT_NAME")
  Set root = customReport.GetRootElement()  
  Set TestSuite=root.ChildElements().Item(1)
 Else
  Call CreateXML()
  Set root = customReport.GetRootElement()
  root.AddChildElementByName "TestSuite",Desc
  Set TestSuite=root.ChildElements().Item(1)
  TestSuite.AddAttribute "startTime" ,cstr(Now)
  TestSuite.AddAttribute "Desc", Desc
 End If     
  
End Function

No comments:

Post a Comment