Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Listeners can't get any info about expectedExceptions?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jweiss  
View profile  
 More options Jun 26, 12:39 pm
From: jweiss <jeffrey.m.we...@gmail.com>
Date: Fri, 26 Jun 2009 09:39:58 -0700 (PDT)
Local: Fri, Jun 26 2009 12:39 pm
Subject: Listeners can't get any info about expectedExceptions?
Hi,

I am starting to use the "expectedExceptions" annotation to test (for
instance) invalid input to my application.

The problem I'm having is that I want something printed to stdout that
when I expect an exception and didn't get one, I want to see what
exception was expected.   I have an implementation of IResultListener,
ISuiteListener that can print the throwable when in fact the test
passes with the expected exception, but I can't handle the case where
the test fails.  TestNG just prints that it expected an exception, but
doesn't say which one(s).


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Jun 26, 4:51 pm
From: Cédric Beust ♔ <cbe...@google.com>
Date: Fri, 26 Jun 2009 13:51:07 -0700
Local: Fri, Jun 26 2009 4:51 pm
Subject: Re: [testng-users] Listeners can't get any info about expectedExceptions?

On Fri, Jun 26, 2009 at 9:39 AM, jweiss <jeffrey.m.we...@gmail.com> wrote:

> Hi,

> I am starting to use the "expectedExceptions" annotation to test (for
> instance) invalid input to my application.

> The problem I'm having is that I want something printed to stdout that
> when I expect an exception and didn't get one, I want to see what
> exception was expected.   I have an implementation of IResultListener,
> ISuiteListener that can print the throwable when in fact the test
> passes with the expected exception, but I can't handle the case where
> the test fails.  TestNG just prints that it expected an exception, but
> doesn't say which one(s).

Ah, it looks like the error message is okay when no exception is thrown:

Method test.tmp.A.f() should have thrown an exception of class
java.lang.NumberFormatException

But when the wrong exception is thrown, it's not very verbose:

FAILED: f
java.lang.RuntimeException
    at test.tmp.A.f(A.java:37)

I agree that for the second case, the message should be "Expected
NumberFormatException, but got RuntimeException".

Is this what you're asking?

--
***Cédric
*


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Jun 26, 6:32 pm
From: Cédric Beust ♔ <cbe...@google.com>
Date: Fri, 26 Jun 2009 15:32:18 -0700
Local: Fri, Jun 26 2009 6:32 pm
Subject: Re: [testng-users] Listeners can't get any info about expectedExceptions?

Hi Jeffrey,

I just fixed this, can you try the beta and let me know?

http://testng.org/beta

--
Cedric

2009/6/26 Cédric Beust ♔ <cbe...@google.com>

--
***Cédric
*

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google