Programmatically running tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Programmatically running tests

Bernat Romagosa
Hi list,

How does one run a test and gather the results programmatically?

I'm trying the ways I know from GST but it looks a bit different, for instance you can't do: 

(MyTestCase selector: #mySelectorForATest) run.

Cheers!

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically running tests

Bernat Romagosa
And on the same topic... what do tests in red indicate in the test runner? I noticed I can't debug methods that show up red, but I can debug the ones in black.

2011/10/10 Bernat Romagosa <[hidden email]>
Hi list,

How does one run a test and gather the results programmatically?

I'm trying the ways I know from GST but it looks a bit different, for instance you can't do: 

(MyTestCase selector: #mySelectorForATest) run.

Cheers!

--
Bernat Romagosa.



--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically running tests

Nicolas Petton
On Mon, 2011-10-10 at 17:14 +0200, Bernat Romagosa wrote:
> And on the same topic... what do tests in red indicate in the test
> runner? I noticed I can't debug methods that show up red, but I can
> debug the ones in black.

In black? I thought it was:
green -> passed
yellow -> failed
red -> error

Nico

>
> 2011/10/10 Bernat Romagosa <[hidden email]>
>         Hi list,
>        
>        
>         How does one run a test and gather the results
>         programmatically?
>        
>        
>         I'm trying the ways I know from GST but it looks a bit
>         different, for instance you can't do:
>        
>        
>         (MyTestCase selector: #mySelectorForATest) run.
>        
>        
>         Cheers!
>        
>        
>         --
>         Bernat Romagosa.
>        
>
>
>
>
> --
> Bernat Romagosa.


Reply | Threaded
Open this post in threaded view
|

Re: Programmatically running tests

Nicolas Petton
In reply to this post by Bernat Romagosa
On Mon, 2011-10-10 at 16:49 +0200, Bernat Romagosa wrote:
> Hi list,
>
>
> How does one run a test and gather the results programmatically?

No idea :) I'll have a look.

Nico

>
>
> I'm trying the ways I know from GST but it looks a bit different, for
> instance you can't do:
>
>
> (MyTestCase selector: #mySelectorForATest) run.
>
>
> Cheers!
>
>
> --
> Bernat Romagosa.
>


Reply | Threaded
Open this post in threaded view
|

Re: Programmatically running tests

Bernat Romagosa
That was weird, now I see them red and I can inspect the results. I guess I messed something up yesterday... :P

2011/10/11 Nicolas Petton <[hidden email]>
On Mon, 2011-10-10 at 16:49 +0200, Bernat Romagosa wrote:
> Hi list,
>
>
> How does one run a test and gather the results programmatically?

No idea :) I'll have a look.

Nico
>
>
> I'm trying the ways I know from GST but it looks a bit different, for
> instance you can't do:
>
>
> (MyTestCase selector: #mySelectorForATest) run.
>
>
> Cheers!
>
>
> --
> Bernat Romagosa.
>





--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically running tests

Stefan Krecher
In reply to this post by Bernat Romagosa
Hi Bernat,

Am Montag, 10. Oktober 2011 16:49:00 UTC+2 schrieb Bernat Romagosa:
How does one run a test and gather the results programmatically?

an interesting question in this context would be - how would an test-suite be executed from a CI Tool like Jenkins or Cruise Control?
There are so much interesting new features in html5, so it could be a new architectural approach to implement the business-logic in the browser.
Besides other points like Transactions, Exception-Handling, Session-Handling, architectural approach (MVC vs. MVP vs. PAC vs ...) etc. CI/ Testing is an important thing for enterprise applications.

regards,
Stefan
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically running tests

Bernat Romagosa
So, I've been taking a better look at it, and it seems this does the trick:

result := TestResult new.
StringTest buildSuite do: [:each | each runCaseFor: result].
result inspect

You can ask result for #runs, #failures and #errors, which is exactly what I needed :)

At first I was looking at the SUnit package and I couldn't figure out how it worked, but then I checked the TestRunner widget as gokr suggested, and it all became clear.

Cheers,

2011/10/11 Stefan Krecher <[hidden email]>
Hi Bernat,

Am Montag, 10. Oktober 2011 16:49:00 UTC+2 schrieb Bernat Romagosa:
How does one run a test and gather the results programmatically?

an interesting question in this context would be - how would an test-suite be executed from a CI Tool like Jenkins or Cruise Control?
There are so much interesting new features in html5, so it could be a new architectural approach to implement the business-logic in the browser.
Besides other points like Transactions, Exception-Handling, Session-Handling, architectural approach (MVC vs. MVP vs. PAC vs ...) etc. CI/ Testing is an important thing for enterprise applications.

regards,
Stefan



--
Bernat Romagosa.