How to make my tests execute in sequence.

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

How to make my tests execute in sequence.

pmendelson2

I am trying to execute 2 testing classes serially in sequence.  My
testng.xml is approximately as follows:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="suite1" parallel="false">
  <test verbose="2" name="test1" annotations="1.5">
    <classes>
      <class name="class1"/>
    </classes>
  </test>
  <test verbose="2" name="test2" annotations="1.5">
    <classes>
      <class name="class2"/>
    </classes>
  </test>
</suite>

My goal is to have test1, all classes and methods, execute before any
part of test2 executes.  I don't think that that is happening.  At
least when I wrote a listener I get mixed invocations of onStart(...).

Are there any other xml attributes I can add to get the execution
sequence I'm looking for?


--~--~---------~--~----~------------~-------~--~----~
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: How to make my tests execute in sequence.

Cédric Beust ♔
One way to do this is to use class-level annotations:

@Test(groups = "1")
public class Class1 { ... }

@Test(dependsOnGroups = "2")
public class Class 2 { ... }

--
Cedric


On 2/23/07, Paul <[hidden email]> wrote:

I am trying to execute 2 testing classes serially in sequence.  My
testng.xml is approximately as follows:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd ">
<suite name="suite1" parallel="false">
  <test verbose="2" name="test1" annotations="1.5">
    <classes>
      <class name="class1"/>
    </classes>
  </test>
  <test verbose="2" name="test2" annotations="1.5">
    <classes>
      <class name="class2"/>
    </classes>
  </test>
</suite>

My goal is to have test1, all classes and methods, execute before any
part of test2 executes.  I don't think that that is happening.  At
least when I wrote a listener I get mixed invocations of onStart(...).

Are there any other xml attributes I can add to get the execution
sequence I'm looking for?







--
Cédric
--~--~---------~--~----~------------~-------~--~----~
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: How to make my tests execute in sequence.

Alexandru Popescu ☀
Do you need test2 to run after test1, or just that test1 and test2 to
not interfere. Before for the second option your settings are correct
and you should see this (except the case where test1 or test2 are
defining @Before/@AfterSuite methods).

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 2/24/07, Cédric Beust ♔ <[hidden email]> wrote:

> One way to do this is to use class-level annotations:
>
> @Test(groups = "1")
> public class Class1 { ... }
>
> @Test(dependsOnGroups = "2")
> public class Class 2 { ... }
>
> --
> Cedric
>
>
> On 2/23/07, Paul <[hidden email]> wrote:
> >
> > I am trying to execute 2 testing classes serially in sequence.  My
> > testng.xml is approximately as follows:
> >
> > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd
> ">
> > <suite name="suite1" parallel="false">
> >   <test verbose="2" name="test1" annotations="1.5">
> >     <classes>
> >       <class name="class1"/>
> >     </classes>
> >   </test>
> >   <test verbose="2" name="test2" annotations="1.5">
> >     <classes>
> >       <class name="class2"/>
> >     </classes>
> >   </test>
> > </suite>
> >
> > My goal is to have test1, all classes and methods, execute before any
> > part of test2 executes.  I don't think that that is happening.  At
> > least when I wrote a listener I get mixed invocations of onStart(...).
> >
> > Are there any other xml attributes I can add to get the execution
> > sequence I'm looking for?
> >
> >
> >
> >
> >
>
>
>
> --
> Cédric
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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: How to make my tests execute in sequence.

pmendelson2
In reply to this post by Cédric Beust ♔

I tried your suggestion and I got an error running class 2 complaining
that class2.method2 depends on nonexistent group "1".

I imagine that I could solve the problem by combining my classes but I
don't like the idea of making 1 very large class instead of 2 or 3
smaller ones.


Ideally I would like to declare the dependency in testng.xml with code
that might look like

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="suite1" parallel="false">
  <test verbose="2" name="test1" annotations="1.5">
    <classes>
      <class name="class1"/>
    </classes>
  </test>
  <test verbose="2" name="test2" annotations="1.5"
dependsOnTest="test1">
    <classes>
      <class name="class2"/>
    </classes>
  </test>
</suite>

This way I could run class1 and class2 seperately in my IDE but force
them in a prescribed sequence when I run them in a more formal
setting.


On Feb 23, 6:31 pm, "Cédric Beust ♔ " <[hidden email]> wrote:

> One way to do this is to use class-level annotations:
>
> @Test(groups = "1")
> public class Class1 { ... }
>
> @Test(dependsOnGroups = "2")
> public class Class 2 { ... }
>
> --
> Cedric
>
> On 2/23/07, Paul <[hidden email]> wrote:
>
>
>
>
>
> > I am trying to execute 2 testing classes serially in sequence.  My
> > testng.xml is approximately as follows:
>
> > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> > <suite name="suite1" parallel="false">
> >   <test verbose="2" name="test1" annotations="1.5">
> >     <classes>
> >       <class name="class1"/>
> >     </classes>
> >   </test>
> >   <test verbose="2" name="test2" annotations="1.5">
> >     <classes>
> >       <class name="class2"/>
> >     </classes>
> >   </test>
> > </suite>
>
> > My goal is to have test1, all classes and methods, execute before any
> > part of test2 executes.  I don't think that that is happening.  At
> > least when I wrote a listener I get mixed invocations of onStart(...).
>
> > Are there any other xml attributes I can add to get the execution
> > sequence I'm looking for?
>
> --
> Cédric


