How I can review the test result by Verify method?

Feb 23, 2010 at 12:26 AM

Hi All,

I am using White.NUnit to verify the test result rather than Assert method

and the test will pass even some steps of it should fail.

How can i get the report of these failed steps by Verify method?

 

Thanks a lot!

Feb 23, 2010 at 3:13 AM

Hi,

    If you are using Assert Method ,Just put this Assert Method in Try Catches block .

    It will called Verify method ,so it will give the error message to you.

Thanks & Regards,

NALINI P| Software Development.


MicroNet TechNicks (I) Pvt Ltd.

From: threesun [mailto:notifications@codeplex.com]
Sent: Tuesday, February 23, 2010 6:56 AM
To: npaladugu@micronettechnicks.com
Subject: How I can review the test result by Verify method? [white:155417]

From: threesun

Hi All,

I am using White.NUnit to verify the test result rather than Assert method

and the test will pass even some steps of it should fail.

How can i get the report of these failed steps by Verify method?

Thanks a lot!

Read the full discussion online.

To add a post to this discussion, reply to this email (white@discussions.codeplex.com)

To start a new discussion for this project, email white@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Feb 23, 2010 at 4:56 AM

Hi Nalini,

Thanks for reply. But I am confused about it.

I will give a short example to describe my question:

1. I am using Assert method, if the test failed, I can see the error message 'title line 3 does not match'.

 

Assert.IsTrue(txtLine3.Text.Equals(titleLine3), "title line 3 does not match");

 

 

2.  i am using Verify method, the test case will keep going even some of the verifies actually failed.

In the end, I got a PASSED, and no error message.

 

Verify.IsTrue(txtLine1.Text.Equals(titleLine1), "title line 1 does not match");
Verify.IsTrue(txtLine2.Text.Equals(titleLine2), "title line 2 does not match");
Verify.IsTrue(txtLine3.Text.Equals(titleLine3), "title line 3 does not match");

 

 

How can I use Verify method to keep the test case running and collect the error message after all test case finished?

Thanks!

Feb 23, 2010 at 7:51 AM

1)

private StringBuilder verificationErrors=new StringBuilder();

Try

{

Assert.IsTrue(txtLine3.Text.Equals(titleLine3), "title line 3 does not match");

}

catch (AssertionException e)

{

verificationErrors.Append(e.Message);

}

2)

Try

{

Assert.IsTrue(txtLine3.Text.Equals(titleLine3), "title line 3 does not match");

}

catch (AssertionException e)

{

Throw e;

}

If you know string builder concept try 1st one other wise try 2nd one

Thanks & Regards,

NALINI P| Software Development.


MicroNet TechNicks (I) Pvt Ltd.

From: threesun [mailto:notifications@codeplex.com]
Sent: Tuesday, February 23, 2010 11:26 AM
To: npaladugu@micronettechnicks.com
Subject: Re: How I can review the test result by Verify method? [white:155417]

From: threesun

Hi Nalini,

Thanks for reply. But I am confused about it.

I will give a short example to describe my question:

1. I am using Assert method, if the test failed, I can see the error message 'title line 3 does not match'.

Assert.IsTrue(txtLine3.Text.Equals(titleLine3), "title line 3 does not match");

2. i am using Verify method, the test case will keep going even some of the verifies actually failed.

In the end, I got a PASSED, and no error message.

Verify.IsTrue(txtLine1.Text.Equals(titleLine1), "title line 1 does not match");
Verify.IsTrue(txtLine2.Text.Equals(titleLine2), "title line 2 does not match");
 
Verify.IsTrue(txtLine3.Text.Equals(titleLine3), "title line 3 does not match");
 

How can I use Verify method to keep the test case running and collect the error message after all test case finished?

Thanks!

Read the full discussion online.

To add a post to this discussion, reply to this email (white@discussions.codeplex.com)

To start a new discussion for this project, email white@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Feb 23, 2010 at 8:52 AM

in my opinion this is not a good solution to catch Assertions :)

 

If I don't wan't my test to break you can define a simple class which collect "warnings" if occur in a List and at the end of the test you verify that the List is empty

if not => Assert.Fail(errors.ToString);

 

or you can use Trace.WriteLine(message) if you never want to break the test because of warnings

 

Throndorin

Feb 23, 2010 at 9:35 PM

Thanks guys.

I thought the Verify method provides some way to collect the error msg itself!

I will try to create custom class to collect the error msg

Thanks again,

Leo

 

Feb 24, 2010 at 7:24 AM
threesun wrote:

Thanks guys.

I thought the Verify method provides some way to collect the error msg itself!

I will try to create custom class to collect the error msg

Thanks again,

Leo

 

I think that you are right , but the documentation does not explain how to get the verify collection

so maybe viveksingh can say something more about this.

 

Feb 24, 2010 at 2:43 PM

// At the end of your test

Verify.AssertResults();  // output all collected errors

Verify.CleanUp();        // otherwise your next test will be marked as failed, too

Feb 25, 2010 at 12:53 AM
MichaelPoliakov wrote:

// At the end of your test

Verify.AssertResults();  // output all collected errors

Verify.CleanUp();        // otherwise your next test will be marked as failed, too

great! thanks a lot