Skip to content

Unit Testing with XojoUnit

Did you know that Xojo includes a unit testing framework?

The XojoUnit unit testing framework gives you an easy way to create unit tests and see the results of those unit tests. XojoUnit is available for desktop, web and console applications.

You create tests by subclassing the TestGroup class and adding methods that end in “Test”. You can use a variety of assertion methods such as AreDifferent, AreEqual, AreSame, IsFalse, IsNil, IsNotNil and IsTrue.

The results of the unit tests are displayed in the test output. This shows you the output of each individual test as well as timings for each test. You’ll also see any failure messages or other messages that you specify. This is sample output of the desktop version of XojoUnit:

XojoUnitDesktop.pngAnd this is the web version:


The console version outputs test results to a text file.

XojoUnit is included with the examples that are part of your Xojo installation and are located here: Examples/UnitTesting

For full instructions on how to use XojoUnit, refer to the documentation in User Guide Book 4: Development, Chapter 6: Unit Testing.