1 Reply Latest reply on Nov 10, 2009 6:54 AM by Daniel Rinehart

    Testing multiple implementations of an interface

    peterjoel

      I'm refactoring some unit tests. We have several implementions of an interface with very similar tests, and I'd like to refactor into one TestCase and have it run once for each implementation. I can't find any information on the best approach to do this with FlexUnit. Any ideas?

       

      We're using FlexUnit 0.9 / Flex 3.

       

       

      Peter

        • 1. Re: Testing multiple implementations of an interface
          Daniel Rinehart Level 1

          With FlexUint 0.9, If I'm understanding your scenario correctly, you

          could introduce a subclass of TestCase that includes the common tests.

          Each existing implementation specific TestCase would extend this new

          class and do the setup of the implementation specific classes. This is

          some rough pseudo code of the approach:

           

          class InteferfaceTestCase extends TestCase { var interface:Interface;

          function testMethoA(); function testMethodB(); }

           

          class ImplementationATest extends InteferfaceTestCase  { function

          setUp() { interface = new implA(); } }

           

          class ImplementationBTest extends InteferfaceTestCase  { function

          setUp() { interface = new implB(); } }

           

          -- Daniel R. <danielr@neophi.com> http://danielr.neophi.com/