--~--~---------~--~----~------------~-------~--~----~
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: How to make my tests execute in sequence.

Cédric Beust ♔
Dependent classes need to be in the same <test> stanza.

--
Cedric


On 2/23/07, Paul <[hidden email]> wrote:

I tried your suggestion and I got an error running class 2 complaining
that class2.method2 depends on nonexistent group "1".

I imagine that I could solve the problem by combining my classes but I
don't like the idea of making 1 very large class instead of 2 or 3
smaller ones.


Ideally I would like to declare the dependency in testng.xml with code
that might look like

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd ">
<suite name="suite1" parallel="false">
  <test verbose="2" name="test1" annotations="1.5">
    <classes>
      <class name="class1"/>
    </classes>
  </test>
  <test verbose="2" name="test2" annotations="1.5"
dependsOnTest="test1">
    <classes>
      <class name="class2"/>
    </classes>
  </test>
</suite>

This way I could run class1 and class2 seperately in my IDE but force
them in a prescribed sequence when I run them in a more formal
setting.


On Feb 23, 6:31 pm, "Cédric Beust ♔ " <[hidden email]> wrote:

> One way to do this is to use class-level annotations:
>
> @Test(groups = "1")
> public class Class1 { ... }
>
> @Test(dependsOnGroups = "2")
> public class Class 2 { ... }
>
> --
> Cedric
>
> On 2/23/07, Paul <[hidden email]> wrote:
>
>
>
>
>
> > I am trying to execute 2 testing classes serially in sequence.  My
> > testng.xml is approximately as follows:
>
> > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

> > <suite name="suite1" parallel="false">
> >   <test verbose="2" name="test1" annotations=" 1.5">
> >     <classes>
> >       <class name="class1"/>
> >     </classes>
> >   </test>
> >   <test verbose="2" name="test2" annotations=" 1.5">
> >     <classes>
> >       <class name="class2"/>
> >     </classes>
> >   </test>
> > </suite>
>
> > My goal is to have test1, all classes and methods, execute before any
> > part of test2 executes.  I don't think that that is happening.  At
> > least when I wrote a listener I get mixed invocations of onStart(...).
>
> > Are there any other xml attributes I can add to get the execution
> > sequence I'm looking for?
>
> --
> Cédric







--
Cédric
--~--~---------~--~----~------------~-------~--~----~
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: How to make my tests execute in sequence.

pmendelson2

Thanks cedric moving them into the same <test> stanza made everything
work.

If I want to run my class2 test by itself would the following work,
assuming that class2.method2 depends on group 1?

  <test verbose="2" name="test2" annotations="1.5" groups="1">
    <classes>
      <class name="class2"/>
    </classes>
  </test>


On Feb 23, 10:39 pm, "Cédric Beust ♔ " <[hidden email]> wrote:

> Dependent classes need to be in the same <test> stanza.
>
> --
> Cedric
>
> On 2/23/07, Paul <[hidden email]> wrote:
>
>
>
>
>
>
>
> > I tried your suggestion and I got an error running class 2 complaining
> > that class2.method2 depends on nonexistent group "1".
>
> > I imagine that I could solve the problem by combining my classes but I
> > don't like the idea of making 1 very large class instead of 2 or 3
> > smaller ones.
>
> > Ideally I would like to declare the dependency in testng.xml with code
> > that might look like
>
> > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> > <suite name="suite1" parallel="false">
> >   <test verbose="2" name="test1" annotations="1.5">
> >     <classes>
> >       <class name="class1"/>
> >     </classes>
> >   </test>
> >   <test verbose="2" name="test2" annotations="1.5"
> > dependsOnTest="test1">
> >     <classes>
> >       <class name="class2"/>
> >     </classes>
> >   </test>
> > </suite>
>
> > This way I could run class1 and class2 seperately in my IDE but force
> > them in a prescribed sequence when I run them in a more formal
> > setting.
>
> > On Feb 23, 6:31 pm, "Cédric Beust ♔ " <[hidden email]> wrote:
> > > One way to do this is to use class-level annotations:
>
> > > @Test(groups = "1")
> > > public class Class1 { ... }
>
> > > @Test(dependsOnGroups = "2")
> > > public class Class 2 { ... }
>
> > > --
> > > Cedric
>
> > > On 2/23/07, Paul <[hidden email]> wrote:
>
> > > > I am trying to execute 2 testing classes serially in sequence.  My
> > > > testng.xml is approximately as follows:
>
> > > > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> > > > <suite name="suite1" parallel="false">
> > > >   <test verbose="2" name="test1" annotations="1.5">
> > > >     <classes>
> > > >       <class name="class1"/>
> > > >     </classes>
> > > >   </test>
> > > >   <test verbose="2" name="test2" annotations="1.5">
> > > >     <classes>
> > > >       <class name="class2"/>
> > > >     </classes>
> > > >   </test>
> > > > </suite>
>
> > > > My goal is to have test1, all classes and methods, execute before any
> > > > part of test2 executes.  I don't think that that is happening.  At
> > > > least when I wrote a listener I get mixed invocations of onStart(...).
>
> > > > Are there any other xml attributes I can add to get the execution
> > > > sequence I'm looking for?
>
> > > --
> > > Cédric
>
> --
> Cédric- Hide quoted text -
>
> - Show quoted text -


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