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