How to execute testNG methods in order?

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to execute testNG methods in order?

Naveen-22
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

吴亭
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim

2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Cédric Beust ♔-2
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Abhay-6
Hi,
we can also do by setting Priority.
Cedric if I am wrong please correct me.
Thanks,
Abhay

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/NmN0fVqPkG4J.
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
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Cédric Beust ♔-2
No, you're right, priorities work too.

-- 
Cédric




On Wed, Jul 4, 2012 at 11:57 PM, Abhay <[hidden email]> wrote:
Hi,
we can also do by setting Priority.
Cedric if I am wrong please correct me.
Thanks,
Abhay


On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/NmN0fVqPkG4J.

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
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Abhay-6
Thanks alot Cedric 
Abhay

On Thursday, 5 July 2012 12:32:09 UTC+5:30, Cédric Beust ♔ wrote:
No, you're right, priorities work too.

-- 
Cédric




On Wed, Jul 4, 2012 at 11:57 PM, Abhay <[hidden email]> wrote:
Hi,
we can also do by setting Priority.
Cedric if I am wrong please correct me.
Thanks,
Abhay


On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/NmN0fVqPkG4J.

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 view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/IcGQVKPyE-IJ.
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
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Amit Joshi
In reply to this post by Naveen-22
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default suite">
  <test verbose="2" name="Default test">
       <classes>
  
      <class name="Login.Login1">
     
        <methods>
            <include name="b"/>
            <include name="a"/>
            <include name="c"/>
            <include name="d"/>
            <include name="e"/>
            <include name="Date"/>
            <include name="Submit"/>
            <!--  <include name="Suspect"/>-->
        </methods>
        </class>
       <!-- TmrsLogin.TmrsLogin1 -->
    </classes>
  </test> <!-- Default test -->
</suite> <!-- Default suite -->

What ever order u want. Can be set in XML file according to requirements.


On Thursday, 5 July 2012 09:33:19 UTC+5:30, Naveen wrote:
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Radha Krishna
In reply to this post by Cédric Beust ♔-2

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4cYJ4Q3aWQJ">wutin...@...> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4cYJ4Q3aWQJ">naveen...@...>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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="f4cYJ4Q3aWQJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4cYJ4Q3aWQJ">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 post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4cYJ4Q3aWQJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4cYJ4Q3aWQJ">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.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Krishnan Mahadevan
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

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, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 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.
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.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

praveen133t
In reply to this post by Radha Krishna
if you want them in the same order you can do this

@Test(priority = 1) ----> for m1()

@Test(priority = 2) ----> for m2() 

and so on..

On Friday, August 23, 2013 7:58:33 AM UTC-5, Radha Krishna wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 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.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Sanchayan Paul
In reply to this post by Krishnan Mahadevan
Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Fri, Aug 23, 2013 at 6:28 PM, Radha Krishna <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="RM1viPacm_gJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">radhakris...@...> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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="RM1viPacm_gJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="RM1viPacm_gJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Krishnan Mahadevan
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Fri, Aug 23, 2013 at 6:28 PM, Radha Krishna <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="RM1viPacm_gJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">radhakris...@...> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

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

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Sanchayan Paul
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)

On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="__i8DD8xheoJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sancha...@...> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Fri, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="__i8DD8xheoJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="__i8DD8xheoJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Krishnan Mahadevan
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <[hidden email]> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

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, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Sanchayan Paul
Thanks Krishnan, It is following the order now.
But my objective is to run this king of series of tests in parallel mode? Also, the problem that I am now getting is - the driver object is getting created in @BeforeTest for each test, and the class in which all these configuration related annotations are have been extended in all the sub classes (e.g., Common, RoomTypeConfigComp). but when I am trying to run testng xml, the driver object is becoming null in the 2nd method which is in the class RoomTypeConfigComp

Could you please help me.

