Neither ITestListener, nor ISuiteListener, contain methods for <test> start/end

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

Neither ITestListener, nor ISuiteListener, contain methods for <test> start/end

Kayla Nimis
Hi,

I'm currently trying to implement a test listener that reads in a file, based on a test parameter, and uses it in the onTestStart(ITestResult) method to determine whether or not to skip the method. However, it appears that there is no hook for when you start or finish a suite's test. I'm currently tracking the context.getCurrentXmlTest().getName() value in my listener, and only reading the file when that value changes. I was wondering if there was a less hacky way, or if it is in the works.

Thanks,
Kayla

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

Telling TestNG I Want to Run all Test Methods in a Class

Kevin Simonson

Currently the contents of my “testng.xml” file are:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

        <methods>

          <include name=”getCollectionSummary” />

          <include name=”updateCollection” />

        </methods>

      </class>

    </classes>

  </test>

</suite>

 

This lets me test these two test methods, which are both in the group I designate as “middle-phase”.  Now I could just add to this the name of all the other test methods in this class that belong to group “middle-phase” (there are two more of them), but is there an easier way to tell “testng.xml” I want to test all test methods in a class that belong to a specific group?

 

Kevin Simonson

 



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


--
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: Telling TestNG I Want to Run all Test Methods in a Class

P. Hill-2
On 10/7/2011 12:54 PM, Kevin Simonson wrote:

Currently the contents of my “testng.xml” file are:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

        <methods>

          <include name=”getCollectionSummary” />

          <include name=”updateCollection” />

        </methods>

      </class>

    </classes>

  </test>

</suite>

 

This lets me test these two test methods, which are both in the group I designate as “middle-phase”.  Now I could just add to this the name of all the other test methods in this class that belong to group “middle-phase” (there are two more of them), but is there an easier way to tell “testng.xml” I want to test all test methods in a class that belong to a specific group?

 



You speak in group terms, so isn't testNGs groups (with include and exclude) just the ticket?

class X {


@Test( group="middle-phase" )

public void getCollectionSummary() {

}


}


Test grouping can be done at the class level also; see docs.

<suite name=”clTest”>

  <test name=”clTest”>
    <package>

        <package name="org.familysearch.cds.acceptance" />
    </package>
    <groups>
      <run>
         <include name="middle-phase"/>
      </run>
    </groups>

  </test>
</suite>

--
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: Telling TestNG I Want to Run all Test Methods in a Class

Cédric Beust ♔-2
In reply to this post by Kevin Simonson
How about:

    <groups>
      <run>
        <include name="foo"/>
      </run>
    </groups>

?

-- 
Cédric




On Fri, Oct 7, 2011 at 12:54 PM, Kevin Simonson <[hidden email]> wrote:

Currently the contents of my “testng.xml” file are:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

        <methods>

          <include name=”getCollectionSummary” />

          <include name=”updateCollection” />

        </methods>

      </class>

    </classes>

  </test>

</suite>

 

This lets me test these two test methods, which are both in the group I designate as “middle-phase”.  Now I could just add to this the name of all the other test methods in this class that belong to group “middle-phase” (there are two more of them), but is there an easier way to tell “testng.xml” I want to test all test methods in a class that belong to a specific group?

 

Kevin Simonson

 



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


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

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

Re: Neither ITestListener, nor ISuiteListener, contain methods for <test> start/end

Cédric Beust ♔-2
In reply to this post by Kayla Nimis
How about onTestSuccess()?

-- 
Cédric




On Fri, Oct 7, 2011 at 11:53 AM, Kayla Nimis <[hidden email]> wrote:
Hi,

I'm currently trying to implement a test listener that reads in a file, based on a test parameter, and uses it in the onTestStart(ITestResult) method to determine whether or not to skip the method. However, it appears that there is no hook for when you start or finish a suite's test. I'm currently tracking the context.getCurrentXmlTest().getName() value in my listener, and only reading the file when that value changes. I was wondering if there was a less hacky way, or if it is in the works.

Thanks,
Kayla

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

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

RE: Telling TestNG I Want to Run all Test Methods in a Class

Kevin Simonson
In reply to this post by P. Hill-2

This looks encouraging, but I have test methods in another class in my “org.familysearch.cds.acceptance” package that are in the “middle-phase” group.  Won’t they be picked up by this XML?  What do I do to get just the test methods in the one class that are in the “middle-phase” group?

 

Kevin Simonson

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of P. Hill
Sent: Friday, October 07, 2011 2:03 PM
To: [hidden email]
Subject: Re: [testng-users] Telling TestNG I Want to Run all Test Methods in a Class

 

On 10/7/2011 12:54 PM, Kevin Simonson wrote:

Currently the contents of my “testng.xml” file are:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

        <methods>

          <include name=”getCollectionSummary” />

          <include name=”updateCollection” />

        </methods>

      </class>

    </classes>

  </test>

</suite>

 

This lets me test these two test methods, which are both in the group I designate as “middle-phase”.  Now I could just add to this the name of all the other test methods in this class that belong to group “middle-phase” (there are two more of them), but is there an easier way to tell “testng.xml” I want to test all test methods in a class that belong to a specific group?

 

 


You speak in group terms, so isn't testNGs groups (with include and exclude) just the ticket?

class X {


@Test( group="middle-phase" )

public void getCollectionSummary() {

}


}


Test grouping can be done at the class level also; see docs.

<suite name=”clTest”>

  <test name=”clTest”>
    <package>

        <package name="org.familysearch.cds.acceptance" />
    </package>
    <groups>
      <run>
         <include name="middle-phase"/>
      </run>
    </groups>

  </test>
