[Gambas-devel] Suggestion : Gambas Unit Testing

Julio Sanchez jusabejusabe at ...176...
Wed Dec 24 15:19:32 CET 2014


Hi, I have added the code Adrien, a  form to display the results of the test
and  I created 3  component  (according gb.qt4 is used, gb.gtk or gb.gui),
to install in Ide gambas3

Here you have the article and a video of how to use (in Spanish):

http://jsbsan.blogspot.com.es/2014/12/pruebas-unitarias-en-gambas3-gambas.html


Merry Christmas!!!

Regards

Julio

2014-12-10 23:20 GMT+01:00 Adrien Prokopowicz <adrien.prokopowicz at ...176...>
:

> Le Wed, 10 Dec 2014 10:52:22 +0100, Benoît Minisini
> <gambas at ...1...> a écrit:
>
> > Le 10/12/2014 10:35, Adrien Prokopowicz a écrit :
> >
> >> Because calling this method would run the test, but not update the
> >> UnitTest's internal state variables, nor catch the (potential) errors
> >> correctly. You should use the public Start() method for that.
> >
> > It's not a valid argument for me. If the user has to write the method,
> > it must have a normal public name.
>
> I agree. That's why I was suggesting the protected accessibility.
>
> > Moreover, running the UnitTest will start the static public Main()
> > method, so the Start() method should be named Main(), or called by
> > Main().
>
> I don't understand, what 'static public Main()' are you talking about ?
> There is no such method in UnitTest : the test is never ran directly,
> it's the _UnitTestLauncher that creates a task for each UnitTest, which
> then runs the test.
>
> Actually, the Start() method should not even be exported, as the user
> never starts a test from application code (only the launcher does that).
>
> I will have to change the UnitTest class quite a bit, so that internal
> methods stay away from user-accessible methods (like Start).
>
> >> I thought about using a text file only for importing/exporting test
> >> results,
> >> because I would like the IDE's report to be updated in (almost)
> >> real-time.
> >> For example, if only 30 of the 100 tests are done, it would be nice to
> >> show
> >> them already, rather than just having a waiting cursor.
> >
> > Nice, but what for? If you run a test, you won't modify the project at
> > the same time...
>
> Just for user comfort. Personally, I find it very frustrating when an
> application just tells you "please wait" when you could already see part
> of the results. But maybe it's just me.
>
> > But the unittest must be runnable from the command line, so its output
> > should be text printed on the standard output. So we can imagine that
> > they are run in the background by the IDE, and that the output will be
> > catched and transformed in a nice result table. And then you gain your
> > "real-time" feature.
>
> Unit tests are already runnable from command line (the command is just
> ugly at the moment), the following works on any project for which
> the gb.unit component is enabled :
>
>    [adrien at ...707... gb.unit]$ gbx3 ./ -s "_UnitTestLauncher"
>    ----- Test AssertionsTests (#0) succeeded -----
>    ----- Test MyBadUnitTest (#1) failed -----
>           Reason: Assertion failed.
>           Stack trace :
>                   MyBadUnitTest._Run.8
>    ----- Test MyGoodUnitTest (#2) succeeded -----
>    ----- Test MyVeryBadUnitTest (#3) failed -----
>           MyVeryBadUnitTest failed due to an unexpected error.
>           Reason: Division by zero
>           Stack trace :
>                   MyVeryBadUnitTest._Run.8
>    4 tests finished. 2 sucessful tests, 2 failed tests.
>    [adrien at ...707... gb.unit]$
>
> I plan to add another flag to this command that would transform the
> output into something more convenient to parse for the IDE.
>
> Regards,
>
> --
> Adrien Prokopowicz
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20141224/c1cbbc56/attachment.html>


More information about the Devel mailing list