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 addExt

Convenience to add extension lib with optional setting and return it

addFunc

Convenience for proj.specs.addFunc

addLib

Add a library and all its depdenencies to the project

addRec

Add a record to proj using the given map of tags

commit

Convenience for commit to proj

eval

Evaluate an Axon expression using a super user context

makeContext

Create a new context with the given user

proj

Test project if @HxTestProj configured on test method

read

Convenience for read on proj

readById

Convenience for readById on proj

setup

If @HxTestProj configured then open proj

sys

Get system if @HxTestProj configured on test method

teardown

If @HxTestProj configured then close down proj

addExt Ext addExt(Str libName, Str:Obj? tags := [Str:Obj?][:])

Convenience to add extension lib with optional setting and return it

addFunc Spec addFunc(Str name, Str src, Obj? meta := null)

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 := [Str:Obj?][:])

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

commit Dict? commit(Dict rec, Obj? changes, Int flags := 0)

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 := null)

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 := true)

Test project if @HxTestProj configured on test method

read Dict? read(Str filter, Bool checked := true)

Convenience for read on proj

readById Dict? readById(Ref id, Bool checked := true)

Convenience for readById on proj

setup virtual Void setup()

If @HxTestProj configured then open proj

sys Sys? sys(Bool checked := true)

Get system if @HxTestProj configured on test method

teardown virtual Void teardown()

If @HxTestProj configured then close down proj

Haxall 4.0.6 ∙ 21-Jul-2026 09:48 EDT