@BeforeSuite / @AfterTest is not invoked from the class if using groups

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

@BeforeSuite / @AfterTest is not invoked from the class if using groups

Peter Bacsko
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
    <classes>
    <class name="my.class.Groups" />
    </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
        <groups>
                <run>
                        <include name="grp1" />
                </run>
        </groups>
       
    <classes>
    <class name="my.class.Groups" />
    </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
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.

Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

cassio kenji
Hi!

The same is occurring to me. I'm using 6.2.0.20110826_0903.

thanks,

2011/9/12 Peter Bacsko <[hidden email]>
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
       <groups>
               <run>
                       <include name="grp1" />
               </run>
       </groups>

   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
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.


--
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.
Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

Cédric Beust ♔-2
In reply to this post by Peter Bacsko
No, your configuration methods need to belong to that group as well.

If you want them to always run, use @BeforeTest(alwaysRun = true).

-- 
Cédric




On Mon, Sep 12, 2011 at 2:14 AM, Peter Bacsko <[hidden email]> wrote:
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
       <groups>
               <run>
                       <include name="grp1" />
               </run>
       </groups>

   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
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.


--
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.
Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

joshua clingenpeel
In reply to this post by Peter Bacsko
From my understanding from the Javadocs, if you specify a group to
run, it will only run those methods (including Before/After methods)
that belong to that group. In the @BeforeSuite/@AfterTest annotations,
you can set 'alwaysRun' to true, and that will force them to run even
if they don't belong to the group that you've specified. The default
for this parameter is false.

On Sep 12, 2:14 am, Peter Bacsko <[hidden email]> wrote:

> Hi
>
> I found a possible bug in TestNG (I think it is).
> I have a class with some dummy test methods, they all belong to the
> same group, let's say "grp1". I also have two configuration methods:
> @BeforeSuite and @AfterTest.
>
> If I execute the tests without group specification (that is, all
> method from the class) then everything is fine:
>
> <test name="Test">
>     <classes>
>         <class name="my.class.Groups" />
>     </classes>
>  </test>
>
> However, if I want to run the tests as a group, then the two config
> methods are skipped by TestNG:
>
> <test name="Test">
>         <groups>
>                 <run>
>                         <include name="grp1" />
>                 </run>
>         </groups>
>
>     <classes>
>         <class name="my.class.Groups" />
>     </classes>
>  </test>
>
> Is this intentional? I would assume that all configuration method is
> run by TestNG no matter how the tests are added in the suite.
>
> Thanks,
> Peter

--
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.

Reply | Threaded
Open this post in threaded view
|

Re: Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

Peter Bacsko
Hi guys

Thanks for the clarification.

BR,
Peter


On Mon, Sep 12, 2011 at 11:46 PM, Joshua Clingenpeel
<[hidden email]> wrote:

> From my understanding from the Javadocs, if you specify a group to
> run, it will only run those methods (including Before/After methods)
> that belong to that group. In the @BeforeSuite/@AfterTest annotations,
> you can set 'alwaysRun' to true, and that will force them to run even
> if they don't belong to the group that you've specified. The default
> for this parameter is false.
>
> On Sep 12, 2:14 am, Peter Bacsko <[hidden email]> wrote:
>> Hi
>>
>> I found a possible bug in TestNG (I think it is).
>> I have a class with some dummy test methods, they all belong to the
>> same group, let's say "grp1". I also have two configuration methods:
>> @BeforeSuite and @AfterTest.
>>
>> If I execute the tests without group specification (that is, all
>> method from the class) then everything is fine:
>>
>> <test name="Test">
>>     <classes>
>>         <class name="my.class.Groups" />
>>     </classes>
>>  </test>
>>
>> However, if I want to run the tests as a group, then the two config
>> methods are skipped by TestNG:
>>
>> <test name="Test">
>>         <groups>
>>                 <run>
>>                         <include name="grp1" />
>>                 </run>
>>         </groups>
>>
>>     <classes>
>>         <class name="my.class.Groups" />
>>     </classes>
>>  </test>
>>
>> Is this intentional? I would assume that all configuration method is
>> run by TestNG no matter how the tests are added in the suite.
>>
>> Thanks,
>> Peter
>
> --
> 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.
>
>

