Hi all,
I'm new to cactus and have just created a test class to test some
registration scenarios in a project I'm involved in.
It seems that the test methods are not run in any particular sequence, is
this true?

My class has two test methods and I would like the tests to be run in a
particular sequence. I don't want the tests to call each other in a begin
method as this would mean that some tests will be called a lot of times. 

Any help in setting a specific order would be greatly appreciated.
Colum.


My test class is as follows :

/*
 * Copyright (c) 2004 Yahoo! Inc
 * All rights reserved.
 *
 */
package com.yahoo.gmmh.test.user;

import org.apache.cactus.ServletTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import com.yahoo.gmmh.ejb.user.interfaces.RegistrationManager;
import com.yahoo.gmmh.ejb.user.interfaces.RegistrationManagerUtil;
import org.apache.log4j.Category;
import com.yahoo.gmmh.hibernate.UserProfile;
import com.yahoo.gmmh.test.GMMHTestSuite;
import com.yahoo.gmmh.hibernate.MobileDevice;

/**
 */
public class RegistrationManagerTest extends ServletTestCase {
  /**
   * Static reference to Log4J Logger.
   */
  private static final Category LOG =
Category.getInstance(RegistrationManagerTest.class);

  /**
   * The session bean which is being tested.
   */
  private RegistrationManager regMgr =
RegistrationManagerUtil.getHome().create();

  /**
   * Default constructor
   *
   * @param testCaseName The name of the test case.
   */
  public RegistrationManagerTest(String testCaseName)
  {
    super(testCaseName);
  }

  /**
   * Tests creating a completely new user with only a yid.
   *
   * @throws Exception If unable to execute the test case.
   */
  public void testCreateNewUserProfile() throws Exception
  {
    if(LOG.isDebugEnabled()) {
      LOG.debug("Running test 'testCreateNewUserProfile'");
    }

    UserProfile userProfile =
this.regMgr.createNewUserProfile(GMMHTestSuite.testUser);
    
    // check to ensure the yid is correct.
    assertEquals(GMMHTestSuite.testUser, userProfile.getYahooID());
  }

  /**
   * Tests adding an msisdn to an existing user.
   *
   * @throws Exception If unable to execute the test case.
   */
  public void testAddMobileDeviceToUser() throws Exception
  {
    if(LOG.isDebugEnabled()) {
      LOG.debug("Running test 'testAddMobileDeviceToUser'");
    }

    UserProfile userProfile =
this.regMgr.addMobileDeviceToUser(GMMHTestSuite.testUser, 
 
GMMHTestSuite.testMSISDN);
   
    // check to ensure the yid is correct.
    assertEquals(GMMHTestSuite.testUser, userProfile.getYahooID());
  }


  /**
   * Start the tests.
   * 
   * @param theArgs String[]
   */
  public static void main (String[] theArgs) {
    junit.swingui.TestRunner.main(new String[]
{RegistrationManagerTest.class.getName()});
  }

  /**
   * Creates the testsuite of all the tests to be run. <br/>
   * 
   * @return a test suite that includes all methods starting with "test"
   */
  public static Test suite () {
    return new TestSuite(RegistrationManagerTest.class);
  }
}




















_____________________________________________________________ 

   Colum O'Dea  [EMAIL PROTECTED]
   Mobile Engineer, Yahoo! Europe
   Yahoo! Europe, 10 Ebury Bridge Road, London, SW1 W8PZ, GB
   Tel   :  +44 20 7808 4498   Fax     : +44 20 7808 4414
   Mob   :  +44 79 7326 0043   YahooID : columod

   "If at first you do succeed try not to look astonished!!" 
_____________________________________________________________ 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to