Get jBilling


Testing jBilling

Every time there are changes in the source code, we need to do a sanity test. This is a set of tests that go over the main functions of jBilling, making sure that they are still doing what they should do. An experienced user can do these tests in less than 10 minutes. This sanity test is just an addition to the actual unit test that you would conduct to check the specific behavior that your code changes have created.

There are two sets of tests. One is done by using the web based graphic user interface (GUI testing). Here you test as if you were a customer clicking on menu options and manually entering values. The second test is an automated process that is included in the build scripts and based on JUnit.

GUI Testing

Before you begin, read the Getting Started guide. You only need to do this once to familiarize yourself with jBilling. It takes about 20 minutes and it will save you time, since you won’t have to wander around the menu options later on.

  1. Start by editing We want the billing process to start five minutes after start up, and then run every five minutes:
  2. Start up jBilling. Login as an administrator.
  3. Create an item type.
  4. Create an item.
  5. Create a new customer.
  6. Create an order for this customer. Make it monthly and pre-paid. Add the item you created in step 4.
  7. Click on Process -> Configuration. Change the next run date to today, and leave unchecked the checkbox for ‘Requires review.’
  8. Click on Process -> Latest. You probably won’t see any information yet. You have to wait until the scheduled billing process is triggered. This should be a minute or two, since you configured the billing process to run every five minutes in step 1. Refresh this screen until you see some data.
  9. Only one invoice should be generated in the billing process. Click on it and make sure the total corresponds to the order you created in step 6.
  10. Click on payments, then credit card, and get the new invoice paid. Verify that the balance goes to zero and the status to ‘paid.’

JUnit (Automated Testing)

  1. Make sure jBilling is down: jbilling/bin/
  2. Install postgres and create a database called 'jbilling_test' with a user 'jbilling' (no password) that has all privileges in this database.
  3. Run jbilling/src/ant prepare-test. This will create the tables and add all the test data to the postgres database. If you get an 'out of memory' error, you need to increase the Java memory. Something like this works on Linux: export ANT_OPTS=-Xmx512m
  4. Configure your jBilling installation to use postgres instead of the default HSQL. To do this, edit the configuration file jbilling-database.xml and copy the postgres JDBC driver to the lib directory (there are more details on this page, but not all of the configuration needs to be completed).
  5. Start-up jbilling: jbilling/bin/
  6. Run jbilling/src/ant test-ws. This is the fast automated test. You should conduct this one often because it touches many components and can be completed in a few minutes.
  7. Run jbilling/src/ant test. This should be done only when you think you are finished. It does a full billing process and mediation test and it takes over an hour. The message you are looking for is ‘BUILD SUCCESSFUL.’ Note that the file server.log will have plenty of exceptions even when you have a successful test.