--
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.

Reply | Threaded
Open this post in threaded view
|

Re: Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

cassio kenji
Hi,

in fact, it makes all the sense for me now :)
I could'nt test it yet because Im loaded with some other problems, but I'll do it ASAP

Thanks for the explanations, guys.

2011/9/13 Peter Bacsko <[hidden email]>
Hi guys

Thanks for the clarification.

BR,
Peter


On Mon, Sep 12, 2011 at 11:46 PM, Joshua Clingenpeel
<[hidden email]> wrote:
> From my understanding from the Javadocs, if you specify a group to
> run, it will only run those methods (including Before/After methods)
> that belong to that group. In the @BeforeSuite/@AfterTest annotations,
> you can set 'alwaysRun' to true, and that will force them to run even
> if they don't belong to the group that you've specified. The default
> for this parameter is false.
>
> On Sep 12, 2:14 am, Peter Bacsko <[hidden email]> wrote:
>> Hi
>>
>> I found a possible bug in TestNG (I think it is).
>> I have a class with some dummy test methods, they all belong to the
>> same group, let's say "grp1". I also have two configuration methods:
>> @BeforeSuite and @AfterTest.
>>
>> If I execute the tests without group specification (that is, all
>> method from the class) then everything is fine:
>>
>> <test name="Test">
>>     <classes>
>>         <class name="my.class.Groups" />
>>     </classes>
>>  </test>
>>
>> However, if I want to run the tests as a group, then the two config
>> methods are skipped by TestNG:
>>
>> <test name="Test">
>>         <groups>
>>                 <run>
>>                         <include name="grp1" />
>>                 </run>
>>         </groups>
>>
>>     <classes>
>>         <class name="my.class.Groups" />
>>     </classes>
>>  </test>
>>
>> Is this intentional? I would assume that all configuration method is
>> run by TestNG no matter how the tests are added in the suite.
>>
>> Thanks,
>> Peter
>
> --
> 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.
>
>

--
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.


--
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.
Jek
Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

Jek
I'm sure this question comes up all the time.  In fact, it was the
first question I got asked from someone here after returning from
vacation this morning.  (I'm one of the heavy TestNG users here.)  I
also recall this being one of the first questions I had when starting
with TestNG years ago.  My intuition says that specifying a group for
a configuration method is like a filter and without that filter the
configuration methods should run.  However, once you get it in your
head that @Test methods and configuration methods are treated exactly
the same regarding groups, then you're in good shape.

If you really want to 'default' alwaysRun to true for configuration
methods, I believe you could use an Annotation Transformer.

     -John

On Sep 13, 5:02 am, cassio kenji <[hidden email]> wrote:

> Hi,
>
> in fact, it makes all the sense for me now :)
> I could'nt test it yet because Im loaded with some other problems, but I'll
> do it ASAP
>
> Thanks for the explanations, guys.
>
> 2011/9/13 Peter Bacsko <[hidden email]>
>
>
>
>
>
>
>
> > Hi guys
>
> > Thanks for the clarification.
>
> > BR,
> > Peter
>
> > On Mon, Sep 12, 2011 at 11:46 PM, Joshua Clingenpeel
> > <[hidden email]> wrote:
> > > From my understanding from the Javadocs, if you specify a group to
> > > run, it will only run those methods (including Before/After methods)
> > > that belong to that group. In the @BeforeSuite/@AfterTest annotations,
> > > you can set 'alwaysRun' to true, and that will force them to run even
> > > if they don't belong to the group that you've specified. The default
> > > for this parameter is false.
>
> > > On Sep 12, 2:14 am, Peter Bacsko <[hidden email]> wrote:
> > >> Hi
>
> > >> I found a possible bug in TestNG (I think it is).
> > >> I have a class with some dummy test methods, they all belong to the
> > >> same group, let's say "grp1". I also have two configuration methods:
> > >> @BeforeSuite and @AfterTest.
>
> > >> If I execute the tests without group specification (that is, all
> > >> method from the class) then everything is fine:
>
> > >> <test name="Test">
> > >>     <classes>
> > >>         <class name="my.class.Groups" />
> > >>     </classes>
> > >>  </test>
>
> > >> However, if I want to run the tests as a group, then the two config
> > >> methods are skipped by TestNG:
>
> > >> <test name="Test">
> > >>         <groups>
> > >>                 <run>
> > >>                         <include name="grp1" />
> > >>                 </run>
> > >>         </groups>
>
> > >>     <classes>
> > >>         <class name="my.class.Groups" />
> > >>     </classes>
> > >>  </test>
>
> > >> Is this intentional? I would assume that all configuration method is
> > >> run by TestNG no matter how the tests are added in the suite.
>
> > >> Thanks,
> > >> Peter
>
> > > --
> > > 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.
>
> > --
> > 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.

