Is there a better example of running programmatically?

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

Is there a better example of running programmatically?

cytoe
The example in the testng documentation mentions be able to run programmatically off a testng.xml file.  Can someone provide an example?  I am having trouble using XmlSuite's setFileName() or setSuiteFiles().
Also, it would be very helpful if testng had more methods with usefull javadoc entries.

thanks,
Ron
Reply | Threaded
Open this post in threaded view
|

Re: Is there a better example of running programmatically?

Cédric Beust ♔
Hi Ron,

Here is a short example that creates an XmlSuite object with a given class and name:

  public static XmlSuite createSuite(String cls, String suiteName) {
    XmlSuite result = new XmlSuite();
    result.setName(suiteName);
   
    XmlTest test = new XmlTest(result);
    test.setName("TmpTest");
    List<XmlClass> classes = new ArrayList<XmlClass>();
    classes.add(new XmlClass(cls));
    test.setXmlClasses(classes);
   
    return result;
  }

Does this help?

--
Cedric



On 2/26/07, cytoe <[hidden email]> wrote:


The example in the testng documentation mentions be able to run
programmatically off a testng.xml file.  Can someone provide an example?  I
am having trouble using XmlSuite's setFileName() or setSuiteFiles().
Also, it would be very helpful if testng had more methods with usefull
javadoc entries.

thanks,
Ron
--
View this message in context: http://www.nabble.com/Is-there-a-better-example-of-running-programmatically--tf3296612.html#a9170715
Sent from the testng-users mailing list archive at Nabble.com.







--
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: Is there a better example of running programmatically?

cytoe
Hi Cedric, is there an example of using an existing xml suite file?

Cédric Beust ♔ wrote
Hi Ron,

Here is a short example that creates an XmlSuite object with a given class
and name:

  public static XmlSuite createSuite(String cls, String suiteName) {
    XmlSuite result = new XmlSuite();
    result.setName(suiteName);

    XmlTest test = new XmlTest(result);
    test.setName("TmpTest");
    List<XmlClass> classes = new ArrayList<XmlClass>();
    classes.add(new XmlClass(cls));
    test.setXmlClasses(classes);

    return result;
  }

Does this help?

--
Cedric



On 2/26/07, cytoe <cytoe@msn.com> wrote:
>
>
>
> The example in the testng documentation mentions be able to run
> programmatically off a testng.xml file.  Can someone provide an
> example?  I
> am having trouble using XmlSuite's setFileName() or setSuiteFiles().
> Also, it would be very helpful if testng had more methods with usefull
> javadoc entries.
>
> thanks,
> Ron
> --
> View this message in context:
> http://www.nabble.com/Is-there-a-better-example-of-running-programmatically--tf3296612.html#a9170715
> Sent from the testng-users mailing list archive at Nabble.com.
>
>
> >
>


--
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 testng-users@googlegroups.com
To unsubscribe from this group, send email to testng-users-unsubscribe@googlegroups.com
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: Is there a better example of running programmatically?

Cédric Beust ♔


On 2/26/07, cytoe <[hidden email]> wrote:


Hi Cedric, is there an example of using an existing xml suite file?

From the Javadoc:

  /**
   * Set the suites file names to be run by this TestNG object. This method tries to load and
   * parse the specified TestNG suite xml files. If a file is missing, it is ignored.
   *
   * @param suites A list of paths to one more XML files defining the tests.  For example:
   *
   * <pre>
   * TestNG tng = new TestNG();
   * List<String> suites = new ArrayList<String>();
   * suites.add("c:/tests/testng1.xml");
   * suites.add("c:/tests/testng2.xml");
   * tng.setTestSuites (suites);
   * tng.run();
   * </pre>
   */
  public void setTestSuites(List<String> suites)

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

doh! sorry

cytoe
was looking in the wrong place in the javadoc (xmlsuite).  Thanks!

Cédric Beust ♔ wrote
On 2/26/07, cytoe <cytoe@msn.com> wrote:
>
>
>
> Hi Cedric, is there an example of using an existing xml suite file?


From the Javadoc:

  /**
   * Set the suites file names to be run by this TestNG object. This method
tries to load and
   * parse the specified TestNG suite xml files. If a file is missing, it is
ignored.
   *
   * @param suites A list of paths to one more XML files defining the
tests.  For example:
   *
   * <pre>
   * TestNG tng = new TestNG();
   * List<String> suites = new ArrayList<String>();
   * suites.add("c:/tests/testng1.xml");
   * suites.add("c:/tests/testng2.xml");
   * tng.setTestSuites(suites);
   * tng.run();
   * </pre>
   */
  public void setTestSuites(List<String> suites)

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