ABLunit - How to perform test for multiple records with fail

Posted by DenDuze on 27-Oct-2016 08:51

Hi,
I think that the following is the flow of a test procedure/class.
start --> @Before-method is run
for every @test-method first the @Setup-method is runned, then the @test-method and then the @Teardown-method
after all @test-methods the @After-method is runned.

This is fine but in my case I want to look all records from a parameter-table and for every record I want to run the @test-method. When this @test-method fails I still want that this @test-method is runned fot the next record from that table.
This way i want to see how many records of that parameter-table fail on this test.

The problem is that I can not get that to work
The first time the @test fails the whole test-procedure stops!
Can someone give me a hint how to accomplish this flow?

I try something like this:
BLOCK-LEVEL ON ERROR UNDO, THROW.
USING OpenEdge.Core.Assert FROM PROPATH.

class CheckIt:
    define variable cValue as character no-undo.    
        
    @Setup.
    method public void setup():
        mloopRecords().
    end method.
    
    method public void loopRecords():
      for each parameter no-lock:
        assign cValue = parameter.cparameter.  
        mFirstTestMethod(  ).
      end.
    end method.
    
    @Test.
    method public void mFirstTestMethod(  ):
                
        define variable cValueNew as character no-undo.
        run checkParameterNewValue.p(cValue, outputcValueNew).
         assert:notequal(length("maxLength", length(cValueNew).
    end method.
end class.

All Replies

This thread is closed