Hi Team,
I have been browsing about cleaning up files from ranorex folders. So, got some generic clean up folders zip file from forum. But is there way for ex. it is there in Python, we can clean up by `bin/cleanup`.
Do we have any terminal command or a file which can clean up result files, not specific folder.
You support is always appreciated. Thanks.
Clean up reports and images
Clean up reports and images
Regards,
Charu Solanki
Ranorex User
Charu Solanki
Ranorex User
Re: Clean up reports and images
Hi,
You can use simple batch commands for cleanup at the end of test. I'm using something like this in my Jenkins configuration (in post build steps).
Eventually, you can use something like this, for deleting uncompressed report files at the end of each test run, ideally, call this method as a very last line in program.cs (just before return):
You can use simple batch commands for cleanup at the end of test. I'm using something like this in my Jenkins configuration (in post build steps).
Code: Select all
echo delete success report files older than 2 days
forfiles -p "%WORKSPACE%\Reports" -s -m *_Success.rxzlog -d -2 -c "cmd /c del @path"
echo delete failed report files older than 30 days
forfiles -p "%WORKSPACE%\Reports" -s -m *_Failed.rxzlog -d -30 -c "cmd /c del @path"
echo delete bin\Reports folder
cd %WORKSPACE%\tfs\RHMonitoring\bin
rmdir /S /Q %WORKSPACE%\tfs\RHMonitoring\bin\Reports
echo delete Reports\unpacked folder
cd %WORKSPACE%\Reports
rmdir /S /Q %WORKSPACE%\Reports\unpacked
if ERRORLEVEL 1 exit 0
Code: Select all
/// <summary>
/// Delete uncompressed report files
/// </summary>
public static void DeleteUncompressedReport()
{
Ranorex.Core.Reporting.TestReport.EndTestCaseContainer();
Ranorex.Core.Reporting.TestReport.SaveReport();
List<string> listReportFiles = Ranorex.Core.Reporting.TestReport.ReportEnvironment.GetDependentFiles();
foreach(string file in listReportFiles)
{
try
{
System.IO.File.Delete(file);
}
catch (Exception e)
{
Report.Info("Unexpected exception occurred: " + e.ToString());
}
}
string pathReportImagesDir = Ranorex.Core.Reporting.TestReport.ReportEnvironment.ReportScreenshotFolderPath;
if (System.IO.Directory.Exists(pathReportImagesDir))
{
try
{
System.IO.Directory.Delete(pathReportImagesDir);
}
catch (Exception e)
{
Report.Info("Unexpected exception occurred: " + e.ToString());
}
}
}
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Clean up reports and images
Hey,
I have executed the same. Added this module before return errors and called it in logout function. But still I can find reports present in reports folder. PFA, if it can help in identification of proceeding wrong steps.
I have executed the same. Added this module before return errors and called it in logout function. But still I can find reports present in reports folder. PFA, if it can help in identification of proceeding wrong steps.
You do not have the required permissions to view the files attached to this post.
Regards,
Charu Solanki
Ranorex User
Charu Solanki
Ranorex User
Re: Clean up reports and images
Output folder and logout function call.
You do not have the required permissions to view the files attached to this post.
Regards,
Charu Solanki
Ranorex User
Charu Solanki
Ranorex User
Re: Clean up reports and images
Hello csolanki,
You wrote: "Added this module before return errors and called it in logout function." I think it does not really matter where you add the method. However, it does matter where you call it. You need to call it before return not in logout function:
Does this help?
Regards,
McTurtle
You wrote: "Added this module before return errors and called it in logout function." I think it does not really matter where you add the method. However, it does matter where you call it. You need to call it before return not in logout function:
Does this help?
Regards,
McTurtle
You do not have the required permissions to view the files attached to this post.
Re: Clean up reports and images
Hi csolanki,
McTurtle is right! It must be called as a very last thing in Program.cs, just before return.
McTurtle is right! It must be called as a very last thing in Program.cs, just before return.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Clean up reports and images
Hey Mcturtle and Odklizec,
Thanks a lot for helping me out. It worked after addition of delete method in program.cs.
Regards,
Charu Solanki
Thanks a lot for helping me out. It worked after addition of delete method in program.cs.
Regards,
Charu Solanki
Regards,
Charu Solanki
Ranorex User
Charu Solanki
Ranorex User