[Gambas-user] Integrate unittest component to Gambas
Benoît Minisini
g4mba5 at gmail.com
Sun Apr 22 00:26:30 CEST 2018
Le 22/04/2018 à 00:02, Christof Thalhofer a écrit :
> 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 ... ?
No, because "-s" is a standard option of the interpreter. Your component
will never see the arguments put before the executable name.
At the moment this output is only for the IDE GUI, so use one only. If
later we need another one, we will find a solution.
>> 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.
I will do it.
>
>> 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.
I don't get your sentence. Logically tests have the same dependencies as
the project itself, except the gb.unittest component.
As for the test classes, it's not a problem, as the interpreter only
loads a class if it is run.
So it's just the useless load of gb.unittest component that disturbs me,
even if it is a problem just for normal project (components or libraries
loading their dependencies only when they are run as a normal project).
>
> Btw. Merging ATestContainer and UnitTest was quite easy, static
> UnitTest.Run() also. Thank you for the advice!
Multiplying the number of classes is usually a Java way of life. I
prefer being more simpler, thinking about the user of the component. :-)
>
> Next thingi is serializing and separating. So please wait a bit.
>
> Alles Gute
>
> Christof Thalhofer
>
I'd like to release gambas 3.11 now for two months, but each time
someone (sometimes it's me) finds an annoying bug I have to fix!
I can wait a week or two, and if you are not in a hurry, the component
can be put in the next version. The component has not to be perfect, but
its public interface must be stabilized, so that you have only bugs to fix.
Regards,
--
Benoît Minisini
More information about the User
mailing list