You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steve Halliwell edited this page Oct 23, 2019
·
1 revision
Unity Test Tools
If you are using the Unity Test Tools, FungusLua is a powerful and fast way to create integration tests using Lua scripting.
Example
Create a new test in the scene.
Add a Lua object (Tools > Fungus > Create > Lua) as a child of the test object.
In the LuaScript component, use the check() function to assert whatever conditions you need for the test. At the end, call pass().
Example test script:
-- Check a condition, and output a reason if it failscheck( myvar<40, "My var is too big")
-- Just check a conditioncheck( myvar>20 )
-- Test will exit successfullypass()
If any of the checks fail, then the test fails immediately.
Lua Functions
-- Checks if a condition is true-- Lua has a built in assert function, so we called this check to avoid conflicting.check(c, reason)
-- Pass an integration testpass()
-- Fail an integration test-- reason: Optional string explaining why the test failed.fail(reason)