[Gambas-user] Test Module, First try

Brian G brian at westwoodsvcs.com
Sun Jul 19 10:31:41 CEST 2020


I see your point about the text strings, I added the german and french translations after I wrote  the tests, oh well once more into the frey....
I understand it should bail if a test disappears, It would be nice if it told you how to fix the issue when you really do want to delete a test. 
Like I had to hunt around, experiment to find a way to fix it. The default had to be reset.  By opening iand closing the test suite.

--
Thanks
Brian Sunday, 19 July 2020, 00:52AM -07:00 from Christof Thalhofer  chrisml at deganius.de :

>Am 19.07.20 um 00:58 schrieb Brian G:
>
> I attach the final...hopefully acceptable style wise version!
>
>On my machine some tests fail, I attach the TAP output. It is because
>tests search for language agnostic strings which is not a really good idea:
>
> # ------------- Expected -------------
> # gbs3: Dim i as integer:Print i:inc i.0: Unknown component: gb.inotifyt
> #
> # ---------------- Got ---------------
> # gbs3: Dim i as integer:Print i:inc i.0: Unbekannte Komponente: gb.inotifyt
> # ------------------------------------
>
>Also you do not test for the existence of the bad component but instead
>for a string message. Apart from the language problem your test will
>fail if someone decides to change the message later, for instance
>'Unknown component' to 'Component not found', which is not what you want!
>
>I did not inspect all of your tests but please ask yourself:
>
>"Do I really test the state of my program that I want to test? Or do I
>test something other which is influenced by the state that I really want
>to test."
>
>In the latter case you cannot rely on your tests!
>
> When I delete a test module, the default or any other test suite does
> not recalculate itself, It will crash BailOut , because the test is
> missing, It is required to use shift-F4 to enter the default plan 
> then exit it. This corrects the issue.
>
> Is it possible to fix this so that it is automatic and it detects
> that a test is missing and give opportunity to fix or bail?
>
> Its not intuitive from the message what needs to be done to fix the
> issue.
>
>IMO this is not a bug. The test system has to bail out if a test is
>called which does not exist. It says to you that sth is wrong and you
>have to fix it. This is the real job the test system has to do.
>
>One thing I saw in the TAP output I personally would avoid:
>
> Test TbCommandLinePrograms:ExecuteACommandLineProgram
> # Application Output
> # We say Hello World
> # 0
> # 1
> # 2
> # 
> ok 1 - Check the output from the Executed command line script
> 1..1
> ok 2 - TbCommandLinePrograms:ExecuteACommandLineProgram
>
>These notes are nice if you are debugging your program as well as the
>test code. But if it is done and the test reports 'ok', get rid of it:
>
> Test TbCommandLinePrograms:ExecuteACommandLineProgram
> ok 1 - Check the output from the Executed command line script
> 1..1
> ok 2 - TbCommandLinePrograms:ExecuteACommandLineProgram
>
>Sometimes you want to read the TAP output (if you are looking for
>failures) and then you will be focused on searching notes beginning with
>"# " which will tell you what failed.
>
>Then notes which tell sth obvious will annoy you:
>
> Test TbCommandLinePrograms:Precompile
> # Testing PreCompile
> ok 1 - Test precompile short forms I
> ok 2 - Test precompile short forms F
>
>Have a nice sunday! :-)
>
>Alles Gute
>
>Christof Thalhofer
>
>-- 
>Dies ist keine Signatur
>
>----[  http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200719/9a95e7fb/attachment.html>


More information about the User mailing list