ABLUnit: How to create test suite to perform interface test on multiple classes - Forum - OpenEdge Development - Progress Community

ABLUnit: How to create test suite to perform interface test on multiple classes


ABLUnit: How to create test suite to perform interface test on multiple classes

This question is not answered

I have multiple classes implementing the same interface

I have created a class (TestIPropertyCollection) containing multiple tests, coded against the interface

How can I create  a test suite to run the same test class for different implementations of the interface.

@TestSuite options are not documented on https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/pdsoe%2Fannotations-supported-with-ablunit.html%23

I'd like to do something like

    File        : be.cce.ccetools.base.IPropertyCollectionTests
    Syntax      : 
    Author(s)   : cvb
    Created     : Thu Jul 26 14:27:43 CEST 2018
    Notes       : 

using Progress.Lang.*.
block-level on error undo, throw.
@TestSuite(classes="be.cce.ccetools.base.TestIPropertyCollection", classtotest="TempTablePropertyCollection").
@TestSuite(classes="be.cce.ccetools.base.TestIPropertyCollection", classtotest="JsonPropertyCollection").

class be.cce.ccetools.base.IPropertyCollectionTests: 

end class.
All Replies
  • You need separate tests, one for each code path that you create.  Remember, you're not testing the interface...it doesn't do anything. You're testing the implementation to ensure it behaves according to requirements.

  •  thank you for the reply

    I do not want to test the interface, but I want to test the behaviour of classes implementing the interface .

    Use case : I want to make sure that 2 classes (black boxes) implementing the same interface are interchangeable

    We have a IPropertyCollection interface currently implemented by a TempTablePropertyCollection class.

    Before I replace TempTablePropertyCollection by a different implementation JsonPropertyCollection I want to make sure that the behaviour is the same by subjecting both classes to the same tests.

  • You can have one method/class that contains all test logic and takes the interface as input, and then test cases that call that method, passing in the different implementations. If both pass, then both work.

    METHOD PRIVATE VOID InterfaceTest (INPUT poProperty AS IPropertyCollection):
        BLAH BLAH.


    METHOD PUBLIC VOID TempTableTest ():
        THIS-OBJECT:InterfaceTest(NEW TempTablePropertyCollection()).

        THIS-OBJECT:InterfaceTest(NEW JsonPropertyCollection()).