How can let data provider to skip the test, if the data provider throws exception

480 views
Skip to first unread message

Ben

unread,
Jan 19, 2009, 3:12:13 PM1/19/09
to testng-users
I am using data provider to do data driven test. The data providers
will grab the data from the file in different ways and I used
reflection to match the method name and data in external xml file.
sometime it will fail to get the data so I throw an exception, which
extends from SkipException.
Now, what i want to achieve is that when data providers fail to get
the data, then this test case skips, not fail.

Is there anyway to do that, or any better solution for this kind of
issue?

Thanks,
Ben

Thomas Johnson

unread,
Jan 20, 2009, 6:18:35 AM1/20/09
to testng...@googlegroups.com
Could you just return no rows from the dataprovider? Effectively, the
test won't run, right?

Ben

unread,
Jan 21, 2009, 3:39:24 AM1/21/09
to testng-users
no, will throw null point exception, since the test case still try to
call the null array go get data

On Jan 20, 3:18 am, "Thomas Johnson" <ntmat...@gmail.com> wrote:
> Could you just return no rows from the dataprovider? Effectively, the
> test won't run, right?
>

Cédric Beust ♔

unread,
Jan 21, 2009, 10:52:58 AM1/21/09
to testng...@googlegroups.com
Return an empty array, not null.

--
Cedric

--
Cédric


Reply all
Reply to author
Forward
0 new messages