[Gambas-user] New component gb.test

Christof Thalhofer chrisml at deganius.de
Sun May 20 18:19:26 CEST 2018


Am 20.05.2018 um 13:40 schrieb Tobias Boege:

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

Sorry, I have spelled wrong. Second ought to be "testfunction2".

> To be a bit more specific, I imagine the following base class:
> 
>   ' Test.class
>   Static Public Sub Main()
>     For Each Me.Fixtures
>       Me.Test()
>     Next
>   End

But this also made sense, if a test should run under different
environments. But I think this all would make is only too complicated.

Now as I play around with your code I think you are right with this:

> Remember that you can even outsource and share
> code between your test modules, since they are just classes inside the
> same project.

If inside a testmodule I can create public methods (that contain
fixtures as well as asserts) that are executed via Main() I can have
nearly the same functionality since before.

Like so:
-----------------------------------------------------------------
Public Sub Main()
	Test1()
	Test()
End

Public Sub Test1()
	Assert.Equals("Bing", "Bong", "Intentionally not equal")
End
-----------------------------------------------------------------

Now I can easily use TestSth.Test1() while coding.

The only thing I really do not like at all is your Assert.Setup(Integer)

A programmer should not have to count with fingers.

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/204fa246/attachment.sig>


More information about the User mailing list