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 specifiedSKYSPARK_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/.
Convenience for read on proj
Convenience for proj.specs.addFunc
Convenience for commit to proj
Test project if @HxTestProj configured on test method
Convenience for readById on proj
Get system if @HxTestProj configured on test method
Add a library and all its depdenencies to the project
Evaluate an Axon expression using a super user context
Convenience to add extension lib with optional setting and return it
Create a new context with the given user
If @HxTestProj configured then open proj
Add a record to proj using the given map of tags
If @HxTestProj configured then close down proj
Ext addExt(Str libName, Str:Obj? tags)
Convenience to add extension lib with optional setting and return it
Spec addFunc(Str name, Str src, Obj? meta)
Convenience for proj.specs.addFunc
Void addLib(Str libName)
Add a library and all its depdenencies to the project.
Dict addRec(Str:Obj? tags)
Add a record to proj using the given map of tags.
Dict? commit(Dict rec, Obj? changes, Int flags)
Convenience for commit to proj
Obj? eval(Str axon)
Evaluate an Axon expression using a super user context.
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(Bool checked)
Test project if @HxTestProj configured on test method
Dict? read(Str filter, Bool checked)
Convenience for read on proj
Dict? readById(Ref id, Bool checked)
Convenience for readById on proj
virtual Void setup()
If @HxTestProj configured then open proj
Sys? sys(Bool checked)
Get system if @HxTestProj configured on test method
virtual Void teardown()
If @HxTestProj configured then close down proj