</suite>

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



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


--
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: Telling TestNG I Want to Run all Test Methods in a Class

Cédric Beust ♔-2
Then just include that class in your XML file.

-- 
Cédric




On Fri, Oct 7, 2011 at 1:14 PM, Kevin Simonson <[hidden email]> wrote:

This looks encouraging, but I have test methods in another class in my “org.familysearch.cds.acceptance” package that are in the “middle-phase” group.  Won’t they be picked up by this XML?  What do I do to get just the test methods in the one class that are in the “middle-phase” group?

 

Kevin Simonson

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of P. Hill
Sent: Friday, October 07, 2011 2:03 PM
To: [hidden email]
Subject: Re: [testng-users] Telling TestNG I Want to Run all Test Methods in a Class

 

On 10/7/2011 12:54 PM, Kevin Simonson wrote:

Currently the contents of my “testng.xml” file are:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

        <methods>

          <include name=”getCollectionSummary” />

          <include name=”updateCollection” />

        </methods>

      </class>

    </classes>

  </test>

</suite>

 

This lets me test these two test methods, which are both in the group I designate as “middle-phase”.  Now I could just add to this the name of all the other test methods in this class that belong to group “middle-phase” (there are two more of them), but is there an easier way to tell “testng.xml” I want to test all test methods in a class that belong to a specific group?

 

 


You speak in group terms, so isn't testNGs groups (with include and exclude) just the ticket?

class X {


@Test( group="middle-phase" )

public void getCollectionSummary() {

}


}


Test grouping can be done at the class level also; see docs.

<suite name=”clTest”>

  <test name=”clTest”>
    <package>

        <package name="org.familysearch.cds.acceptance" />
    </package>
    <groups>
      <run>
         <include name="middle-phase"/>
      </run>
    </groups>

  </test>
</suite>

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



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


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

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

Re: Neither ITestListener, nor ISuiteListener, contain methods for <test> start/end

Kayla Nimis
In reply to this post by Cédric Beust ♔-2
Is there something similar for when it starts?

--
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/-/9v9K9xaWdZEJ.
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: Neither ITestListener, nor ISuiteListener, contain methods for <test> start/end

Cédric Beust ♔-2
onTestStart()?

-- 
Cédric




On Fri, Oct 7, 2011 at 3:11 PM, Kayla Nimis <[hidden email]> wrote:
Is there something similar for when it starts?

--
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/-/9v9K9xaWdZEJ.

To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

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

RE: Telling TestNG I Want to Run all Test Methods in a Class

Kevin Simonson
In reply to this post by Cédric Beust ♔-2

Okay, following Cedric’s advice (or at least I thought I was), I created “testng.xml” file:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

      </class>

      <groups>

        <run>

          <include name=”middle-phase” />

        </run>

      </groups>

    </classes>

  </test>

</suite>

 

When I right click in this file and select <Debug “C:/Sandbox/sourceCode4/cds2-root/cds-acceptance-tests/src/test/testng/testng.xml”>, execution begins in <getCollSummParms()>, the data provider of my test method <getCollectionSummary().  But this class has a method <setUp()> with the “@BeforeClass” annotation before it!  Why isn’t <setup()> getting called?  Anyone have any ideas?

 

Kevin S

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Cédric Beust ?
Sent: Friday, October 07, 2011 2:38 PM
To: [hidden email]
Subject: Re: [testng-users] Telling TestNG I Want to Run all Test Methods in a Class

 

Then just include that class in your XML file.


-- 

Cédric



On Fri, Oct 7, 2011 at 1:14 PM, Kevin Simonson <[hidden email]> wrote:

This looks encouraging, but I have test methods in another class in my “org.familysearch.cds.acceptance” package that are in the “middle-phase” group.  Won’t they be picked up by this XML?  What do I do to get just the test methods in the one class that are in the “middle-phase” group?

 

Kevin Simonson

 



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


--
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: Telling TestNG I Want to Run all Test Methods in a Class

Cédric Beust ♔-2
Probably because it's not in the group. This is explained in details in the documentation (along with "alwaysRun").

-- 
Cédric




On Fri, Oct 7, 2011 at 3:58 PM, Kevin Simonson <[hidden email]> wrote:

Okay, following Cedric’s advice (or at least I thought I was), I created “testng.xml” file:

 

<suite name=”clTest”>

  <test name=”clTest”>

    <classes>

      <class name=”org.familysearch.cds.acceptance.CollectionEndpointTest”>

      </class>

      <groups>

        <run>

          <include name=”middle-phase” />

        </run>

      </groups>

    </classes>

  </test>

</suite>

 

When I right click in this file and select <Debug “C:/Sandbox/sourceCode4/cds2-root/cds-acceptance-tests/src/test/testng/testng.xml”>, execution begins in <getCollSummParms()>, the data provider of my test method <getCollectionSummary().  But this class has a method <setUp()> with the “@BeforeClass” annotation before it!  Why isn’t <setup()> getting called?  Anyone have any ideas?

 

Kevin S

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Cédric Beust ?
Sent: Friday, October 07, 2011 2:38 PM


To: [hidden email]
Subject: Re: [testng-users] Telling TestNG I Want to Run all Test Methods in a Class

 

Then just include that class in your XML file.


-- 

Cédric



On Fri, Oct 7, 2011 at 1:14 PM, Kevin Simonson <[hidden email]> wrote:

This looks encouraging, but I have test methods in another class in my “org.familysearch.cds.acceptance” package that are in the “middle-phase” group.  Won’t they be picked up by this XML?  What do I do to get just the test methods in the one class that are in the “middle-phase” group?

 

Kevin Simonson

 



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


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