On Tuesday, 22 April 2014 11:23:53 UTC+5:30, Krishnan wrote:
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA';return true;">http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;">http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="dpOV9puKmd8J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sancha...@...> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Fri, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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="dpOV9puKmd8J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="dpOV9puKmd8J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Krishnan Mahadevan
There are a lot of things that I dont know here about your project, so I dont know how much I can help.

if ordering is to be maintained via preserve-order=true, you would need to disable parallelism. Else it is NOT going to work.

If you would like your classes to run in parallel but the methods in each of the classes has to follow an order, then you should be using dependsOnMethods (or) dependsOnGroups to chain your tests.




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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 1:55 PM, Sanchayan Paul <[hidden email]> wrote:
Thanks Krishnan, It is following the order now.
But my objective is to run this king of series of tests in parallel mode? Also, the problem that I am now getting is - the driver object is getting created in @BeforeTest for each test, and the class in which all these configuration related annotations are have been extended in all the sub classes (e.g., Common, RoomTypeConfigComp). but when I am trying to run testng xml, the driver object is becoming null in the 2nd method which is in the class RoomTypeConfigComp

Could you please help me.

On Tuesday, 22 April 2014 11:23:53 UTC+5:30, Krishnan wrote:
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <[hidden email]> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

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, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Sanchayan Paul
Let me try to explain - 

1. there is a driver class called InitTest.java, which actually serves as the controlling class. This has - 
      a. a public webdriver variable called driver
      b. a public connection object
      c. a public properties file object
      
2. Following it, there are several classes, which has methods in those and which i would like to run as per the xml. 

Problem
1. I have used public class RoomTypeConfigComp extends InitTest and public class Common extends InitTest
2. Once the control goes from Common (after executing Login) to RoomTypeConfigComp, all the public variables are becoming null

Let me know if you want any other info.

On Tuesday, 22 April 2014 15:35:24 UTC+5:30, Krishnan wrote:
There are a lot of things that I dont know here about your project, so I dont know how much I can help.

if ordering is to be maintained via preserve-order=true, you would need to disable parallelism. Else it is NOT going to work.

If you would like your classes to run in parallel but the methods in each of the classes has to follow an order, then you should be using dependsOnMethods (or) dependsOnGroups to chain your tests.




Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;">http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 1:55 PM, Sanchayan Paul <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="wA-K_jtG8EQJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sancha...@...> wrote:
Thanks Krishnan, It is following the order now.
But my objective is to run this king of series of tests in parallel mode? Also, the problem that I am now getting is - the driver object is getting created in @BeforeTest for each test, and the class in which all these configuration related annotations are have been extended in all the sub classes (e.g., Common, RoomTypeConfigComp). but when I am trying to run testng xml, the driver object is becoming null in the 2nd method which is in the class RoomTypeConfigComp

Could you please help me.

On Tuesday, 22 April 2014 11:23:53 UTC+5:30, Krishnan wrote:
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA';return true;">http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;">http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <[hidden email]> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Fri, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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="wA-K_jtG8EQJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="wA-K_jtG8EQJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Krishnan Mahadevan
Replace the @BeforeTest in your base class with @BeforeClass and see if that helps !

Basically the @BeforeTest executes only once per <test>. In your case, both the classes are extending from a common base class and the initialization is being done in the @BeforeTest. I am guessing that when it comes to the second instance, its initialization is NOT happening at all, because TestNG detects a @BeforeTest method which it has already executed and wont execute once again. Net Result : NullPointerException.

Resorting to @BeforeClass ensures that TestNG will invoke it for every test class.

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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 4:19 PM, Sanchayan Paul <[hidden email]> wrote:
Let me try to explain - 

1. there is a driver class called InitTest.java, which actually serves as the controlling class. This has - 
      a. a public webdriver variable called driver
      b. a public connection object
      c. a public properties file object
      
2. Following it, there are several classes, which has methods in those and which i would like to run as per the xml. 

Problem
1. I have used public class RoomTypeConfigComp extends InitTest and public class Common extends InitTest
2. Once the control goes from Common (after executing Login) to RoomTypeConfigComp, all the public variables are becoming null

