Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Implementing IF_CONSTRAINT Test-Driven

$
0
0

Dear Fellow ABAPers,

 

currently I am writing a custom ABAP Unit Assertion for comparing two structures for partial equality.

The path of choice is implementing the interface IF_CONSTRAINT, and using the resulting class (comparable to a Hamcrest matcher) in combination with the standard assertion method CL_ABAP_UNIT_ASSERT=>ASSERT_THAT.

 

I am doing this test-driven, so at this stage I am testing my IF_CONSTRAINT~IS_VALID implementation with two structures with different values and assert the result to be false in my test method.

 

However, as I am using a CL_ABAP_UNIT_ASSERT=>ASSERT_EQUALS inside my IS_VALID method for the actual value comparison (to easily get the nice Expected/Actual messages in the ABAP Unit result), that intentionally failing ASSERT_EQUALS gets tracked in the test result and makes the actually passing test fail for the ABAP Unit runner (setting the assert level to TOLERABLE just makes the result yellow, not green).

 

Is there a possibility to make the unit runner ignore the used ASSERT_EQUALS, by calling some test framework methods in the test method?

 

I want to avoid having to duplicate the code in ASSERT_EQUALS just for the sake of a green test.

 

Best regards,

Frank.


Viewing all articles
Browse latest Browse all 8332

Trending Articles