Page 1 of 1

Update XML for CI testing

Posted: Mon Aug 03, 2015 8:09 am
by Tzahi
Hi guys,

We want to enter my tests to our CI flow, but the person who responsible for it doesn't want to wait for .exe feedback (0 - success, 1 - fail), and prefer I will update the flow xml e.g for XML:

Code: Select all

<TestResult>
  <IsPass>false</IsPass>
</TestResult>
The only way I found to implement it was by "Convert To User Code" for each step,
adding try/catch block and calling "UpdateXML" function.
Is there a simple why to do it?

Ranorex (studio) Version: 5.3.2
Thanks
Tzahi

Re: Update XML for CI testing

Posted: Tue Aug 04, 2015 2:55 pm
by Support Team
Hi Tzahi,

I am afraid I don't understand what you are trying to do.
Do you want to update the CI system after each single action which was executed by Ranorex?

Do you already know our blogs about Integration? If not, please take a look at them, since they give a good insight how you could organize it with Ranorex.
Here is the link: Integration.

Regards,
Markus

Re: Update XML for CI testing

Posted: Tue Aug 04, 2015 3:56 pm
by krstcs
I would suggest that you not try to do updates after each action. You should wait till the test is done and read the 0 or 1 returned by the exe. Both the initial work and the maintenance would be outrageous wastes of time given the limited value of the end result of semi-real-time updates.

If MY CI engineer had a problem with that (I AM my CI engineer, btw, as well as my own DBA, developer, integrator, etc.), I would tell them that that is just how Ranorex works. It will return the results at the end. But, if THEY want to do the work to make it work the way they want, they are more than welcome to write all the code.

But that's just me... :D

Re: Update XML for CI testing

Posted: Thu Aug 06, 2015 7:58 am
by Tzahi
Hi Markus,

Thanks for the link, my homework regarding CI came from Ranorex forums, and I think it's the correct way.
We actually use Nolio (no example for it but I got the idea).

Krstcs - I am sure that the correct why is to read 0 or 1 from each T.C. but the first team that start to work on it dictate the way, their way strange & complex, I simplified it by one XML and 3 status (run,fail,success).
BTW - try not to do cheers with all R&D team :wink:

Thanks guys for the info.

Re: Update XML for CI testing

Posted: Thu Aug 06, 2015 9:26 am
by swmatisa
Hello,

You can implment an IReportBuilder and generate this file easily: http://www.ranorex.com/forum/ranorex-re ... tml#p11489

Hope this helps

Re: Update XML for CI testing

Posted: Sun Aug 09, 2015 3:01 pm
by Tzahi
Hi Swmatisa,

Thanks a lot, but I stayed with XML solution (it works perfectly, I can elaborate if someone wants).
I didn't understand your solution, it looks great but I am not sure I can implement it.
It looks like a state machine (remind me Verilog :D ), that sampling the T.S.
Is it running as a different thread? different app (wpf you wrote)? which file its checks?

Anyway you gave me another idea, sampling the report data file for some data.
this file has the following values (plus many more):

Code: Select all

totalerrorcount="0"
totalwarningcount="0"
totalsuccesscount="2"
totalfailedcount="1"
totalblockedcount="0"

Re: Update XML for CI testing

Posted: Tue Aug 11, 2015 12:39 pm
by swmatisa
Hello,

In my previous sample, I have a class that send data to a wpf application.mIn your case, you can do all in Ranorex:

You must implement a little class like this (I didn't check with a compiler):

Code: Select all

using Ranorex.Core;

public class ProgressLogger : IReportLogger
{
	bool IReportLogger.PreFilterMessages {
	...
	// return always false
	}

	void IReportLogger.End()
	{
		// Write "success" of "fail" in your xml
	}
	
	
	// Treat Msg (error, warning...)
	void IReportLogger.LogData(ReportLevel level, string category, string message, object data, IDictionary<string, string> metaInfos){...}
	void IReportLogger.LogText(ReportLevel level, string category, string message, bool escape, IDictionary<string, string> metaInfos){...}

	void IReportLogger.Start()
	{
		// Write "run" in your xml
	}
}	
and call it from Main:

Code: Select all

public static int Main(string[] args)
{
	Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
	int error = 0;
	ProgressLogger l_Logger = new ProgressLogger();
	Report.AttachLogger(l_Logger);

	error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
...
Hope this helps

Re: Update XML for CI testing

Posted: Sun Sep 20, 2015 2:32 pm
by Tzahi
Hi Swmatisa,

Sorry for late response (summer time :D ).
I got your idea and love it (genius 8) ).
I didn't succeed to implement it since I got an error while try to inherit classes in Ranorex (ProgressLogger : IReportLogger).
I Even try to add Interface (the error wrote to add it), and it didn't help (somehow when I wrote it at MS-VS it worked).

Thanks a lot 8)