Let me know if you want any other info.

On Tuesday, 22 April 2014 15:35:24 UTC+5:30, Krishnan wrote:
There are a lot of things that I dont know here about your project, so I dont know how much I can help.

if ordering is to be maintained via preserve-order=true, you would need to disable parallelism. Else it is NOT going to work.

If you would like your classes to run in parallel but the methods in each of the classes has to follow an order, then you should be using dependsOnMethods (or) dependsOnGroups to chain your tests.




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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 1:55 PM, Sanchayan Paul <[hidden email]> wrote:
Thanks Krishnan, It is following the order now.
But my objective is to run this king of series of tests in parallel mode? Also, the problem that I am now getting is - the driver object is getting created in @BeforeTest for each test, and the class in which all these configuration related annotations are have been extended in all the sub classes (e.g., Common, RoomTypeConfigComp). but when I am trying to run testng xml, the driver object is becoming null in the 2nd method which is in the class RoomTypeConfigComp

Could you please help me.

On Tuesday, 22 April 2014 11:23:53 UTC+5:30, Krishnan wrote:
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <[hidden email]> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

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, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Sanchayan Paul
Thanks for your useful advice.

But don't you think that in my case if I go by @BeforeClass, then with two classes, I will have two separate browsers (for a single test)

On Tuesday, 22 April 2014 17:16:28 UTC+5:30, Krishnan wrote:
Replace the @BeforeTest in your base class with @BeforeClass and see if that helps !

Basically the @BeforeTest executes only once per <test>. In your case, both the classes are extending from a common base class and the initialization is being done in the @BeforeTest. I am guessing that when it comes to the second instance, its initialization is NOT happening at all, because TestNG detects a @BeforeTest method which it has already executed and wont execute once again. Net Result : NullPointerException.

Resorting to @BeforeClass ensures that TestNG will invoke it for every test class.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;">http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 4:19 PM, Sanchayan Paul <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="r1tWJa3iMSoJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sancha...@...> wrote:
Let me try to explain - 

1. there is a driver class called InitTest.java, which actually serves as the controlling class. This has - 
      a. a public webdriver variable called driver
      b. a public connection object
      c. a public properties file object
      
2. Following it, there are several classes, which has methods in those and which i would like to run as per the xml. 

Problem
1. I have used public class RoomTypeConfigComp extends InitTest and public class Common extends InitTest
2. Once the control goes from Common (after executing Login) to RoomTypeConfigComp, all the public variables are becoming null

Let me know if you want any other info.

On Tuesday, 22 April 2014 15:35:24 UTC+5:30, Krishnan wrote:
There are a lot of things that I dont know here about your project, so I dont know how much I can help.

if ordering is to be maintained via preserve-order=true, you would need to disable parallelism. Else it is NOT going to work.

If you would like your classes to run in parallel but the methods in each of the classes has to follow an order, then you should be using dependsOnMethods (or) dependsOnGroups to chain your tests.




Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;">http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 1:55 PM, Sanchayan Paul <[hidden email]> wrote:
Thanks Krishnan, It is following the order now.
But my objective is to run this king of series of tests in parallel mode? Also, the problem that I am now getting is - the driver object is getting created in @BeforeTest for each test, and the class in which all these configuration related annotations are have been extended in all the sub classes (e.g., Common, RoomTypeConfigComp). but when I am trying to run testng xml, the driver object is becoming null in the 2nd method which is in the class RoomTypeConfigComp

Could you please help me.

On Tuesday, 22 April 2014 11:23:53 UTC+5:30, Krishnan wrote:
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA';return true;">http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ';return true;">http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <[hidden email]> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Fri, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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="r1tWJa3iMSoJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r1tWJa3iMSoJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to execute testNG methods in order?

