Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

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

Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

Jason McSwain
I have a couple classes that all extend the same base class.  Here is a simple example of the abstract and test classes.

  • Issues/Questions:
    • When i open TestExampleContext1 in eclipse, and right click on the class, i don't have the option to run as testNG, can that be added?
    • Have you considered extending the Eclipse Plugin to Allow for individual test method executions when the test is an inherited test?
  • Work Around:
    • create a dummy test method that does nothing in the TestExampleContext1, so eclipse will let me run the class.
    • have dummy test method call inherited test method, and then right click on dummy test method to run individual test method.
    • But i have to remember to remove all this work around stuff, when it comes time to run official tests.

------------------------------------------------------------------------------------------------------------
public abstract class AbstractTestExample {

    @Test
    public void test1() {
        System.out.println(getContext());
    }

    @Test
    public void test2() {
        System.out.println(getContext());
    }

    public abstract String getContext();
}

------------------------------------------------------------------------------------------------------------
public class TestExampleContext1 extends AbstractTestExample {

    @Override
    public String getContext() {
        return "context1";
    }
}
------------------------------------------------------------------------------------------------------------

--
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: Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

Jason McSwain
Cedric,  

Have you had a chance to take a look at this?  Do you have any ideas on how to fix?

Thanks,
-Jason-

On Thu, Sep 20, 2012 at 10:13 AM, Jason McSwain <[hidden email]> wrote:
I have a couple classes that all extend the same base class.  Here is a simple example of the abstract and test classes.

  • Issues/Questions:
    • When i open TestExampleContext1 in eclipse, and right click on the class, i don't have the option to run as testNG, can that be added?
    • Have you considered extending the Eclipse Plugin to Allow for individual test method executions when the test is an inherited test?
  • Work Around:
    • create a dummy test method that does nothing in the TestExampleContext1, so eclipse will let me run the class.
    • have dummy test method call inherited test method, and then right click on dummy test method to run individual test method.
    • But i have to remember to remove all this work around stuff, when it comes time to run official tests.

------------------------------------------------------------------------------------------------------------
public abstract class AbstractTestExample {

    @Test
    public void test1() {
        System.out.println(getContext());
    }

    @Test
    public void test2() {
        System.out.println(getContext());
    }

    public abstract String getContext();
}

------------------------------------------------------------------------------------------------------------
public class TestExampleContext1 extends AbstractTestExample {

    @Override
    public String getContext() {
        return "context1";
    }
}
------------------------------------------------------------------------------------------------------------

--
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: Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

Manoj Kapuganti

'Run as TestNG' option will display only when there is atleast one TestNG annotation exists in your class.
Example: @Test

Best Regards,
Manoj Kapuganti

On Sep 24, 2012 8:59 PM, "Jason McSwain" <[hidden email]> wrote:
Cedric,  

Have you had a chance to take a look at this?  Do you have any ideas on how to fix?

Thanks,
-Jason-

On Thu, Sep 20, 2012 at 10:13 AM, Jason McSwain <[hidden email]> wrote:
I have a couple classes that all extend the same base class.  Here is a simple example of the abstract and test classes.

  • Issues/Questions:
    • When i open TestExampleContext1 in eclipse, and right click on the class, i don't have the option to run as testNG, can that be added?
    • Have you considered extending the Eclipse Plugin to Allow for individual test method executions when the test is an inherited test?
  • Work Around:
    • create a dummy test method that does nothing in the TestExampleContext1, so eclipse will let me run the class.
    • have dummy test method call inherited test method, and then right click on dummy test method to run individual test method.
    • But i have to remember to remove all this work around stuff, when it comes time to run official tests.

------------------------------------------------------------------------------------------------------------
public abstract class AbstractTestExample {

    @Test
    public void test1() {
        System.out.println(getContext());
    }

    @Test
    public void test2() {
        System.out.println(getContext());
    }

    public abstract String getContext();
}

------------------------------------------------------------------------------------------------------------
public class TestExampleContext1 extends AbstractTestExample {

    @Override
    public String getContext() {
        return "context1";
    }
}
------------------------------------------------------------------------------------------------------------

--
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: Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

Jason McSwain
Manoj, 

Yes, i realize that.  i've been using TestNG for 5+ years.  this has been an issue since the beginning, and i was wondering if there was ever going to be a fix.  Technically, the class does have @Test methods, but they are inherited through a parent class.  as in my example. 

-Jason-

On Mon, Sep 24, 2012 at 11:26 AM, Manoj Kapuganti <[hidden email]> wrote:

'Run as TestNG' option will display only when there is atleast one TestNG annotation exists in your class.
Example: @Test

Best Regards,
Manoj Kapuganti

On Sep 24, 2012 8:59 PM, "Jason McSwain" <[hidden email]> wrote:
Cedric,  

Have you had a chance to take a look at this?  Do you have any ideas on how to fix?

Thanks,
-Jason-

On Thu, Sep 20, 2012 at 10:13 AM, Jason McSwain <[hidden email]> wrote:
I have a couple classes that all extend the same base class.  Here is a simple example of the abstract and test classes.

  • Issues/Questions:
    • When i open TestExampleContext1 in eclipse, and right click on the class, i don't have the option to run as testNG, can that be added?
    • Have you considered extending the Eclipse Plugin to Allow for individual test method executions when the test is an inherited test?
  • Work Around:
    • create a dummy test method that does nothing in the TestExampleContext1, so eclipse will let me run the class.
    • have dummy test method call inherited test method, and then right click on dummy test method to run individual test method.
    • But i have to remember to remove all this work around stuff, when it comes time to run official tests.

