class

HxTest

abstract class HxTest : HaystackTest

HxTest is a base class for writing Haxall tests which provide access to a booted project instance. Annotate test methods which require a project with HxTestProj. This class uses the hxd implementation for its project.

@HxTestProj
Void testBasics()
{
  x := addRec(["dis":"It works!"])
  y := rt.db.readById(x.id)
  verifyEq(y.dis, "It works!")
}

The following environment variables may be used to customize behavior the tests when running in a SkySpark environment:

  • HX_TEST_HTTP_PORT: http port to use when booting a runtime; the default is 8080 if not specified
  • SKYSPARK_TEST_LIC_DIR: directory to look for license file(s) which are installed for the test system. The default is the {Env.workDir}/var/lic/.

methods read

Convenience for read on proj

addFunc

Convenience for proj.specs.addFunc

commit

Convenience for commit to proj

proj

Test project if @HxTestProj configured on test method

readById

Convenience for readById on proj

sys

Get system if @HxTestProj configured on test method

addLib

Add a library and all its depdenencies to the project

eval

Evaluate an Axon expression using a super user context

addExt

Convenience to add extension lib with optional setting and return it

makeContext

Create a new context with the given user

setup

If @HxTestProj configured then open proj

addRec

Add a record to proj using the given map of tags

teardown

If @HxTestProj configured then close down proj

addExt Ext addExt(Str libName, Str:Obj? tags)

Convenience to add extension lib with optional setting and return it

addFunc Spec addFunc(Str name, Str src, Obj? meta)

Convenience for proj.specs.addFunc

addLib Void addLib(Str libName)

Add a library and all its depdenencies to the project.

addRec Dict addRec(Str:Obj? tags)

Add a record to proj using the given map of tags.

commit Dict? commit(Dict rec, Obj? changes, Int flags)

Convenience for commit to proj

eval Obj? eval(Str axon)

Evaluate an Axon expression using a super user context.

makeContext virtual Context makeContext(User? user)

Create a new context with the given user. If user is null, then use a default test user with superuser permissions.

proj Proj? proj(Bool checked)

Test project if @HxTestProj configured on test method

read Dict? read(Str filter, Bool checked)

Convenience for read on proj

readById Dict? readById(Ref id, Bool checked)

Convenience for readById on proj

setup virtual Void setup()

If @HxTestProj configured then open proj

sys Sys? sys(Bool checked)

Get system if @HxTestProj configured on test method

teardown virtual Void teardown()

If @HxTestProj configured then close down proj

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST