How to use OpenEdge.Core.Assertion.AssertError?

Posted by Johan Vergeer on 19-Jun-2017 01:15

Hi guys,

I would like to use the HasErrorStatus() method of OpenEdge.Core.Assertion.AssertError library.

At this moment I haven't been able to figure out how to use it and the documentation doesn't really make things much clearer. https://documentation.progress.com/output/oehttpclient/oe117/index.html?OpenEdge.Core.Assertion.package.html

The way I have used it:

@Test.
METHOD PUBLIC VOID testtoString( ):
    // Test if an error is thrown if the lenght is smaller then the precision
    DecimalUtils:toString(10, 6, 5, FALSE, 2).
    AssertError:HasErrorStatus().

    RETURN.

    CATCH CommonError AS Progress.Lang.Error :

    END CATCH.

END METHOD.

What I would expect is that the assertion fails if there is no Error thrown, but that doesn't work. 

I hope someone can help me out here. 

Posted by Phani Sajja on 19-Jun-2017 01:37

Hi,

The API 'AssertError:HasErrorStatus().' can be used to check the presence of an error for lthe last stattement executed.

Below is the sample procedure which tries to connect to a non-existing DB with NO-ERROR.

When you try to run the test case it will result into success.

@Test.

PROCEDURE TestIt:

/*------------------------------------------------------------------------------

Purpose:

Notes:

------------------------------------------------------------------------------*/

   CONNECT "not-existed" NO-ERROR.

   AssertError:HasErrorStatus().

END PROCEDURE.

All Replies

Posted by Phani Sajja on 19-Jun-2017 01:37

Hi,

The API 'AssertError:HasErrorStatus().' can be used to check the presence of an error for lthe last stattement executed.

Below is the sample procedure which tries to connect to a non-existing DB with NO-ERROR.

When you try to run the test case it will result into success.

@Test.

PROCEDURE TestIt:

/*------------------------------------------------------------------------------

Purpose:

Notes:

------------------------------------------------------------------------------*/

   CONNECT "not-existed" NO-ERROR.

   AssertError:HasErrorStatus().

END PROCEDURE.

Posted by Johan Vergeer on 19-Jun-2017 01:56

I forgot all about the NO-ERROR statement.

It works now.

Thanks

This thread is closed