ABL Test unit additional assertions

Posted by jmls on 23-Mar-2014 02:27

We've been using a home-grown test unit framework for a couple of years, and wanted to switch to the official product. However, after perusing the documentation, there are a couple of methods that are "missing" that we find useful.

some of these are:

1) we prefer to have a positive test  (the test is *expected* to have a value different from the supplied value  - for example, count of records should *not* be zero) , so we have a notEquals assertion for each datatype

2) we have a equals/notEquals for logical (consistency with the other equal/notEqual tests)

3) there is a raiseError() event to throw a unit test error if something happens not in a test

4) an assertError / assertNoError test to check the existence of an error (supressed with a NO-ERROR option, like find first customer no-error)

5) assertNull / assertNotNull for each datatype

6) assertFileExists to check the the existence of a file

7) assertValidObject / assertNotValidObject

and, something that is important to us

8) assertDepends("someUnitTest") ; this runs and checks that a particular unit test has run without errors before starting this unit test

Are there any plans on opening the ABLunitTest framework to allow you to plug in your own tests ? This would be helpful.

Or would it be possible to add some of these methods ? 

Would welcome peoples thoughts and comments

All Replies

Posted by Bill Wood on 23-Mar-2014 10:00

Good list....

You asked about 'extensibility'....  but I am wondering what this means..

For example, for a general "assertTrue (message, logicalCondition)" that you could delegate to, then you could  create all of the methods in your object that called this as a variable of assertTrue.

Is that what you are looking for?

Posted by jmls on 23-Mar-2014 13:08

Sorry Bill, not sure what you mean.

Are you talking about having a base assertTrue() that is called by additional methods ?

Or do you mean something like

dotr.UnitTest inherits ABLUnit ?

Posted by Bill Wood on 24-Mar-2014 06:20

I was responding to your question:

Are there any plans on opening the ABLunitTest framework to allow you to plug in your own tests

I was asking if it isn't already open enough, (or what the minimum changes would be to get it to the point that you could plug in your own tests.)

Posted by Phani Sajja on 26-Mar-2014 02:33

Hi,

The core of the assert API is 'OpenEdge.Core.Assert' class

Please see my inline in bold comments.

1) we prefer to have a positive test  (the test is *expected* to have a value different from the supplied value  - for example, count of records should *not* be zero) , so we have a notEquals assertion for each datatype

    Assert API has support for NonZero test for datatypes INTEGER, INT64, etc, can be accessed by Assert:NonZero(...,).

2) we have a equals/notEquals for logical (consistency with the other equal/notEqual tests)

    Assert API has support for Equals test for datatypes INTEGER, INT64, etc, can be accessed by Assert:Equals(...).

    NotEquals API is not available. We will consider providing this API.

3) there is a raiseError() event to throw a unit test error if something happens not in a test

    RaiseError API is not available. We will consider providing this API.

4) an assertError / assertNoError test to check the existence of an error (supressed with a NO-ERROR option, like find first customer no-error)

    AssertError/AssertNoError API is not available. We will consider providing this API.

5) assertNull / assertNotNull for each datatype

    API for Null and non null check is available and can be accessed through Assert:IsNull(...) and Assert:NotNull(...)

6) assertFileExists to check the the existence of a file

    AssertFileExists API is not available. We will consider providing this API.

7) assertValidObject / assertNotValidObject

    AssertValidObject/AssertNotValidObject API is not available. We will consider providing this API.

and, something that is important to us

8) assertDepends("someUnitTest") ; this runs and checks that a particular unit test has run without errors before starting this unit test

    AssertDepends("someUnitTest") API is not available. We will consider providing this API.

Are there any plans on opening the ABLunitTest framework to allow you to plug in your own tests ? This would be helpful.

Or would it be possible to add some of these methods ? 

Would welcome peoples thoughts and comments

    Apart from the above API, framework also provides some more useful APIs for testing extent, positive and negative test of decimal data, object type test etc.

Posted by atuldalvi123 on 31-May-2016 07:33

Can we check these assertion values in IF THEN conditions ?

like IF Assert:equals("M1",returned) EQ 'Success' THEN...

something like this.

This thread is closed