How to Get the Number of test cases Executed from code

Class library usage, coding and language questions.
pramoodd
Posts: 13
Joined: Tue Mar 26, 2013 8:45 am

How to Get the Number of test cases Executed from code

Post by pramoodd » Tue Apr 09, 2013 8:30 am

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

swmatisa
Posts: 123
Joined: Fri Aug 05, 2011 7:52 am

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

Post by swmatisa » Tue Apr 09, 2013 1:57 pm

Hello,

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

pramoodd
Posts: 13
Joined: Tue Mar 26, 2013 8:45 am

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

Post by pramoodd » Tue Apr 09, 2013 2:38 pm

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.

swmatisa
Posts: 123
Joined: Fri Aug 05, 2011 7:52 am

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

Post by swmatisa » Tue Apr 09, 2013 4:11 pm

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)
		}
	}
}
SW

pramoodd
Posts: 13
Joined: Tue Mar 26, 2013 8:45 am

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

Post by pramoodd » Tue Apr 09, 2013 4:31 pm

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.

swmatisa
Posts: 123
Joined: Fri Aug 05, 2011 7:52 am

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

Post by swmatisa » Wed Apr 10, 2013 7:10 am

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 ...
SW