As an example we will use src/test/java/tigase/tests/ExampleJaxmppTest.java
test case. Followings steps should be taken:
extend AbstractTest
class:
public class ExampleJaxmppTest extends AbstractTest {}
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() {}
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 );
check whether the connection was successful
assertTrue(createJaxmpp.isConnected(), "contact was not connected" );