Hello,
my current test suite consists of tests which require a major product
version number as a parameter so that backward compatibility tests can
be easily implemented and started (there is a bigger testing framework
in the background, so I need it this way). I'm trying to implement a
generic DataProvider for my tests with a custom annotation Versions,
which defines a string array with all validated product versions for a
test. I want these strings to be parsed by a common DataProvider. I
can't use Parameters, since tests should run several times (AFAIK not
possible with Parameter annotation)
1. According to the source code, both DataProvider and Test
annotations have an empty string as name and dataProvider
respectively. So I concluded, I could just define a DataProvider
without a name in a basic class and so define a "default" DataProvider
this way which would work for every test. However this didn't work.
Where have I thought wrong?
2. The default DataProvider can take a ITestContext parameter.
However, I could not find a way to get current test method from the
context -- all I get is current test class (not enough to parse
annotations) and a list of all test methods (no way to find out which
is the current one). Any way this might be possible?
Is there any way I could implement such a data provider? I've looked
into implementing a IAnnotationTransformer, but I can't change the
dataProvider setting in the @Test annotation.
Excellent! I've just implemented that, works like a charm! Now I have
> I just realized that the documentation didn't mention that you can also
> declare a Method parameter in your data provider signature and it will be
> automatically injected by TestNG with the method that is about to be
> invoked. Sorry about this.
just one data provider, which parses my custom annotation and return
the appropriate data. Thank you!
On Tue, Aug 19, 2008 at 12:45 AM, Nikolai Prokoschenko <nikolai.pr...@gmail.com> wrote:
Is there any way I could implement such a data provider? I've looked
into implementing a IAnnotationTransformer, but I can't change the
dataProvider setting in the @Test annotation.
Actually you can: look for "annotation transformers" in the documentation, this should solve your problem.
On 19 Aug., 16:34, Cédric Beust ♔ <cbe...@google.com> wrote:
> On Tue, Aug 19, 2008 at 12:45 AM, Nikolai Prokoschenko <
> > Is there any way I could implement such a data provider? I've lookedWell, I did -- it's also written in the quoted text ;-) I can read
> > into implementing a IAnnotationTransformer, but I can't change the
> > dataProvider setting in the @Test annotation.
> Actually you can: look for "annotation transformers" in the documentation,
> this should solve your problem.
annotations, but it seems there is no setDataProvider in ITest:
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.