[Gambas-user] New component gb.test

Christof Thalhofer chrisml at deganius.de
Sun May 20 12:16:44 CEST 2018


Hello Tobi,

Am 19.05.2018 um 02:44 schrieb Tobias Boege:

> I am probably starting with the documentation, as I have noticed that
> the TAP architecture is quite different from the one inspired by JUnit.

As I now analyze the functionality in TestHarness.Run I see, that it
executes one test-module at all by doing:

Exec ["gbx3", "-s", Test, Project] To sOutput

Then in sOutput there is:

"1..10
ok 1 - True is ok
ok 2 - False is not ok
ok 3 - Multiplication
ok 4 - Gambas is sufficiently fast
ok 5 - Float absolute error
not ok 6 - Float relative error # SKIP Intentionally wrong
ok 7 - Float relative error
ok 8 - CStr returns a String
ok 9 - LIKE email address
ok 10 - MATCH email address
ok 11 - not MATCH email address"

So far so good. Everything seems to be fine.

But I have a couple of problems with this approach compared to the one
inspired from JUnit.

1st:
--------------------------------------------------------------------

In the original code there was the concept of "fixtures" implemented
which is now gone.

Please look at https://github.com/Deganius/gb.deg.unittest/ and scroll
down to "Test fixture"

A fixture is the possibility of creation and (after the test was run)
deletion of a special environment. A fixture could be created for each
single test or for a bunch of tests enclosed in a single module.

For example like so:
----------------------------------
create fixture (create environment)
    run testfunction 1
    run testfunction 2
    ...
end fixture (destroy environment)
----------------------------------

Or so:
----------------------------------
create fixture (create environment)
    run testfunction1
end fixture (destroy environment)
create fixture (create environment)
    run testfunction1
end fixture (destroy environment)
...
----------------------------------

Or both combined.

As your code now executes a module at all without looking at the content
these possibilities are gone.

This functionality (analyzing the testmodule and creating so called
testcases out of the methods contained) was done in Unittest.class,
executing them was done in TestSuite.Run() together with TestCase.Run()

2nd:
--------------------------------------------------------------------

If I want a test function do intentionally throw a Gambas error, it
seems to me that this is now impossible, because the Gambas error would
stop further processing. Am I right?

In the original code this functionality together with the one above was
done in TestResult.AssertError

--------------------------------------------------------------------

Im am quite unsure how this functionality could be restored with this
current approach:

Exec ["gbx3", "-s", Test, Project] To sOutput

which I find very interesting as a segfault could be detected and would
not destroy the process running the tests.

Any ideas?


Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180520/e2c6e3e4/attachment.sig>


More information about the User mailing list