|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Method dependency issuesHello I have some basic questions related to method dependency. I have the following test: @Test (groups = {"jsf", "ajax", "crossbrowser"}) public class TestCrossbrowserUpdateAttr extends SeleneseTestCase { (...) @BeforeSuite(alwaysRun = true) @Test public void setUp(){ (start selenium here, open start page, etc) } @Test (dependsOnMethods = {"setUp"}) public void test1() throws Exception { (test logic) } @Test (dependsOnMethods = {"test1"}, alwaysRun = true) public void test2() throws Exception{ (test logic) } @AfterSuite(alwaysRun = true) @Test (dependsOnMethods = {"test2"}) public void stopTest() { (stop selenium, closes browser windows, etc) } The problem with this design is that when test2 fails, stopTest is skipped. I thought that with alwaysRun=true this method would always get called. How can I assure that it is always called? I have another test class, where I have about 8 tests that are independent of each other, and thus I made all of them dependent only on setUp(). However, I am not certain how I can tie in the stopTest() method. It does not depend on any other method in particular but needs to be executed once all the test methods complete. What's the correct approach here? Thanks Lidia --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to testng-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/testng-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Method dependency issuesHi Lidia,
You should not be mixing @Test with @AfterSuite, you should break down this code in two categories (which one is really a test and which one is used to tear down your test) and put these in separate methods. Can you do this and post your updated code if you're still having problems? -- Cedric On Fri, Nov 6, 2009 at 6:35 PM, Lidia <lidiam@...> wrote:
-- 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@... To unsubscribe from this group, send email to testng-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/testng-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Method dependency issuesAfter removing @Test annotation for setUp and dependency of tests on setUp, it all works fine. Thanks! Lidia On Nov 6, 8:04 pm, Cédric Beust ♔ <cbe...@...> wrote: > Hi Lidia, > > You should not be mixing @Test with @AfterSuite, you should break down this > code in two categories (which one is really a test and which one is used to > tear down your test) and put these in separate methods. > > Can you do this and post your updated code if you're still having problems? > > -- > Cedric > > > > On Fri, Nov 6, 2009 at 6:35 PM, Lidia <lid...@...> wrote: > > > Hello > > > I have some basic questions related to method dependency. I have the > > following test: > > > @Test (groups = {"jsf", "ajax", "crossbrowser"}) > > public class TestCrossbrowserUpdateAttr extends SeleneseTestCase { > > (...) > > > @BeforeSuite(alwaysRun = true) > > @Test > > public void setUp(){ > > (start selenium here, open start page, etc) > > } > > > @Test (dependsOnMethods = {"setUp"}) > > public void test1() throws Exception { > > (test logic) > > } > > > @Test (dependsOnMethods = {"test1"}, > > alwaysRun = true) > > public void test2() throws Exception{ > > (test logic) > > } > > > @AfterSuite(alwaysRun = true) > > @Test (dependsOnMethods = {"test2"}) > > public void stopTest() { > > (stop selenium, closes browser windows, etc) > > } > > > The problem with this design is that when test2 fails, stopTest is > > skipped. I thought that with alwaysRun=true this method would always > > get called. How can I assure that it is always called? > > > I have another test class, where I have about 8 tests that are > > independent of each other, and thus I made all of them dependent only > > on setUp(). However, I am not certain how I can tie in the stopTest() > > method. It does not depend on any other method in particular but > > needs to be executed once all the test methods complete. What's the > > correct approach here? > > > Thanks > > Lidia > > -- > ***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@... To unsubscribe from this group, send email to testng-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/testng-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Method dependency issuesOn Tue, Nov 10, 2009 at 2:58 PM, Lidia <lidiam@...> wrote: --
Glad to hear it! 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@... To unsubscribe from this group, send email to testng-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/testng-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |