-
-
Save dskaggs/757bb41915fdb7e5ef1b to your computer and use it in GitHub Desktop.
BDD Test Suite Question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="testbox.system.BaseSpec"{ | |
/*********************************** LIFE CYCLE Methods ***********************************/ | |
// executes before all suites+specs in the run() method | |
function beforeAll(){ | |
variables.theObject = new path.to.Object( argumentCollection=arguments ); | |
} | |
// executes after all suites+specs in the run() method | |
function afterAll(){ | |
structDelete( variables, 'theObject' ); | |
} | |
/*********************************** BDD SUITES ***********************************/ | |
function run(){ | |
// test suite for init() method | |
describe( 'The init() function ...', function(){ | |
// before each spec in this suite group | |
beforeEach( function(){ | |
}); | |
// after each spec in this suite group | |
afterEach( function(){ | |
}); | |
it( '... returns a reference to itself', function(){ | |
expect( theObject ).toBeInstanceOf( 'path.to.Object' ); | |
}); | |
}); | |
//test suite for the method1() method | |
describe( 'The method1() function...', function(){ | |
// before each spec in this suite group | |
beforeEach( function(){ | |
result = theObject.method1( argumentCollection={}); | |
}); | |
// after each spec in this suite group | |
afterEach( function(){ | |
}); | |
it( '... returns a structure of values', function( result ){ | |
expect( result ).toBeStruct(); | |
}); | |
it( '... returns no errors', function( result ){ | |
expect( result.errors ).notToBeStruct(); | |
}); | |
it( '... returns a sucessful status', function( result ){ | |
expect( result.status ).toBe( 1 ); | |
}); | |
}); | |
//test suite for the method2() method | |
describe( 'The method2() function...', function(){ | |
// before each spec in this suite group | |
beforeEach( function(){ | |
result = theObject.method2( argumentCollection={}); | |
}); | |
// after each spec in this suite group | |
afterEach( function(){ | |
}); | |
it( '... returns a structure of values', function( result ){ | |
expect( isStruct( result ) ).toBeTrue(); | |
}); | |
it( '... returns no errors', function( result ){ | |
expect( result.errors ).notToBeStruct(); | |
}); | |
it( '... returns a sucessful status', function( result ){ | |
expect( result.status ).toBe( 1 ); | |
}); | |
it( '... returns an array of stuff', function( result ){ | |
expect( structKeyExists( result, "stuff" ) AND isArray( result.stuff ) AND arrayLen( result.stuff ) ).toBeTrue(); | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment