Put Small Fixture In With Suite

last modified: February 16, 2005

When using VBUnit sometimes its a bit awkward creating suites that only run one fixture, or your suite takes a while to run and you only want to run one fixture, PutSmallFixtureInWithSuite --

If you add this class to your templates folder you can create a new test with just one file.

Start SmallTest.cls ---

Option Explicit

Implements ISuite
Implements IFixture

Private m_assert As IAssert

'Implement IFixtureFrame if you need to do complex initialization once for all tests
'Don't do anything expensive in Class_Initialize or Class_Terminate!
'Implements IFixtureFrame

Private Function ISuite_Suite() As ITest

  Dim suite As New TestSuite
  suite.SuiteName = TypeName(Me)

  suite.AddFixture Me

  Set ISuite_Suite = suite
End Function

'Setup and TearDown will be called before and after each test method
Private Sub IFixture_Setup(assert As IAssert)
  Set m_assert = assert
  m_assert.EnablePrintMsg
  m_assert.SetSeverity vbUnit_Assertion, vbunit_Suite
End Sub

Private Sub IFixture_TearDown()
End Sub

Public Sub TestPlusWorks()
  m_assert.LongsEqual 6, 2+3, "Check Addition works"       
End Sub

End SmallTest.cls ---


CategoryTesting


Loading...