--
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.

Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

Dreamway
I hava the same problem  ,thanks

--
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.

Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

nicolas
In reply to this post by Cédric Beust ♔-2
Hi Cédric,

But let say that I have a test class that extends a base class.
If I run a test against the group "integration.platform" the before and after suite should be triggered, right ?
Because right now this is not working, I need to put alwaysRun= true..
This issue is happening only using ant, using the eclipse plugging it's working fine (i'm using testng 6.8 and eclispe testng plugging ).

Thank you for your help

@Test(groups = { "integration.platform" })
public class test extends BaseTestClass  {

@test
public void test() {
  ....
  }
}

public class BaseTestClass {

@BeforeSuite
public void beforeSuiteMethod(){
...
}
@AfterSuite
public void afterSuiteMethod() {
...
}
}


On Monday, September 12, 2011 9:29:34 AM UTC-7, Cédric Beust ♔ wrote:
No, your configuration methods need to belong to that group as well.

If you want them to always run, use @BeforeTest(alwaysRun = true).

-- 
Cédric




On Mon, Sep 12, 2011 at 2:14 AM, Peter Bacsko <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="-DTfFDxXW2AJ">bac...@...> wrote:
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
       <groups>
               <run>
                       <include name="grp1" />
               </run>
       </groups>

   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="-DTfFDxXW2AJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="-DTfFDxXW2AJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

Krishnan Mahadevan
Nicolas,

When you say this issue is not evident when running your test using eclipse, can you please elaborate more here ? How are you running your test via eclipse? 
Do you right click on your class and say run as > TestNG test or do you right click on your suite and say run as > TestNG suite ?

Kicking off tests using build tools such as "Ant" or "Maven" for that matter is going to be simulating the latter case [ Run as TestNG suite]

When you choose to run as a suite and when your suite has groups as a selection mode, the configuration methods [@Before/@After] either need to be part of the same group as your tests or as Cedric pointed out, should have "alwaysRun=true".


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


On Fri, Feb 22, 2013 at 3:06 AM, Nicolas Lelievre <[hidden email]> wrote:
Hi Cédric,

But let say that I have a test class that extends a base class.
If I run a test against the group "integration.platform" the before and after suite should be triggered, right ?
Because right now this is not working, I need to put alwaysRun= true..
This issue is happening only using ant, using the eclipse plugging it's working fine (i'm using testng 6.8 and eclispe testng plugging ).

Thank you for your help

@Test(groups = { "integration.platform" })
public class test extends BaseTestClass  {

@test
public void test() {
  ....
  }
}

public class BaseTestClass {

@BeforeSuite
public void beforeSuiteMethod(){
...
}
@AfterSuite
public void afterSuiteMethod() {
...
}
}


On Monday, September 12, 2011 9:29:34 AM UTC-7, Cédric Beust ♔ wrote:
No, your configuration methods need to belong to that group as well.

If you want them to always run, use @BeforeTest(alwaysRun = true).

-- 
Cédric




