[Gambas-user] Integrate unittest component to Gambas

Christof Thalhofer chrisml at deganius.de
Sun Apr 22 00:02:48 CEST 2018


Am 21.04.2018 um 22:56 schrieb Benoît Minisini:
>> You mean sth like JSON? Ok, there would have to be coded methods like:
>>
>> TestResult.ToJson
>> and
>> TestResult.FromJson
>>
>> to ex- and import Testresults.
> 
> Not necessarily. I just mean that running the test from the command line:
> 
> $ gbr3 -s UnitTest myproject.gambas
> 
> will run the static UnitTest.Main() method, that should run all the unit 
> tests located in the project, and print the result to the standard output.
> 
> This result does not have to use a standard format, just a format that 
> is easy to parse to implement the GUI in the IDE.

All neccessary is in TestSuite/TestResult (I have to figure out), and
the GUI as well as console output use it, so serializing this would be
the way to go, I think.

gbr3 -s UnitTest myproject.gambas

could produce readable output (and a parseable "success"), but sth like

gbr3 -s UnitTest -j myproject.gambas

could produce JSON ... ?

> But if you know a standard format for unit test results, you can use it 
> of course.

I did not find any. I think JSON is the easiest.

> As for exporting the unittest classes, this is not necessary.

I had to do it to recognize them anyhow, I remember I experimented a lot
on that for about one day. Also playing around with a file that
contained names of testclasses. But I did not like that.

> As soon as you are inside a project, you can browse the ".gambas" 
> directory to get the name of each class of the project (in uppercase) 
> and the Class.Stat() method of the gb.util component to get information 
> about a class (its name and its parent class).

Ah ok, I never was "in the project" as the interpreter sees it ...

> I could even add a method in the gb.util component to return the list of 
> all classes.

This would be a solution, I imagine.

> And to go further, there is still a problem: a normal project having 
> unit tests will always load the gb.unittest component even when running 
> no test. There is no way to prevent that at the moment, but if you 
> succeed in merging the ATestContainer and UnitTest, and separating the 
> GUI from the component, I will see what I can do.

Even libraries with unittests infect projects using them. This was the
thing why I called it state alpha. It has to be supported by the
interpreter to work really good inside one project and without affecting
other projects.

Btw. Merging ATestContainer and UnitTest was quite easy, static
UnitTest.Run() also. Thank you for the advice!

Next thingi is serializing and separating. So please wait a bit.

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/20180422/29d7da8c/attachment-0001.sig>


More information about the User mailing list