Page 1 of 1

How to Get the Number of test cases Executed from code

Posted: Tue Apr 09, 2013 8:30 am
by pramoodd
Hi Admin,
I want to know the number of testcases executed and their results from code (Programmatically).

I want to display the below values in my mail.

No. of test cases executed:x+y
No. of test cases passed:x
No. of test cases failed:y

Re: How to Get the Number of test cases Executed from code

Posted: Tue Apr 09, 2013 1:57 pm
by swmatisa
Hello,

I did it with the IReportBuilder interface:
http://www.ranorex.com/forum/ranorex-re ... tml#p11489

Re: How to Get the Number of test cases Executed from code

Posted: Tue Apr 09, 2013 2:38 pm
by pramoodd
Thanks for the reply.
can you please provide me how to use it.
I am not a pro in c#.
I need a small piece of code for implantation, so that I can use it in my project.

Re: How to Get the Number of test cases Executed from code

Posted: Tue Apr 09, 2013 4:11 pm
by swmatisa
Hello,
pramoodd wrote:I am not a pro in c#.
I need a small piece of code for implantation, so that I can use it in my project.
I cannot send you a C# full project working, but you must create a class that implement IReportLogger.LogText and IReportLogger.LogData.

I gave the big part of the code in my previous post: http://www.ranorex.com/forum/ranorex-re ... tml#p11489
using System;
using Ranorex.Core;

namespace TestRanorex
{
	/// <summary>
	/// Description of CustomReportLogger.
	/// </summary>
	public class CustomReportLogger : IReportLogger
	{
		public CustomReportLogger()
		{
		}
		
		
		public bool PreFilterMessages {
			get {
				return false;
			}
		}
		
		public void Start()
		{
			// Init
		}
		
		public void End()
		{
			// Send results
		}
		
		public void LogText(Ranorex.ReportLevel level, string category, string message, bool escape, System.Collections.Generic.IDictionary<string, string> metaInfos)
		{
			// Call to the specific code
		}
		
		public void LogData(Ranorex.ReportLevel level, string category, string message, object data, System.Collections.Generic.IDictionary<string, string> metaInfos)
		{
			// Call to the specific code (same as LogText)
		}
	}
}

Re: How to Get the Number of test cases Executed from code

Posted: Tue Apr 09, 2013 4:31 pm
by pramoodd
thanks again for sending the format.

I just got a question.
Where should I place the code(the code which u mention in the previous post) right now?
LogText or LogData ?

I understood that the SendUpdate() method is to pass the final o/p values.


thanks advance.

Re: How to Get the Number of test cases Executed from code

Posted: Wed Apr 10, 2013 7:10 am
by swmatisa
pramoodd wrote:Where should I place the code(the code which u mention in the previous post) right now?
LogText or LogData ?
Both
pramoodd wrote: understood that the SendUpdate() method is to pass the final o/p values.
Yes, you must write this function to send the mail or save to file or ...