Suppose you have a suite defined in "testng_suite.xml" containing only one class "anyTest" that itself has two methods "testA" and "testB".
Running the suite (by using a <xmlfileset>) or the class (by using <classfileset>) in ant leeds to the expected behaviour: testA and testB are executed.
The problem comes when you add the argument
to the testng-target...
Combined with the class-argument: only testA get executed -> nice
Combined with the suite-argument: the suite (testA + testB) and additionally testA get executed -> weird
Not combined (no suite, no class): only testA get executed -> weird, because the documentation (http://testng.org/doc/ant.html) says clearly:
"One of the attributes xmlfilesetref, classfilesetref or nested <xmlfileset>, respectively <classfileset> must be used for providing the tests."
I'm wonderung about the intended behaviour of the "methods" argument in ant.
Any help would be greatly appreciated.
p.s. i'm using v.6.2 of testng
The behavior becomes hard to predict when you use both command line arguments and a testng.xml file (in short, TestNG has to decide which argument should prevail, and the rules are not quite clear).
I suggest either using only command line parameters or .xml files.
On Thu, Sep 15, 2011 at 3:57 AM, Jostar <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
I agree to your point: one should never combine a testng.xml with some additional arguments for classes and/or methods (like -testClass or -methods) because it leads to some unpredictable behaviour and is quite needless as one can specify the classes or methods directly in xml.
But then, please, make a corresponding correction in the documentation.
Both the command-line docu ("...You need to specify at least one XML file describing the TestNG suite you are trying to run. Additionally, the following command-line switches are available:...") and the ant-docu ("...One of the attributes xmlfilesetref, classfilesetref or nested <xmlfileset>, respectively <classfileset> must be used for providing the tests...") clearly prescribe the use of an xml-file.
Or let me formulate this in a question:
Is the intended and supported way to run a class or method the exclusive (no testng.xml!) usage of the options "-testclass" and "-methods" in the console, respectively the element "classfileset" and attribute "methods" in ant?
|Free forum by Nabble||Edit this page|