ASUnit
IntroductionLicense: GNU GPL, see COPYING for details. DiscussionAn AppleScript testing framework. Classes
Functions
autorunAutomatically runs all the registered tests. on autorun( aTestSuite) makeAssertionsFactory handler to generate a test script. on makeAssertions( theParent) ParametersEmbedded ClassesReturn ValueA script inheriting from the given script and implementing assertions. DiscussionThis handler is used to create a script that inherits
from makeFixtureCreates an unregistered fixture inheriting from TestCase. on makeFixture() DiscussionA user test case inherits from the user fixture, which inherit from TestCase. Test cases are automatically registered while compiling a script, using two simple rules:
To create a fixture inheriting from a user defined TestCase, create a script inheriting from TestCase, then create the concrete fixture script inheriting from your custom TestCase script: script |user defined TestCase| property parent: makeFixture() -- define your custom handlers here end script |concrete fixture| property parent: registerFixtureOfKind(me, |user defined TestCase|) -- define your test cases here end makeTestCaseCreates an unregistered TestCase inheriting from the current fixture. on makeTestCase() DiscussionYou can run the test case or add it manually to a suite. This feature is essential for ASUnit own unit tests. makeTestLoaderLoads tests from files and folders, and returns a suite with all tests. on makeTestLoader() makeTestResultBuilds and returns a TestResult object. on makeTestResult( aName) Embedded ClassesmakeTestSuiteCreates a test suite. on makeTestSuite( aName) Embedded ClassesDiscussionEach test script should define a suite property to support automatic registration of test cases. If a suite is not defined, tests will have to be registered with a suite manually. You may define your own suite class, inheriting from TestSuite. Each test script should define a suite property and initialize it with makeTestSuite(), or with a TestSuite subclass. registerFixtureConvenience handler for registering fixture inheriting from TestCase. on registerFixture( aUserFixture) registerFixtureOfKindPrimitive registration handler. on registerFixtureOfKind( aUserFixture, aParent) DiscussionMay be used to register a fixture inheriting from a TestCase subclass. registerTestCaseCreates a test case and registers it with the main script suite. on registerTestCase( aUserTestCase) DiscussionThis test will run automatically when you run the suite. TestSetA more user-friendly name for registerFixture(). on TestSet( aUserFixture) UnitTestA more user-friendly name for registerTestCase(). on UnitTest( aUserTestCase) Globals
_currentFixture[script] Saves the current fixture while compiling test cases in a fixture. property _currentFixture : missing value id[text] ASUnit's id. property id : "com.lifepillar.ASUnit" name[text] ASUnit's name. property name : "ASUnit" suiteUsed to automatically collect tests in a script file. property suite : ASUnitSentinel DiscussionIf a test script defines its own suite property, this property will be shadowed. TEST_FAILEDError number signalling a failed test. property TEST_FAILED : 1000 TEST_SKIPPEDError number signalling a skipped test. property TEST_SKIPPED : 1001 TEST_SUCCEEDED_BUT_SHOULD_HAVE_FAILEDError number used inside failIf(). property TEST_SUCCEEDED_BUT_SHOULD_HAVE_FAILED : 1002 TOP_LEVELA property that refers to the top-level script. property TOP_LEVEL : me version[text] ASUnit's version. property version : "1.2.4" |