XML file not found error while using ReportToPDF module from automation helpers.

Best practices, code snippets for common functionality, examples, and guidelines.
krishna91
Posts: 3
Joined: Mon Oct 15, 2018 10:28 am

XML file not found error while using ReportToPDF module from automation helpers.

Post by krishna91 » Mon Oct 15, 2018 10:36 am

Hi Team,

I am facing issue with ReportToPDF module in ranorex automation helpers library. After executing my suit I am getting an error message 'XML file not found' . Kindly support.

Thanks and Regards
Krishna

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by odklizec » Mon Oct 15, 2018 11:51 am

Hi,

My guess is, that the 'Xml' variable (used in ReportToPDFModule file) is not bound to the data connector of your choice? Either this, or the XML file is not where the Xml variable points?

BTW, it seems the style sheet xml is not a part of Ranorex automation helpers, so I think you must download it here:
https://www.ranorex.com/blog/ranorex-re ... onversion/
Pavel Kudrys
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

krishna91
Posts: 3
Joined: Mon Oct 15, 2018 10:28 am

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by krishna91 » Tue Oct 16, 2018 7:19 am

Hi,

Thanks for your update.

I have given values for the below three variables through data binding in ReportToPDF module. Still after running the suit its showing the error "xml file not found". Could you please explain how to make it work.

PDFName
XML
Details

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by odklizec » Tue Oct 16, 2018 7:59 am

Hi,

Could you please post complete Ranorex report, with error you are getting? Are you sure the XML file is at pointed path (by data connector)?
Pavel Kudrys
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

krishna91
Posts: 3
Joined: Mon Oct 15, 2018 10:28 am

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by krishna91 » Thu Oct 18, 2018 1:48 pm

Hi,

In the ranorex report there is no specific error message visible.

I am getting the xml not found error in the command prompt.

Could you please help me on it. Actually I need to know where to find the xml file or its already there in the helper library ?
and

What value we should give for the xml variable in data binding of ReportToPDF module ?

Kindly support.

User avatar
RobinHood42
Posts: 324
Joined: Fri Jan 09, 2015 3:24 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by RobinHood42 » Fri Oct 19, 2018 8:18 am

Hi,

The value of the XML parameter must be either empty or contain the correct path to your custom stylesheet.xml.

The stylesheet template can be found here: stylesheet

Cheers,
Robin

natesun
Posts: 14
Joined: Wed Oct 17, 2018 4:05 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by natesun » Fri Oct 19, 2018 8:57 pm

I've experienced that even my path is correct and I am able to change custom logo PDF in my local environment, when running through Jenkins on other VM, the binding is just not working. If I bind xml variable, no PDF would generate.

User avatar
RobinHood42
Posts: 324
Joined: Fri Jan 09, 2015 3:24 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by RobinHood42 » Mon Oct 22, 2018 10:02 am

Hi,

I'm pretty sure that the stylesheet.xml is simply not found on your Jenkins environment. Try to place the file to a local folder, e.g. "C:\temp\stylesheet.xml" and bind that value. Ensure that the file is available on your Jenkins slave and you should be fine.

Cheers,
Robin

natesun
Posts: 14
Joined: Wed Oct 17, 2018 4:05 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by natesun » Mon Oct 22, 2018 4:52 pm

Thanks for your reply Robin,

I found all the files on the VM just as if on my local machine, however, binding with xml does not seem to work in my VM environment even if custom logo path is correct.

User avatar
RobinHood42
Posts: 324
Joined: Fri Jan 09, 2015 3:24 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by RobinHood42 » Tue Oct 23, 2018 11:28 am

Hi,

I'm out of ideas. To further analyse the issue, we would need the error message you receive. You can add a "Console.ReadKey()" to the end of your Program.cs file to ensure the CMD window remains open, once the test finishes:
 
.......
catch (Exception e)
            {
                Report.Error("Unexpected exception occurred: " + e.ToString());
                error = -1;
            }
            
            //------------------------------------------------------Add the code here !! ------------------------------------------------------
            Console.ReadKey();
            return error;
Within the console window, you'll receive an error message in case the ReportToPDF generation failed.

Cheers,
Robin

natesun
Posts: 14
Joined: Wed Oct 17, 2018 4:05 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by natesun » Tue Oct 23, 2018 6:07 pm

Thanks so much for the help. So I finally figured out that in my VM I have to use absolute path for my logo file, but in my local relative path works just fine to bind xml custom log path.

I have a structure like this in my local C:\My Project\folder1\folder2\folder3, and my xml file locates in folder3, my custom image file locates in folder2. The path works just fine with "../custom.png". But this does not work for my VM environment.

In my VM there is similar structure C:\Jenkins\workspace\folder1\folder2\folder3, if my xml file locates in folder 3, using relative path just does not work, the error is "ReportToPDF: No valid logo defined". If I change the path to absolute path and locates it in folder2, like "C:/Jenkins/workspace/folder1/folder2/custom.png" this works fine.

Now I try to use wild card in the path and it does not accept. Basically I want to replace folder1 and folder2, but none of the following works, any suggestion?

"C:/Jenkins/workspace/../../custom.png"
"C:/Jenkins/workspace/**/custom.png"
"C:/Jenkins/workspace//custom.png"

User avatar
RobinHood42
Posts: 324
Joined: Fri Jan 09, 2015 3:24 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by RobinHood42 » Thu Oct 25, 2018 1:31 pm

Hi,

Please note, that the structure/working directory of your local test run and your Jenkins run might be different!

I just tried to specify a custom logo for my PDF conversion and it works flawlessly.

You can use the following notation to "navigate" to your logo image:

logo.png is directly located within the same folder as the test executable:
 <global toc="true" logo=".\logo.png"

logo.png is located within the parent folder of the test executable:
 <global toc="true" logo=".\..\logo.png"

logo.png is located within the parent folder of the parent folder of the test executable:
 <global toc="true" logo=".\..\..\logo.png"
Hope this helps.

Cheers,
Robin

natesun
Posts: 14
Joined: Wed Oct 17, 2018 4:05 pm

Re: XML file not found error while using ReportToPDF module from automation helpers.

Post by natesun » Fri Oct 26, 2018 8:10 pm

Hi Robin,

Thanks so much for your additional explanation. It worked this time, and my confusion was the custom log relative to my style.xml not the executable. After define the relative path to executable everything worked as you said.

It would be beneficial if we can add these examples to the release document to help someone with limited experience.

Cheers,
Nate