convert Ranorex.Core.Reporting.Activity on Ranorex7

Class library usage, coding and language questions.
jjiang1
Posts: 10
Joined: Tue Oct 18, 2016 1:03 am

convert Ranorex.Core.Reporting.Activity on Ranorex7

Post by jjiang1 » Tue May 09, 2017 12:14 am

After i upgrade my Ranorex studio to 7, i have the error "Argument 1: cannot convert from 'Ranorex.Core.Reporting.Activity' to 'Ranorex.Libs.Xml.IXmlPrintable' (CS1503). I don't have this issue on 6.2

My code is like in below

var item = Ranorex.Core.Reporting.ActivityStack.Instance.RootActivity;
string documentStr;
using (var ms = new System.IO.MemoryStream())
{
var sw = new System.IO.StreamWriter(ms, new UTF8Encoding(false));
var xmlPrinter = XmlPrinter.BeginDocument(sw, false);
xmlPrinter.Print(item).CompleteDocument();
documentStr = new UTF8Encoding(false).GetString(ms.ToArray());
}
the errors happened on line7. which can't convert reporting.activity to xmlPrintable
How should i fix this?

McTurtle
Posts: 191
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: convert Ranorex.Core.Reporting.Activity on Ranorex7

Post by McTurtle » Tue May 09, 2017 11:05 am

Hello jjiang1,

Is the Ranorex-To-XUnit template what you are referring to? Ranorex-To-XUnit

You might want to read this forum post: Empty xUnit transformation after upgrading to 7.0 [SOLVED]

As stated in the above forum post, the JUnit compatible report can now be created automatically. You can read more about this in our user guide at the following link: JUnit-compatible reports

Please let the forum community know if this helped.

Regards,
McTurtle

jjiang1
Posts: 10
Joined: Tue Oct 18, 2016 1:03 am

Re: convert Ranorex.Core.Reporting.Activity on Ranorex7

Post by jjiang1 » Tue May 16, 2017 11:57 pm

Thank you McTurtle, you reply works for me