Controlling order between suite-files

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

Controlling order between suite-files

tarun3kumar

Hello,
I am using TestNG to run some tests that use Selenium (allows browser based testing of web pages).
I basically have a suite of tests that I want to run multiple times (launched via Ant), but wish to do some configuration at the start. At present this configuration is done via a method that has the annotation @BeforeSuite and @Parameter.
I am using this to specify the browser to use via a parameter, so that I can run the testsuite against all the different browsers I wish to test against. If all the tests are in the same testng.xml file this works great. However, I want to have the configuration in a separate file (so I can define the tests once rather than have a copy for each different browser).

So I have a testng.xml file:
<suite name="Test Suite - Internet Explorer" verbose="1">
<parameter name="browser-info" value="*iexplore" />
<test name="setup">
        <classes>
                <class name="com.blah.BrowserSpecification" />
        </classes>
</test>

<suite-files>
        <suite-file path=".\testsuites\testng-internal.xml" />
</suite-files>
</suite>

However, this does not work because the order is no longer controlled by the @BeforeSuite annotation, presumably because they are now in different suites.

Is there a way to control the order between the setup test and the tests in the included suite-file?

I have seen a thread saying that I cannot pass parameters into another suite, which was my other idea of how to do this.

Any other ideas on how to do this?
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=63169&messageID=122015#122015


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Controlling order between suite-files

Cédric Beust ♔
Hi Steven,

We could add some logic in TestNG to treat the testng.xml files alphabetically, so that if you want a file to be run first, you would call it 0testng.xml or something similar.

What do you think?

--
Cedric


On 2/8/07, Steven <[hidden email]> wrote:

Hello,
I am using TestNG to run some tests that use Selenium (allows browser based testing of web pages).
I basically have a suite of tests that I want to run multiple times (launched via Ant), but wish to do some configuration at the start. At present this configuration is done via a method that has the annotation @BeforeSuite and @Parameter.
I am using this to specify the browser to use via a parameter, so that I can run the testsuite against all the different browsers I wish to test against. If all the tests are in the same testng.xml file this works great. However, I want to have the configuration in a separate file (so I can define the tests once rather than have a copy for each different browser).

So I have a testng.xml file:
<suite name="Test Suite - Internet Explorer" verbose="1">
<parameter name="browser-info" value="*iexplore" />
<test name="setup">
        <classes>
                <class name="com.blah.BrowserSpecification" />
        </classes>
</test>

<suite-files>
        <suite-file path=".\testsuites\testng- internal.xml" />
</suite-files>
</suite>

However, this does not work because the order is no longer controlled by the @BeforeSuite annotation, presumably because they are now in different suites.

Is there a way to control the order between the setup test and the tests in the included suite-file?

I have seen a thread saying that I cannot pass parameters into another suite, which was my other idea of how to do this.

Any other ideas on how to do this?
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=63169&messageID=122015#122015







--
Cédric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Controlling order between suite-files

tarun3kumar

Hello Cedric,
Thankyou for your reply.

I expected that they would be run in the order that they were listed inside the suite-files tag. So that the file was parsed and the each suite-file inside the suite-files tag would be added to a List and run in order.

Would this be possible? It would seem to be more intuitive than to have it sorted alphabetically.

In either case so long as an order is defined then it would allow me to fix my problem.

Regards,
Steven
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=63169&messageID=122326#122326


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Controlling order between suite-files

Adam66

Depending on how many tests you have, you could use the
dependsOnMethods annotation.  We have the same scenario at my company
where we run Selenium tests via TestNG and for the tests that need to
be run in a certain order, I have one particular test depend on
another.

On Feb 9, 4:16 am, Steven <[hidden email]> wrote:

> Hello Cedric,
> Thankyou for your reply.
>
> I expected that they would be run in the order that they were listed inside the suite-files tag. So that the file was parsed and the each suite-file inside the suite-files tag would be added to a List and run in order.
>
> Would this be possible? It would seem to be more intuitive than to have it sorted alphabetically.
>
> In either case so long as an order is defined then it would allow me to fix my problem.
>
> Regards,
> Steven
> ---------------------------------------------------------------------
> Posted via Jive Forumshttp://forums.opensymphony.com/thread.jspa?threadID=63169&messageID=1...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Controlling order between suite-files

Cédric Beust ♔
Steven,

The problem with this approach is that since XML files can contain other XML files, the order the files are listed is not necessarily very meaningful.  It would certainly be possible to decide on a tree ordering, though, but I thought alphabetically would be easier for users.

Will think about this a bit more.

--
Cedric


On 2/9/07, Adam66 <[hidden email] > wrote:

Depending on how many tests you have, you could use the
dependsOnMethods annotation.  We have the same scenario at my company
where we run Selenium tests via TestNG and for the tests that need to
be run in a certain order, I have one particular test depend on
another.

On Feb 9, 4:16 am, Steven <[hidden email]> wrote:
> Hello Cedric,
> Thankyou for your reply.
>
> I expected that they would be run in the order that they were listed inside the suite-files tag. So that the file was parsed and the each suite-file inside the suite-files tag would be added to a List and run in order.
>
> Would this be possible? It would seem to be more intuitive than to have it sorted alphabetically.
>
> In either case so long as an order is defined then it would allow me to fix my problem.
>
> Regards,
> Steven
> ---------------------------------------------------------------------
> Posted via Jive Forumshttp://forums.opensymphony.com/thread.jspa?threadID=63169&messageID=1...


--
Cédric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Controlling order between suite-files

tarun3kumar

Hello,
Yes, you would need to follow each branch of the tree in turn and handle the files in that order.
Still I think this gives more control than if you treat the files alphabetically based on following the complete inheritance tree. In this case knowledge of all the file names is required.
If a tree inheritance is followed then each test suite at least determines the order of the test suites it calls, which should be all it cares about in an inheritance model.

Steven
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=63169&messageID=122406#122406


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