On Mon, Sep 12, 2011 at 2:14 AM, Peter Bacsko <[hidden email]> wrote:
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
       <groups>
               <run>
                       <include name="grp1" />
               </run>
       </groups>

   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
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 testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

nicolas
Hi Krishnan,


On Thursday, February 21, 2013 10:35:14 PM UTC-8, Krishnan wrote:
Nicolas,

When you say this issue is not evident when running your test using eclipse, can you please elaborate more here ? How are you running your test via eclipse? 
Do you right click on your class and say run as > TestNG test or do you right click on your suite and say run as > TestNG suite ?

I'm running it on eclipse using "right click on your class and say run as > TestNG test" meaning that I don't specify a specific group.
 

Kicking off tests using build tools such as "Ant" or "Maven" for that matter is going to be simulating the latter case [ Run as TestNG suite]

When you choose to run as a suite and when your suite has groups as a selection mode, the configuration methods [@Before/@After] either need to be part of the same group as your tests or as Cedric pointed out, should have "alwaysRun=true".

But my class extend the base one so the suit should be part anyway, no ?
Because if I'm using alwaysRun=true that mean that it will be trigger anyway no matter what group or test which is not what I want.




Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


Regards,
 
On Fri, Feb 22, 2013 at 3:06 AM, Nicolas Lelievre <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="jHXDACj6NLAJ">nicolas....@...> wrote:
Hi Cédric,

But let say that I have a test class that extends a base class.
If I run a test against the group "integration.platform" the before and after suite should be triggered, right ?
Because right now this is not working, I need to put alwaysRun= true..
This issue is happening only using ant, using the eclipse plugging it's working fine (i'm using testng 6.8 and eclispe testng plugging ).

Thank you for your help

@Test(groups = { "integration.platform" })
public class test extends BaseTestClass  {

@test
public void test() {
  ....
  }
}

public class BaseTestClass {

@BeforeSuite
public void beforeSuiteMethod(){
...
}
@AfterSuite
public void afterSuiteMethod() {
...
}
}


On Monday, September 12, 2011 9:29:34 AM UTC-7, Cédric Beust ♔ wrote:
No, your configuration methods need to belong to that group as well.

If you want them to always run, use @BeforeTest(alwaysRun = true).

-- 
Cédric




On Mon, Sep 12, 2011 at 2:14 AM, Peter Bacsko <[hidden email]> wrote:
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
       <groups>
               <run>
                       <include name="grp1" />
               </run>
       </groups>

   <classes>
       <class name="my.class.Groups" />
   </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
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 testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="jHXDACj6NLAJ">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="jHXDACj6NLAJ">testng...@....
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: @BeforeSuite / @AfterTest is not invoked from the class if using groups

sunny sachdeva
In reply to this post by Peter Bacsko
One Small thing Guys.

 I am just a naive so in case if my doubts appears to be silly please bear with me. 

What about tests which depends on a Group.

I created a class which has 2 methods(lets say Method A and MethodB) in a group and one method(lets say Method C) which depends on this group.

Now in testng.xml if i specify to run this group , i found that on only Method A and Method B ran(passed) however dependent Method which is Method C didnt ran.

I could not get this behavior.

Thanks
On Monday, September 12, 2011 2:44:54 PM UTC+5:30, Peter Bacsko wrote:
Hi

I found a possible bug in TestNG (I think it is).
I have a class with some dummy test methods, they all belong to the
same group, let's say "grp1". I also have two configuration methods:
@BeforeSuite and @AfterTest.

If I execute the tests without group specification (that is, all
method from the class) then everything is fine:

<test name="Test">
    <classes>
            <class name="my.class.Groups" />
    </classes>
 </test>


However, if I want to run the tests as a group, then the two config
methods are skipped by TestNG:

<test name="Test">
        <groups>
                <run>
                        <include name="grp1" />
                </run>
        </groups>
        
    <classes>
            <class name="my.class.Groups" />
    </classes>
 </test>


Is this intentional? I would assume that all configuration method is
run by TestNG no matter how the tests are added in the suite.

Thanks,
Peter

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.