JUnit-Tests

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

JUnit-Tests

Stefan Krecher
Hi,
i did some tests and a test-helper (2 classes) - because i'm very new to git and still unsure about how it works, here is the url of the commit (just two new files, no changes etc.):
https://github.com/StefanKrecher/redline-smalltalk/commit/59d91eee52491730f9cfcc4dcb441d7266992ae5

I rewrote Rolands tests for Integer.st, but i did it without any mocks, so it is easier to understand and adapt.
There is a testProtoObject() that checks if all Methods are present and some tests that checks if the methods do the right calculations.
With my helper-class you can write asserts like that:

assertIntegerEquals(3, send(one, "+", two));

or

assertTrue(isSmalltalkTrue(send(one, "<", two)));

If you find it usefull i could enhance the helper-class and write tests for other Smalltalk-classes. By working this way we wouldn't need an SUnit-like frame work now - we could focus on implementing all Smalltalk-Kernel-classes an then port SUnit later.
To assist on the way to a full Smalltalk-library we could work test-driven - what do you think?

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

Re: JUnit-Tests

SeanTAllen
On 09/15/2011 07:42 AM, Stefan Krecher wrote:

> Hi,
> i did some tests and a test-helper (2 classes) - because i'm very new
> to git and still unsure about how it works, here is the url of the
> commit (just two new files, no changes etc.):
> https://github.com/StefanKrecher/redline-smalltalk/commit/59d91eee52491730f9cfcc4dcb441d7266992ae5
>
> I rewrote Rolands tests for Integer.st, but i did it without any
> mocks, so it is easier to understand and adapt.
> There is a testProtoObject() that checks if all Methods are present
> and some tests that checks if the methods do the right calculations.
> With my helper-class you can write asserts like that:
>
> assertIntegerEquals(3, send(one, "+", two));
>
> or
>
> assertTrue(isSmalltalkTrue(send(one, "<", two)));
>
> If you find it usefull i could enhance the helper-class and write
> tests for other Smalltalk-classes. By working this way we wouldn't
> need an SUnit-like frame work now - we could focus on implementing all
> Smalltalk-Kernel-classes an then port SUnit later.
> To assist on the way to a full Smalltalk-library we could work
> test-driven - what do you think?
>

I was working on a simple test framework in Smalltalk to use w/ Redline.
Unfortunately despite looking really simple,
Test frameworks actually require a decent amount of plumbing we don't
have yet, so it has been back burnered for a bit.

Until then we are going to use JUnit. So yes, what you expressed is what
the current plan has been even if we didn't vocalise it publicly.


Reply | Threaded
Open this post in threaded view
|

Re: JUnit-Tests

James Ladd
In reply to this post by Stefan Krecher
Hi Stefan,

I commend you and really appreciate you trying to help Redline.

The type of test you have done is an integration test and these should be done in Smalltalk using the
Test framework that Sean is working on.

Unit tests can still be in Java with junit until the framework mentioned above is ready.

This means we wont rewrite the existing junit tests with what you have done.

However - if you get to writing the JSR support and Eclipse plugin I can see your approach for integration
tests being very useful.



On Thu, Sep 15, 2011 at 9:42 PM, Stefan Krecher <[hidden email]> wrote:
Hi,
i did some tests and a test-helper (2 classes) - because i'm very new to git and still unsure about how it works, here is the url of the commit (just two new files, no changes etc.):
https://github.com/StefanKrecher/redline-smalltalk/commit/59d91eee52491730f9cfcc4dcb441d7266992ae5

I rewrote Rolands tests for Integer.st, but i did it without any mocks, so it is easier to understand and adapt.
There is a testProtoObject() that checks if all Methods are present and some tests that checks if the methods do the right calculations.
With my helper-class you can write asserts like that:

assertIntegerEquals(3, send(one, "+", two));

or

assertTrue(isSmalltalkTrue(send(one, "<", two)));

If you find it usefull i could enhance the helper-class and write tests for other Smalltalk-classes. By working this way we wouldn't need an SUnit-like frame work now - we could focus on implementing all Smalltalk-Kernel-classes an then port SUnit later.
To assist on the way to a full Smalltalk-library we could work test-driven - what do you think?

regards,
Stefan

Reply | Threaded
Open this post in threaded view
|

Re: JUnit-Tests

Stefan Krecher-2

Hi,
my test is just a simplification for writing JUnit-Test so you don't need to partial mock ProtoObjects etc.
But i understand that per definition these are integration tests, so they can't be used right now.
Maybe the use of mocks could be simplified - but when we will have a testing-framework in smalltalk - do we need JUnit-Tests at all?
regards,
Stefan
--
sent from my android-phone

Am 15.09.2011 23:55 schrieb "James Ladd" <[hidden email]>:
> Hi Stefan,
>
> I commend you and really appreciate you trying to help Redline.
>
> The type of test you have done is an integration test and these should be
> done in Smalltalk using the
> Test framework that Sean is working on.
>
> Unit tests can still be in Java with junit until the framework mentioned
> above is ready.
>
> This means we wont rewrite the existing junit tests with what you have done.
>
> However - if you get to writing the JSR support and Eclipse plugin I can see
> your approach for integration
> tests being very useful.
>
>
>
> On Thu, Sep 15, 2011 at 9:42 PM, Stefan Krecher <
> [hidden email]> wrote:
>
>> Hi,
>> i did some tests and a test-helper (2 classes) - because i'm very new to
>> git and still unsure about how it works, here is the url of the commit (just
>> two new files, no changes etc.):
>>
>> https://github.com/StefanKrecher/redline-smalltalk/commit/59d91eee52491730f9cfcc4dcb441d7266992ae5
>>
>> I rewrote Rolands tests for Integer.st, but i did it without any mocks, so
>> it is easier to understand and adapt.
>> There is a testProtoObject() that checks if all Methods are present and
>> some tests that checks if the methods do the right calculations.
>> With my helper-class you can write asserts like that:
>>
>> assertIntegerEquals(3, send(one, "+", two));
>>
>> or
>>
>> assertTrue(isSmalltalkTrue(send(one, "<", two)));
>>
>> If you find it usefull i could enhance the helper-class and write tests for
>> other Smalltalk-classes. By working this way we wouldn't need an SUnit-like
>> frame work now - we could focus on implementing all Smalltalk-Kernel-classes
>> an then port SUnit later.
>> To assist on the way to a full Smalltalk-library we could work test-driven
>> - what do you think?
>>
>> regards,
>> Stefan
>>