Krishnan Mahadevan
That was exactly the idea. If you are basically thinking of creating one browser instance for an entire <test> I am not sure as to what is the effectiveness of this gigantor test. You should strive to keep test classes modular as much as possible rather than weave in so much of dependencies etc., 

That's my personal opinion !

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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 5:33 PM, Sanc <[hidden email]> wrote:
Thanks for your useful advice.

But don't you think that in my case if I go by @BeforeClass, then with two classes, I will have two separate browsers (for a single test)

On Tuesday, 22 April 2014 17:16:28 UTC+5:30, Krishnan wrote:
Replace the @BeforeTest in your base class with @BeforeClass and see if that helps !

Basically the @BeforeTest executes only once per <test>. In your case, both the classes are extending from a common base class and the initialization is being done in the @BeforeTest. I am guessing that when it comes to the second instance, its initialization is NOT happening at all, because TestNG detects a @BeforeTest method which it has already executed and wont execute once again. Net Result : NullPointerException.

Resorting to @BeforeClass ensures that TestNG will invoke it for every test class.

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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 4:19 PM, Sanchayan Paul <[hidden email]> wrote:
Let me try to explain - 

1. there is a driver class called InitTest.java, which actually serves as the controlling class. This has - 
      a. a public webdriver variable called driver
      b. a public connection object
      c. a public properties file object
      
2. Following it, there are several classes, which has methods in those and which i would like to run as per the xml. 

Problem
1. I have used public class RoomTypeConfigComp extends InitTest and public class Common extends InitTest
2. Once the control goes from Common (after executing Login) to RoomTypeConfigComp, all the public variables are becoming null

Let me know if you want any other info.

On Tuesday, 22 April 2014 15:35:24 UTC+5:30, Krishnan wrote:
There are a lot of things that I dont know here about your project, so I dont know how much I can help.

if ordering is to be maintained via preserve-order=true, you would need to disable parallelism. Else it is NOT going to work.

If you would like your classes to run in parallel but the methods in each of the classes has to follow an order, then you should be using dependsOnMethods (or) dependsOnGroups to chain your tests.




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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 1:55 PM, Sanchayan Paul <[hidden email]> wrote:
Thanks Krishnan, It is following the order now.
But my objective is to run this king of series of tests in parallel mode? Also, the problem that I am now getting is - the driver object is getting created in @BeforeTest for each test, and the class in which all these configuration related annotations are have been extended in all the sub classes (e.g., Common, RoomTypeConfigComp). but when I am trying to run testng xml, the driver object is becoming null in the 2nd method which is in the class RoomTypeConfigComp

Could you please help me.

On Tuesday, 22 April 2014 11:23:53 UTC+5:30, Krishnan wrote:
I am not entirely sure what exactly did you try. Here's what worked for me [ Am assuming that this is what you need ]

My Suite XML file looks like below :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Test" parallel="false" preserve-order="true" verbose="2">
<classes>
<class name="org.rationale.emotions.testng.Common">
<methods>
<include name="login" />
<include name="propPINChange" />
</methods>
</class>
<class name="org.rationale.emotions.testng.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn" />
<include name="verifyRoomTypesTable" />
</methods>
</class>
</classes>
</test>
</suite>

Here's the output


org.rationale.emotions.testng.Common.login() is running on Thread 1
User logged in
org.rationale.emotions.testng.Common.propPINChange() is running on Thread 1
User's pin was changed
org.rationale.emotions.testng.RoomTypeConfigComp.navigateToRoomClassViaDpDwn() is running on Thread 1
User navigated to Room via drop down
org.rationale.emotions.testng.RoomTypeConfigComp.verifyRoomTypesTable() is running on Thread 1
Room types verified.
PASSED: login
PASSED: propPINChange
PASSED: navigateToRoomClassViaDpDwn
PASSED: verifyRoomTypesTable

===============================================
    Test
    Tests run: 4, Failures: 0, Skips: 0
===============================================










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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


