type

HxTest

abstract class HxTest : HaystackTest

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

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

methods

addLib

Add a library and all its depdenencies to the runtime.

addRec

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

commit

Convenience for commit to rt

eval

Evaluate an Axon expression using a super user context.

makeContext

Create a new context with the given user.

read

Convenience for read on rt

readById

Convenience for readById on rt

rt

Test runtime if @HxRuntimeTest configured on test method

setup

If @HxRuntimeTest configured then open rt

teardown

If @HxRuntimeTest configured then close down rt

Slot Details

addLib

HxLib addLib(Str libName, Str:Obj? tags := [Str:Obj?][:])

Add a library and all its depdenencies to the runtime.

addRec

Dict addRec(Str:Obj? tags := [Str:Obj?][:])

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

commit

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

Convenience for commit to rt

eval

Obj? eval(Str axon)

Evaluate an Axon expression using a super user context.

makeContext

virtual HxContext makeContext(HxUser? user := null)

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

read

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

Convenience for read on rt

readById

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

Convenience for readById on rt

rt

HxRuntime? rt(Bool checked := true)

Test runtime if @HxRuntimeTest configured on test method

setup

virtual override Void setup()

If @HxRuntimeTest configured then open rt

teardown

virtual override Void teardown()

If @HxRuntimeTest configured then close down rt