AJARProject/AJ_Tools_UnitTest

adding an AJ_Assert command

tiranbe opened this issue · 4 comments

We have been using the Unit Testing Component for over a month now and we find it very useful. However, we have some old unit-tests that were written using the ASSERT command. We found out that it's so much easier to have an equivalent AJ_Assert to replace one ASSERT with 1 AJ_ASSERT. So that we can quickly convert our old methods.

ASSERT($success=True;"Expected true for success") // Old way
AJ_ASSERT($test;$success;True;$given;"Expected true for success") // New Way

We find it much easier to convert our old unit-tests to the new AJAR compliant one using this helper method.
The code for AJ_ASSERT is something simple like this:

$test:=$1
$test.expected:=$2
$test.actual:=$3
$test.given:=$4
$test.should:=$5
$test.assert()

Feedback: The listbox display view is convenient for quickly scrolling through the tests. However, It would be great to be able to see the failed rows in a different background color.
image

Hi Tiran,

Thanks for the proposition.

I'm not sure if I want to integrate such wrapper method directly in the component.

Why?

Because I don't want to have too much dependencies and calls to any component method. This will make the builded application dependent on the Unit Test component. We don't want to deploy application with the Unit Test component to the final client.

That is why I prefer that you create this wrapper method by yourself in your database that will not have any dependency on the component itself. As you said it is very simple code to write.

As I remember you do not compile the application for you client, so you may not see the issue with that. People who build the application will have to create the wrapper manually anyway.

I prefer to give suck method as a "good practice to replace existing ASSERT method" rather than exposing an internal component one.

For the other proposition, I will implement it and build a new version of the component. I must come in few minutes :)

The latest release contain this change. Let me know if this work on your side