How to run several test cases in one class?

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

How to run several test cases in one class?

Postby ninaonao » Tue Oct 05, 2010 3:39 am

I have created several test cases in one java class, they all passed if I ran them one by one. But if I ran them together, only the first test case pass, how to run them together in one class?
ninaonao
 
Posts: 7
Joined: Mon Oct 04, 2010 4:38 am

Re: How to run several test cases in one class?

Postby gnebling » Tue Oct 05, 2010 7:24 am

For starters, see if this post helps.

viewtopic.php?f=5&t=933
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Re: How to run several test cases in one class?

Postby ninaonao » Wed Oct 06, 2010 1:23 am

Well...This is not the way I want to do it. I want to put all the test cases which related to one window in one java class, and I have quite a lot of windows which mean I have lots of classes. I don't want to including all my single test case in a Test Suite. But thank you anyway!
ninaonao
 
Posts: 7
Joined: Mon Oct 04, 2010 4:38 am

Re: How to run several test cases in one class?

Postby keertip » Wed Oct 06, 2010 12:21 pm

Are you looking at having several test methods, all exercising a single view in one class?

Code: Select all
public class TestView extends UITestCaseSWT {

   /* @see junit.framework.TestCase#setUp()
       */
   protected void setUp() throws Exception {
        super.setUp();
        // add code in here to initialize view for start of test
        // this is called before the test is executed
   }

    public void test1() throws Exception {
    ...
    }

    public void test2() throws Exception {
    ...
    }

     public void test3() throws Exception {
    ...
    }
}

keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: How to run several test cases in one class?

Postby ninaonao » Wed Oct 06, 2010 11:55 pm

Thank you! That's what I did, but only the first test case passed, the rests failed. I don't know why.
ninaonao
 
Posts: 7
Joined: Mon Oct 04, 2010 4:38 am

Re: How to run several test cases in one class?

Postby keertip » Thu Oct 07, 2010 2:01 pm

At the start of the second test, is the view in the initialized state? Interactions from the first test may have changed the state of the view.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron