How to use style.xml with ReportToPDFModule

Best practices, code snippets for common functionality, examples, and guidelines.
fablich
Posts: 6
Joined: Mon Feb 19, 2018 9:18 am

How to use style.xml with ReportToPDFModule

Post by fablich » Tue Feb 20, 2018 9:08 am

Hello,

I am facing an issue with the ReportToPDFModule (1.0.13) on Ranorex 8.0.1 using Windows 7 SP1.

I am using the ReportToPDF Module though Ranorex Automation Helper. The ReportToPDFModule is placed in the teardown section of my testcase. As long as I define the XML variable in ReportToPDFModule.cs it creates no PDF file.
So this creates a standard pdf document

Code: Select all

        public ReportToPDFModule()
        {
            //Init variables
            this.registered = false;
            this.PdfName = "";
            this.Xml = "";

            //Possible values: none | failed | all
            this.Details = "all";

        }
And changing the xml variable results in no generated PDF at all. And sadly no error message.

Code: Select all

        public ReportToPDFModule()
        {
            //Init variables
            this.registered = false;
            this.PdfName = "";
            this.Xml = "./style.xml";

            //Possible values: none | failed | all
            this.Details = "all";

        }
My Projekt looks like this:
Solution Test

Code: Select all

Solution
+---Solution Items
¦
+---Test-A
¦
+---Test-ModuleLibary
¦ 
+---RanorexAutomationHelpers
    +---...
    ¦
    +---Modules
    +---Modules
        +---...
        +---ReportToPDFModule.cs
        +---style.xml
        +---...
I tried differend types of path definition, relative and absolut. And I also tried different places to store the style.xml.
The "Copy to output direcoty" property is set for ReportToPDFModule.cs

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to use style.xml with ReportToPDFModule

Post by Support Team » Thu Feb 22, 2018 11:35 am

Hi fablich,

Please ensure to correctly bind the necessary properties.

Example configuration:
ReportToPDFBinding.png
ReportToPDFBinding.png (18.64 KiB) Viewed 542 times
To check if there is an error within your style.xml, please add a Console.ReadKey() to the Program.cs file:
try
            {
                error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
            }
            catch (Exception e)
            {
                Report.Error("Unexpected exception occurred: " + e.ToString());
                error = -1;
            }
            
            Console.ReadLine();
            return error;
The error message will be logged to the console.

I hope this helps.

Sincerely,
Robert
.
Image

fablich
Posts: 6
Joined: Mon Feb 19, 2018 9:18 am

Re: How to use style.xml with ReportToPDFModule

Post by fablich » Fri Feb 23, 2018 10:38 am

Thanks for your reply,
I don't know what detail now made the difference, but it works now on my local machine.

Sadly I've run into another issue within my organisation. It seems that the file-ending "pdf.exe" is banned from our standard clients. As the standard-clients are the base of our virtual-machines, our ranorex runetime client VMs can not store the "Ranorex.PDF.exe" file.

Maybe other users are facing the same issue? Is it possible to rename the "Ranorex.PDF.exe"-File to "RanorexPDF.exe" or something similar?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to use style.xml with ReportToPDFModule

Post by Support Team » Mon Feb 26, 2018 10:53 am

Hi fablich,

I'm glad that we could help.

I'm afraid that we can't easily change the name of the "Ranorex.PDF" executable, because their might be several customer, which already added the executable to their anti-virus whitelists etc.

I would highly recommend to allow just this specific file. You should still be able to block the general PDF.exe files.

Thank you for your understanding.

Sincerely,
Robert
.
Image

fablich
Posts: 6
Joined: Mon Feb 19, 2018 9:18 am

Re: How to use style.xml with ReportToPDFModule

Post by fablich » Wed Feb 28, 2018 9:51 am

We are now using the Ranorex.PDF.dll File for the PDF-Report-Generation. Hopefully this dll will work with further Ranorex-Versions.
Whitelisting this file is not likely to happen since we test within our standard client configuration, which is deployed for >10k Windows Desktops.
Yesterday we had the Ranorex Foundation Level Training and one of my collegues wanted to send his Ranorex-Test-Solution via Gmail. Sadly even Gmail detects the Ranorex.PDF.exe inside a ZIP as a Virus.

Maybe you find a solution for a variarity of costumers since a Filename .PDF.exe is likely to be detected by a range of anti-virus mechanisms?

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

Re: How to use style.xml with ReportToPDFModule

Post by RobinHood42 » Fri Mar 02, 2018 2:28 pm

Hey,

In my opinion sending .exe files via email in not a good idea in general. Most email providers, including Gmail, don't allow sending executable files.
File types blocked in Gmail

Cheers,
Robin

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

Re: How to use style.xml with ReportToPDFModule

Post by natesun » Wed Oct 17, 2018 4:28 pm

Hi Support team,

I am also trying to use ReportToPDFModule, and if I leave everything by default without binding any variable, the pdf report will be generated automatically. However, if I bind $Xml with style.xml, no pdf will be generated. Do I miss anything?

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

Re: How to use style.xml with ReportToPDFModule

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

Hi,

Please checkout the following post: viewtopic.php?f=20&t=12785&p=51070#p51070

Cheers,
Robin

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

Re: How to use style.xml with ReportToPDFModule

Post by natesun » Fri Oct 19, 2018 3:12 pm

Thanks Robin,

It turned out the logo path was incorrect. After rebind everything and corrected the logo path, a custom PDF was generated.