Expected exception messages

398 views
Skip to first unread message

Daniel R.

unread,
Dec 2, 2009, 5:25:40 PM12/2/09
to testng-users
I have seen this discussion before and Cedric has mentioned that this
could be an enhancement. We are starting to need to expect exceptions
with a particular message (in addition to an exception type), which
could be specified as a regular expression. As it stands now, for some
tests we won't be able to use the expectedExceptions feature due to
this limitation and go back to try/catch.

So is there any road map for this enhancement? Should I file a Jira?

Thanks

Cédric Beust ♔

unread,
Dec 2, 2009, 5:33:07 PM12/2/09
to testng...@googlegroups.com
Hi Daniel,


This was implemented in 5.10:

@Test(expectedExceptions = FooException.class, expectedExceptionsMessageRegExp = ".*error.*")

Note that the behavior is undefined if you use more than one exception (which the expectedExceptions attribute allows).

--
Cédric


Daniel Rudman

unread,
Dec 4, 2009, 3:57:44 AM12/4/09
to testng...@googlegroups.com
Perfect, thanks! Will try it out.

2009/12/2 Cédric Beust ♔ <cbe...@google.com>

--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Reply all
Reply to author
Forward
0 new messages