unittesting

From: Koen Segers (KoenSeger..carlet.be)
Date: Tue Feb 15 2005 - 06:33:59 EST

  • Next message: Andrus Adamchik: "Re: Aggregate in a Qualifier"

    Hi,

    I need to create a unit test for cayenne and Tapestry.
    I allready made it this way that the method for creating a new entry in the
    table only requires the Datacontext as parameter.

    public void createUser(DataContext context){
      new AssertionError(context!=null);
      new AssertionError(!isExistingUserName(context));
      Users user = (Users) context.createAndRegisterNewObject(Users.class);
      user.setName(getUserName());
      user.setPassword(getPassword());
      user.setAuthlevel(getAuthLevelID());
      context.commitChanges();
      new AssertionError(isExistingUserName(context));
     }

    This method must be tested.
    I did it this way:

    public void testValidCreate(){
      fCreateUser.setAuthLevel("1");
      fCreateUser.setUserName("testcase1");
      fCreateUser.setPassword("testcase1");
      assertFalse(fCreateUser.isExistingUserName(context));
      fCreateUser.createUser(context);
      assertTrue(fCreateUser.isExistingUserName(context));
     }

    The constructor of this TestCase:
    public CreateUserTest(String name) {
      super(name);
      context = DataContext.createDataContext();
     }

    When I run this test in eclipse I get lots of errors.
    Strangely Jmeter (regression test) does work.
    So I believe there must be a fault with used libraries...

    This is what I get from the eclipse-console:
    INFO QueryLogger: Created connection pool: jdbc:postgresql://xxxxx/work
     Driver class: org.postgresql.Driver
     Min. connections in the pool: 1
     Max. connections in the pool: 100
    INFO QueryLogger: --- will run 1 query.
    INFO QueryLogger: Opening connection: jdbc:postgresql://xxxxxx/work
     Login: xxxxxx
     Password: ***********
    INFO QueryLogger: +++ Connecting: SUCCESS.
    INFO QueryLogger: --- transaction started.

    I don't know what is wrong.
    I also checked with ethereal, data is send, but no query. It just stops...

    -- 
    

    Koen Segers

    <koenseger..carlet.be>



    This archive was generated by hypermail 2.0.0 : Tue Feb 15 2005 - 06:34:15 EST