How to export additional columns from Ranorex to TestRail

Best practices, code snippets for common functionality, examples, and guidelines.
syartsev
Posts: 13
Joined: Thu Aug 10, 2017 4:54 pm

How to export additional columns from Ranorex to TestRail

Post by syartsev » Fri Nov 16, 2018 8:09 pm

Hi,
I'm trying to export test cases from Ranorex to TestRail, but getting only id and title without a Description in Test Rail test suite.
Is there any work around to get Description as well?
You do not have the required permissions to view the files attached to this post.

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: How to export additional columns from Ranorex to TestRail

Post by qwertzu » Mon Nov 19, 2018 12:55 pm

Hi,
As far s I know, in TestRail there does not exist something like a "description" field for test cases.
Therefore, Ranorex can't export a TestCase description.
regards, qwetzu

ShaneP12
Posts: 1
Joined: Sun Dec 09, 2018 7:00 pm

Re: How to export additional columns from Ranorex to TestRail

Post by ShaneP12 » Sun Dec 09, 2018 7:03 pm

syartsev wrote:
Fri Nov 16, 2018 8:09 pm
Hi,
I'm trying to export test cases from Ranorex to TestRail, but getting only id and title without a Description in Test Rail test suite.
Is there any work around to get Description as well?
I am also having similar issue. If someone can help that would be great.

Regards.
Shane.

syartsev
Posts: 13
Joined: Thu Aug 10, 2017 4:54 pm

Re: How to export additional columns from Ranorex to TestRail

Post by syartsev » Thu Dec 20, 2018 6:51 pm

I wrote a code, that converts description into a title and after that ran integration tool with testrail.

Note: each TestCase should have a description, otherwise null exception.
Or you can handle it by editing the following code :)

Code: Select all

using System.Xml;
using System.Xml.Linq;
{
			XmlDocument xml = new XmlDocument();			
			string path = @"C:\path_to_your_project\you_test_suite_name.rxtst";
			xml.Load(path);
			
			var children = xml.SelectNodes("testsuitedoc/testsuiteentryhierarchy/flatlistofchildren/testcase");
			XmlCDataSection cData;
			
			foreach(XmlNode child in children){
				Report.Info(child.Attributes[1].Value);
				cData = child.SelectSingleNode("description").OfType<XmlCDataSection>()?.First();
				string desc = cData.Value;
				
				desc= Regex.Replace(desc, "\\[.*\\]", String.Empty).TrimStart().TrimEnd();
				desc= Regex.Replace(desc, "<.*?>", String.Empty);
				desc= desc.Replace("\r", String.Empty);
				desc= desc.Replace("\n", String.Empty);
				desc= Regex.Replace(desc, "&.*?;", String.Empty);
				child.Attributes[1].Value = desc;
			}	
			xml.Save(@path);
	}