Creating simple test

As an example we will use src/test/java/tigase/tests/ExampleJaxmppTest.java test case. Followings steps should be taken:

  1. extend AbstractTest class:

    public class ExampleJaxmppTest extends AbstractTest {}
  2. create test method and annote it with @Test. In addition specify test group and provide short description

    @Test(groups = { "examples" }, description = "Simple test verifying logging in by the user")
    public void SimpleLoginTest() {}
  3. create an Account object, configure it, later build Jaxmpp object from it and connect to the server

    Account userAccount = createAccount().setLogPrefix("test_user" ).build();
    Jaxmpp jaxmpp = userAccount.createJaxmpp().build();
    jaxmpp.login( true );
  4. check whether the connection was successful

    assertTrue(createJaxmpp.isConnected(), "contact was not connected" );