Reference
Following a list of all BTD functions, grouped by tool.
- 1. Unit test
-
As to 'namespace' the following initialisation code is assumed :
local test = require('btd.lua.test.lua')()
and for the actual test class :
local Api = require('btd.lua.testapi.lua')
also a test can be :
test:run()
test:run('ClassX')
test:run('TestClassX:testmethodY')
test:clear()
- Clear test statistics.
test:clearAll()
- Clear all test classes from global environment.
test:run()
- DEPRECATED
test:run('ClassX','ClassY')
- Run all
testMethod
's from the specified classes.
test:run('ClassX:methodY')
- Run specified method from the specified class.
test:report()
- Trigger report output (not yet reported).
test:reportAll()
- Trigger report output (all reports).
test.errorIDE = true/false
- Select IDE integration type report output.
test.verbose = true/false
- Select verbose report output.
test.silent = true/false
- Select automatic report output.
TestClassX:setUpClass()
- Class initialisation code.
TestClassX:tearDownClass()
- Class clean up code.
TestClassX:setUp()
- Test method initialisation code.
TestClassX:tearDown()
- Test method clean up code.
TestClassX.Serial = true/false
- Run all test methods one by one instead of in parallel.
TestClassX.testMethodSerial = true/false
- Run selected test methods one by one instead of in parallel.
TestClassX.testMethodTime = value
- Allocate maximum run time (value) of test method
Api.differs(actual,expected)
- Test whether result of test differs from the expected result.
-
Api.equals(actual,expected)
(or
assertEquals(actual,expected)
or
assert_Equals(actual,expected)
)
- Test whether result of test equals the expected result.
-
Api.fails('userfunction(???)')
(
or assertError('userfunction(???)')
or assert_Error('userfunction(???)')
)
- Test whether the
userfunction(???)
throws an error.
Api.succeeds('userfunction(???)')
- Test whether the
userfunction(???)
does not throw an error.
-
TestClassX = Api.wrap('methodX','methodY',...)
(or TestClassX = wrapFunctions('methodX','methodY',...)
)
- Wrap methods into
TestClassX
- 2. GUI test
-
As to 'namespace' the following initialisation code is assumed :
local Gui = require('btd.lua.testiup.lua')()
Gui.iupLoop(func)
-
If
func
is not a function (or nil) then the GUI
under test will run completely, but will exit it's main loop the
first time idle time processing is called. If it is a function
the GUI under test will keep running it's main loop and do it's
idle time processing (if any) followed by the function
.
The test must be terminated by the function
.
- See examples in test directories