type

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!")
}

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

Slot Details

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 override Void setup()

If @HxTestProj configured then open proj

sys

Sys? sys(Bool checked := true)

Get system if @HxTestProj configured on test method

teardown

virtual override Void teardown()

If @HxTestProj configured then close down proj