Save the below script as archive_utility.vbs and add this in startup'archive utility - Created on 24 -August-2012 by k.s.karthikeyan@gmail.comDim objFSOstrFilename = "emailable-report"strExtn = ".html"strFilename2 = "testng-failed"strExtn2 = ".xml"strSourceFolder = "c:\ebox\Karthik\2\MyProject\test-output"'strSourceFolder1 = Replace(strSourceFolder,"\","\\\\")'Wscript.echo strSourceFolder1strDestFolder = "c:\Documents and Settings\ksankarappan\Desktop\archive\"strComputer = "."Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & _strComputer & "\root\cimv2")Set colMonitoredEvents = objWMIService.ExecNotificationQuery _("Select * From __InstanceCreationEvent Within 5 Where " _& "Targetinstance Isa 'CIM_DirectoryContainsFile' and " _& "TargetInstance.GroupComponent= " _& "'Win32_Directory.Name=""c:\\\\ebox\\\\Karthik\\\\2\\\\MyProject\\\\test-output""'")DoSet objLatestEvent = colMonitoredEvents.NextEventtemp = objLatestEvent.TargetInstance.PartComponenttemp = Replace(Mid(temp, InStr(temp, Chr(34)) + 1), "\\", "\")temp = Left(temp, Len(temp) - 1)Wscript.Echo tempWscript.Echo strSourceFolder & "\" & strFilename2 & strExtnif temp = strSourceFolder & "\" & strFilename & strExtn ThenSet objFSO = CreateObject("Scripting.FileSystemObject")Today = "_" + Replace(Date, "/", "_") + "_" + Replace(FormatDateTime(Time, 3), ":","_")objFSO.MoveFile strSourceFolder & "\" & strFilename & strExtn, strDestFolder & strFilename & Today & strExtn'Wscript.echo "Emailable-Report.html is moved to the path : " & strDestFolderEnd Ifif temp = strSourceFolder & "\" & strFilename2 & strExtn2 ThenSet objFSO2 = CreateObject("Scripting.FileSystemObject")Today = "_" + Replace(Date, "/", "_") + "_" + Replace(FormatDateTime(Time, 3), ":","_")objFSO2.MoveFile strSourceFolder & "\" & strFilename2 & strExtn2, strDestFolder & strFilename2 & Today & strExtn2'Wscript.echo "testng-failed.xml is moved to the path : " & strDestFolderEnd IfLoop
Wednesday, July 30, 2014
Archive Test Results after every run
Subscribe to:
Post Comments (Atom)
Nice Post.. Can you please share for Java also
ReplyDeletehere you go... http://castawaytester.blogspot.in/2014/09/archive-test-reports.html
Delete