powered by Jive Software

Howto use smack JUnit tests

I’'ve been looking to the smack unit test and I found them really interesting. I want to use them in order to validate server features rather than testing the library.

There is no documentation on the test and I would like to know how to configure the tests scenarios. Which usernames are used to log into the server, associated with which password. Is this fixed or configurable.

Thanks for your help

-Yann

Hey Yann,

I’‘m glad you like them. I’'m a big fun of JUnits basically due to their benefits. As you can see in Smack we have a base class for the test cases called SmackTestCase. This class is responsible for creating and destroying user accounts. User accounts are created for each test case and destroyed after the test case has finished. Created usernames are of the form user[N] where N is replaced by a number starting from 0. The password matches the username.

Regards,

– Gato

Thanks a lot

In fact I already has userx accounts in my system but with incompatible passwords. Cleaning the database makes the trick.

Will it be possible to have a sample test config file where I can easily change settings?

Hey Yann,

There is a test-case.xml file under test/config. You can modify the host and port to use but not the username. I will try to make the username also configurable for the next Smack release.

Thanks,

– Gato

Thanks a lot Gato.

In fact this file is in svn but is somehow excluded from source releases (2.2.1 and 3.0.X)

Hey Yann,

I created SMACK-206 and checked in the required changes. You can get them from SVN or from the next nightly build.

Regards,

– Gato

Thanks a lot.

Thanks a lot with this case,it’'s usefully very much.

Message was edited by: webjlwang