------------------------------------------------------------------------------------------------------------
public abstract class AbstractTestExample {

    @Test
    public void test1() {
        System.out.println(getContext());
    }

    @Test
    public void test2() {
        System.out.println(getContext());
    }

    public abstract String getContext();
}

------------------------------------------------------------------------------------------------------------
public class TestExampleContext1 extends AbstractTestExample {

    @Override
    public String getContext() {
        return "context1";
    }
}
------------------------------------------------------------------------------------------------------------

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

Re: Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

salilsurendran
Any updates on this functionality. This would be super useful.

On Monday, 24 September 2012 09:39:11 UTC-7, Jason McSwain wrote:
Manoj, 

Yes, i realize that.  i've been using TestNG for 5+ years.  this has been an issue since the beginning, and i was wondering if there was ever going to be a fix.  Technically, the class does have @Test methods, but they are inherited through a parent class.  as in my example. 

-Jason-

On Mon, Sep 24, 2012 at 11:26 AM, Manoj Kapuganti <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">manoj...@...> wrote:

'Run as TestNG' option will display only when there is atleast one TestNG annotation exists in your class.
Example: @Test

Best Regards,
Manoj Kapuganti

On Sep 24, 2012 8:59 PM, "Jason McSwain" <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">jasonw...@...> wrote:
Cedric,  

Have you had a chance to take a look at this?  Do you have any ideas on how to fix?

Thanks,
-Jason-

On Thu, Sep 20, 2012 at 10:13 AM, Jason McSwain <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">jasonw...@...> wrote:
I have a couple classes that all extend the same base class.  Here is a simple example of the abstract and test classes.

  • Issues/Questions:
    • When i open TestExampleContext1 in eclipse, and right click on the class, i don't have the option to run as testNG, can that be added?
    • Have you considered extending the Eclipse Plugin to Allow for individual test method executions when the test is an inherited test?
  • Work Around:
    • create a dummy test method that does nothing in the TestExampleContext1, so eclipse will let me run the class.
    • have dummy test method call inherited test method, and then right click on dummy test method to run individual test method.
    • But i have to remember to remove all this work around stuff, when it comes time to run official tests.

------------------------------------------------------------------------------------------------------------
public abstract class AbstractTestExample {

    @Test
    public void test1() {
        System.out.println(getContext());
    }

    @Test
    public void test2() {
        System.out.println(getContext());
    }

    public abstract String getContext();
}

------------------------------------------------------------------------------------------------------------
public class TestExampleContext1 extends AbstractTestExample {

    @Override
    public String getContext() {
        return "context1";
    }
}
------------------------------------------------------------------------------------------------------------

--
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="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="cLiSLYSaVe0J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">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 [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
|

Re: Eclipse Plugin: Running a TestNg Class that Inherits all it's tests

⇜Krishnan Mahadevan⇝
It would be best if you could try this out using the latest testng plugin and if this still doesn't work, then I suggest that you log an issue for this here : https://github.com/cbeust/testng/issues

That way Cedric or any one of the folks who are enthusiastic on sending pull requests atleast have a chance of finding it and taking a knock at it!

Issues tracked in this forum tend to get lost over a period of time.


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 Wed, Apr 30, 2014 at 5:31 AM, Salil Surendran <[hidden email]> wrote:
Any updates on this functionality. This would be super useful.

On Monday, 24 September 2012 09:39:11 UTC-7, Jason McSwain wrote:
Manoj, 

Yes, i realize that.  i've been using TestNG for 5+ years.  this has been an issue since the beginning, and i was wondering if there was ever going to be a fix.  Technically, the class does have @Test methods, but they are inherited through a parent class.  as in my example. 

-Jason-

On Mon, Sep 24, 2012 at 11:26 AM, Manoj Kapuganti <[hidden email]> wrote:

'Run as TestNG' option will display only when there is atleast one TestNG annotation exists in your class.
Example: @Test

Best Regards,
Manoj Kapuganti

On Sep 24, 2012 8:59 PM, "Jason McSwain" <[hidden email]> wrote:
Cedric,  

Have you had a chance to take a look at this?  Do you have any ideas on how to fix?

Thanks,
-Jason-

On Thu, Sep 20, 2012 at 10:13 AM, Jason McSwain <[hidden email]> wrote:
I have a couple classes that all extend the same base class.  Here is a simple example of the abstract and test classes.

  • Issues/Questions:
    • When i open TestExampleContext1 in eclipse, and right click on the class, i don't have the option to run as testNG, can that be added?
    • Have you considered extending the Eclipse Plugin to Allow for individual test method executions when the test is an inherited test?
  • Work Around:
    • create a dummy test method that does nothing in the TestExampleContext1, so eclipse will let me run the class.
    • have dummy test method call inherited test method, and then right click on dummy test method to run individual test method.
    • But i have to remember to remove all this work around stuff, when it comes time to run official tests.

------------------------------------------------------------------------------------------------------------
public abstract class AbstractTestExample {

    @Test
    public void test1() {
        System.out.println(getContext());
    }

    @Test
    public void test2() {
        System.out.println(getContext());
    }

    public abstract String getContext();
}

------------------------------------------------------------------------------------------------------------
public class TestExampleContext1 extends AbstractTestExample {

    @Override
    public String getContext() {
        return "context1";
    }
}
------------------------------------------------------------------------------------------------------------

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