On Tue, Apr 22, 2014 at 10:59 AM, Sanchayan Paul <[hidden email]> wrote:
Thanks for your suggestion Krishnan, but it did not work.
Anyways, i will anyways have to run the suite in parallel mode.

it seems that it is picking up the class names in reverse alphabetical order (since R comes after C)


On Monday, 21 April 2014 22:17:59 UTC+5:30, Krishnan wrote:
Can you please try with : preserve-order=true parallel=false and see that helps ? [ set this at the <test> tag level ]

TestNG honours preserve-order=true attribute only when parallelism has been explicitly disabled. 

~ Krishnan

iSent. iPhone. iReget.iTypos!

On 21-Apr-2014, at 15:04, Sanchayan Paul <[hidden email]> wrote:

Hi Krishnan,

My xml looks like this - 

<suite name="ALPHA SMOKE SCRIPTS" thread-count="5" verbose="10" preserve-order="classes" >
<tests>
<test name="Smoke_Room_Type_Configuration_001" description="Verify  the  Managed Column in the Room Type  screen for ACTIVE Type as RMS Support Users">
<parameter name="scenario" value="SMOKE SCRIPTS" />
<parameter name="testcase" value="Smoke_Room_Type_Configuration_001" />
<parameter name="browser" value="firefox" />
<parameter name="description" value="Verify the Managed Column in the Room Type screen for ACTIVE Type as RMS Support Users" />
<classes preserve-order="true" preserver-order="classes">
<class name="components.Common">
<methods>
<include name="login"/>
<include name="propPINChange"/>
</methods>
</class>
<class name="components.RoomTypeConfigComp">
<methods>
<include name="navigateToRoomClassViaDpDwn"/>
<include name="verifyRoomTypesTable"/>
</methods>
</class>
</classes>
</test>
</tests>
</suite>

Problem
-- the methods in class RoomTypeConfigComp (which has been declared later in the testng xml) are getting executed prior to the methods in the class Common(which has been declared at first as per as sequence is concerned).

I have tried out with preserve-order, but it did not work. Could you pleae help me out in this case?. Its very urgent

Thanks and Regards
Sanchayan

On Friday, 23 August 2013 20:08:47 UTC+5:30, Krishnan wrote:
No they wouldnt.

As Cedric already mentioned, either use dependsOnMethods (or) call out your method names for every class

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, Aug 23, 2013 at 6:28 PM, Radha Krishna <[hidden email]> wrote:

Hi Cedric,

 I have ClassOne with 4 test methods, ClassTwo with 3 test methods. The order of test methods in ClassOne is m1(), m2(), m3(), m4() and in ClassTwo is t1(), t2(), t3().

<suite name ="Suite1">
<test  name="Running Tests">
        <classes>
            <class name="testNG.Parallel.ClassOne " />
            <class name="testNG.Parallel.ClassTwo " />
        </classes>
    </test>
</suite>

When I run this xml file, do the test methods in the above classes get executed/run in the same order as I wrote in the class.

On Thursday, 5 July 2012 10:53:15 UTC+5:30, Cédric Beust ♔ wrote:
Note that 1) this is the default and 2) this only applies to the ordering specified in the XML file, so not applicable here.

The ordering of methods in the class file is unpredictable, so you need to either use dependencies or include your methods explicitly in XML.

-- 
Cédric




On Wed, Jul 4, 2012 at 10:13 PM, 吴亭 <[hidden email]> wrote:
Hi,

You need add preserver-order=true in your testng.xml

Br,
Tim


2012/7/5 Naveen <[hidden email]>
Hi guys!
       I am trying to use testNG to generate reports, while executing
the class the methods are not executed sequentially as executed in the
Junit. And i dont want to use dependsonMethod
My order is like(i want to execute as i written in the class)..
public class Views {
 @Test
 public void b(){...}
@Test
 public void a(){...}
@Test
public void c(){...} .... }
the o/p should be b,a,c but my output is a,b,c it is executing in
alphabetical order.
Please help me to overcome this problem....

--
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 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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.
12
Loading...