Files 1
Downloads 1,803
Favorites 2
My AddOns
    Safety
    How to use the Safety library and its GUI component
    If you've downloaded and installed the Safety library, you might want to start using it while developing your own addons. To do so, there are a few basic steps you need to follow:
    1~ Create a function to test some functionality in your own addon
    2~ Create a Safety Test Suite
    3~ Create a Safety Test Case, and add it to your Suite
    At this point you have alternatives.
    You can access the Safety TestRunner object programmatically to run your test suite, or you can add your suite to the Safety Suite registry to have it appear in the Safety GUI, and run your tests through that.
    Here's an example on how to do the latter:
    Code:
    	local redSuite = TestSuite:new("Red Sample Suite", "Sample Test Suite containing red tests.");
    	redSuite:Add("Test 1", Safety.SampleApplication.TestAddition);
    	redSuite:Add("Test 2", Safety.SampleApplication.TestApplicationError);
    	Safety.SuiteRegistry:Register(redSuite);
    After this code runs, if you open the Safety GUI (/safety), you should find the 'redSuite' in the Suite selection dropdown menu.

    This example comes straight out of Safety itself, from the SampleApplication.lua file. It's part of a function that is called when you want to load the sample suites (/safety demo).

    F.O.R.