Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 31224
  • Category: Java
  • Founded: Nov 6, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 23502 - 23531 of 24405   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#23502 From: sslavic@...
Date: Fri Jul 1, 2011 9:27 am
Subject: Re: @Rule TestName not available in @Before methods...
sslavic
Send Email Send Email
 
This still doesn't seem to be supported (see
https://github.com/KentBeck/junit/issues/229 ). Maybe solution would be to
introduce @BeforeRule and have them executed before @Before.

Regards,
Stevo.

--- In junit@yahoogroups.com, "kentb" <kentb@...> wrote:
>
> This is the second report I've seen today that wished that @Rules were
> executed before @Before. I know we had a good reason for the ordering we
> used. I'll have to see if I can remember what it was. If it makes more sense
> to push rules earlier, we will.
>
> Kent
>
>   _____
>
> From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of
> Barry Kaplan
> Sent: Friday, August 28, 2009 5:08 PM
> To: junit@yahoogroups.com
> Subject: [junit] @Rule TestName not available in @Before methods...
>
>
>
>
>
> This is a shame, the framework indeed knows the test method for which
> @Before
> is executing.
>
> I haven't looked at the new rules impl yet, does anybody know if its even
> possible that TestName could be initialized before @Before methods?
> --
> View this message in context: http://www.nabble.
> <http://www.nabble.com/%40Rule-TestName-not-available-in-%40Before-methods..
> .-tp25198691p25198691.html>
> com/%40Rule-TestName-not-available-in-%40Before-methods...-tp25198691p251986
> 91.html
> Sent from the JUnit - User mailing list archive at Nabble.com.
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

#23503 From: David Saff <david@...>
Date: Fri Jul 1, 2011 5:00 pm
Subject: Re: Re: @Rule TestName not available in @Before methods...
dsaff
Send Email Send Email
 
Stevo,

Barry's original use case benefited from refactoring to a @Rule.  Do
you have a different use case in which this isn't the right thing to
do?

    David Saff

On Fri, Jul 1, 2011 at 5:27 AM,  <sslavic@...> wrote:
> This still doesn't seem to be supported (see
https://github.com/KentBeck/junit/issues/229 ). Maybe solution would be to
introduce @BeforeRule and have them executed before @Before.
>
> Regards,
> Stevo.
>
> --- In junit@yahoogroups.com, "kentb" <kentb@...> wrote:
>>
>> This is the second report I've seen today that wished that @Rules were
>> executed before @Before. I know we had a good reason for the ordering we
>> used. I'll have to see if I can remember what it was. If it makes more sense
>> to push rules earlier, we will.
>>
>> Kent
>>
>>   _____
>>
>> From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of
>> Barry Kaplan
>> Sent: Friday, August 28, 2009 5:08 PM
>> To: junit@yahoogroups.com
>> Subject: [junit] @Rule TestName not available in @Before methods...
>>
>>
>>
>>
>>
>> This is a shame, the framework indeed knows the test method for which
>> @Before
>> is executing.
>>
>> I haven't looked at the new rules impl yet, does anybody know if its even
>> possible that TestName could be initialized before @Before methods?
>> --
>> View this message in context: http://www.nabble.
>> <http://www.nabble.com/%40Rule-TestName-not-available-in-%40Before-methods..
>> .-tp25198691p25198691.html>
>> com/%40Rule-TestName-not-available-in-%40Before-methods...-tp25198691p251986
>> 91.html
>> Sent from the JUnit - User mailing list archive at Nabble.com.
>>
>>
>>
>>
>>
>>
>> [Non-text portions of this message have been removed]
>>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23504 From: Andres Olarte <olarte.andres@...>
Date: Fri Jul 1, 2011 5:20 pm
Subject: Running the same test in different scenarios
olarte.andres@...
Send Email Send Email
 
Hey all,

I have a set of JUnit tests, that test the basic functionality of my
services layer.  They're all coded against the interfaces, not the
actual implementations.  Right now I have two different
implementations.  I want to run the same set of tests against both
implementations (in two different runs).  My question is how to
arrange the test results so that reporting is useful?  I'm using
Jenkins to run the tests and display the reports.

Any idea would be appreciated,

Thanks

Andres

#23505 From: bill.shannon@...
Date: Fri Jul 1, 2011 6:11 pm
Subject: Re:
bs00011
Send Email Send Email
 
[This is a recording.]

I'm on vacation July 1 - July 10.
I'll be reading mail occasionally.

	 Bill

#23506 From: David Saff <david@...>
Date: Tue Jul 5, 2011 5:13 pm
Subject: Re: Running the same test in different scenarios
dsaff
Send Email Send Email
 
Andres,

This sounds like a job for http://c2.com/cgi/wiki?AbstractTestCases,
or "contract tests".  There's a couple patterns for implementing
this--are you using JUnit 3 or 4?

    David Saff

On Fri, Jul 1, 2011 at 1:20 PM, Andres Olarte <olarte.andres@...> wrote:
> Hey all,
>
> I have a set of JUnit tests, that test the basic functionality of my
> services layer.  They're all coded against the interfaces, not the
> actual implementations.  Right now I have two different
> implementations.  I want to run the same set of tests against both
> implementations (in two different runs).  My question is how to
> arrange the test results so that reporting is useful?  I'm using
> Jenkins to run the tests and display the reports.
>
> Any idea would be appreciated,
>
> Thanks
>
> Andres
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23507 From: Andres Olarte <olarte.andres@...>
Date: Wed Jul 6, 2011 6:59 pm
Subject: Re: Running the same test in different scenarios
olarte.andres@...
Send Email Send Email
 
David,

I'm using junit 4 with annotations. Would those patterns work? I looked
briefly over the page you posted and will work. I was hoping to not have
extra classes per each implementation, but I can deal with that. I'll try
that tonight.

Thanks
On Jul 5, 2011 1:44 PM, "David Saff" <david@...> wrote:
> Andres,
>
> This sounds like a job for http://c2.com/cgi/wiki?AbstractTestCases,
> or "contract tests". There's a couple patterns for implementing
> this--are you using JUnit 3 or 4?
>
> David Saff
>
> On Fri, Jul 1, 2011 at 1:20 PM, Andres Olarte <olarte.andres@...>
wrote:
>> Hey all,
>>
>> I have a set of JUnit tests, that test the basic functionality of my
>> services layer.  They're all coded against the interfaces, not the
>> actual implementations.  Right now I have two different
>> implementations.  I want to run the same set of tests against both
>> implementations (in two different runs).  My question is how to
>> arrange the test results so that reporting is useful?  I'm using
>> Jenkins to run the tests and display the reports.
>>
>> Any idea would be appreciated,
>>
>> Thanks
>>
>> Andres
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>>


[Non-text portions of this message have been removed]

#23508 From: David Saff <david@...>
Date: Wed Jul 6, 2011 9:57 pm
Subject: JUnit 4.9b3 (finally) (beta-)released
dsaff
Send Email Send Email
 
Five months and a dozen regression errors later, JUnit 4.9b3 is now
ready for your testing pleasure. This release's theme is Test-class
and suite level Rules.  For details and links, please see:

http://saffgreenbar.blogspot.com/2011/07/junit-49b3-beta-released.html

Thanks to everyone for the feedback and patches.  If no further
regressions are found in the next week, this release will go final.

    David Saff

#23509 From: Bill Venners <bill@...>
Date: Wed Jul 6, 2011 10:52 pm
Subject: Re: JUnit 4.9b3 (finally) (beta-)released
billvenners
Send Email Send Email
 
Hi David,

Can you elaborate on how MultipleFailuresException going public will help
extension writers? I'm curious what the use cases were for this.

Thanks.

Bill

On Wed, Jul 6, 2011 at 2:57 PM, David Saff <david@...> wrote:

> **
>
>
> Five months and a dozen regression errors later, JUnit 4.9b3 is now
> ready for your testing pleasure. This release's theme is Test-class
> and suite level Rules. For details and links, please see:
>
> http://saffgreenbar.blogspot.com/2011/07/junit-49b3-beta-released.html
>
> Thanks to everyone for the feedback and patches. If no further
> regressions are found in the next week, this release will go final.
>
> David Saff
>
>



--
Bill Venners
Artima, Inc.
http://www.artima.com


[Non-text portions of this message have been removed]

#23510 From: "Mihir Jhala" <mihir_933@...>
Date: Fri Jul 8, 2011 12:41 am
Subject: Junit Testcase help
mihirjhala
Send Email Send Email
 
Hello Group,

Can any body give me rough code to test a method
which returns list of objects.Actually it is a DAO method.
class Dao
{
public list A

{

List data=select * from tab1;
return data;

}

#23511 From: Colin Vipurs <zodiaczx6@...>
Date: Fri Jul 8, 2011 1:56 pm
Subject: Re: Junit Testcase help
zodiac_zx6
Send Email Send Email
 
It might help to give us more information about what it is you're actually
trying to test.  Do you want to ensure the list has the correct entries in
it?  What code have you got so far?

On Fri, Jul 8, 2011 at 1:41 AM, Mihir Jhala <mihir_933@...> wrote:

> **
>
>
> Hello Group,
>
> Can any body give me rough code to test a method
> which returns list of objects.Actually it is a DAO method.
> class Dao
> {
> public list A
>
> {
>
> List data=select * from tab1;
> return data;
>
> }
>
>
>



--
Maybe she awoke to see the roommate's boyfriend swinging from the chandelier
wearing a boar's head.

Something which you, I, and everyone else would call "Tuesday", of course.


[Non-text portions of this message have been removed]

#23512 From: Musa YUVACI <musa.yuvaci@...>
Date: Fri Jul 8, 2011 8:00 am
Subject: Re: Junit Testcase help
musa.yuvaci
Send Email Send Email
 
First of all, you want to test this DAO class, you MUST KNOW RETURN DATA
(For this you can use dbunit,hsqldb...).

And... your test class can be like this


public class DaoTest {

Dao dao = new Dao();

@Test
public void testAMethod() {

List aList = dao.getList();

Assert.assertEquals(1,alList.size());  //compare list size
}

}


PS: When you know return data , you can compare your list contents


2011/7/8 Mihir Jhala <mihir_933@...>

> **
>
>
> Hello Group,
>
> Can any body give me rough code to test a method
> which returns list of objects.Actually it is a DAO method.
> class Dao
> {
> public list A
>
> {
>
> List data=select * from tab1;
> return data;
>
> }
>
>
>



--
*Musa YUVACI*
*Yazýlým Geliþtirme Uzmaný / Bilgisayar Mühendisi*
*Software Specialist / Computer Engineer*
*
musa.yuvaci@...
*
*
www.musayuvaci.com
*


[Non-text portions of this message have been removed]

#23513 From: bill.shannon@...
Date: Sat Jul 9, 2011 1:14 am
Subject: Re:
bs00011
Send Email Send Email
 
[This is a recording.]

I'm on vacation July 1 - July 10.
I'll be reading mail occasionally.

	 Bill

#23514 From: Gabriele Kahlout <gabriele@...>
Date: Sat Jul 9, 2011 10:02 am
Subject: Why testMethod() should be void?
gabriele.kah...
Send Email Send Email
 
Hello,

I'm not sure I understand why this line code is needed in
org.junit.runners.model.FrameworkMethod.validatePublicVoid(..).

if (fMethod.getReturnType() != Void.TYPE)
             errors.add(new Exception("Method " + fMethod.getName() + "()
should be void"));

--
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧
time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x)
∧ y ∈
L(-[a-z]+[0-9]X)).


[Non-text portions of this message have been removed]

#23515 From: "Mihir Jhala" <mihir_933@...>
Date: Sun Jul 10, 2011 9:02 pm
Subject: Re: Junit Testcase help
mihirjhala
Send Email Send Email
 
Thanks all for help.

But my next doubt is how about if return data has many rows which I don't know
how many.So how can I test these kind of methods.

--- In junit@yahoogroups.com, Musa YUVACI <musa.yuvaci@...> wrote:
>
> First of all, you want to test this DAO class, you MUST KNOW RETURN DATA
> (For this you can use dbunit,hsqldb...).
>
> And... your test class can be like this
>
>
> public class DaoTest {
>
> Dao dao = new Dao();
>
> @Test
> public void testAMethod() {
>
> List aList = dao.getList();
>
> Assert.assertEquals(1,alList.size());  //compare list size
> }
>
> }
>
>
> PS: When you know return data , you can compare your list contents
>
>
> 2011/7/8 Mihir Jhala <mihir_933@...>
>
> > **
> >
> >
> > Hello Group,
> >
> > Can any body give me rough code to test a method
> > which returns list of objects.Actually it is a DAO method.
> > class Dao
> > {
> > public list A
> >
> > {
> >
> > List data=select * from tab1;
> > return data;
> >
> > }
> >
> >
> >
>
>
>
> --
> *Musa YUVACI*
> *Yazýlým Geliþtirme Uzmaný / Bilgisayar Mühendisi*
> *Software Specialist / Computer Engineer*
> *
> musa.yuvaci@...
> *
> *
> www.musayuvaci.com
> *
>
>
> [Non-text portions of this message have been removed]
>

#23516 From: Musa YUVACI <musa.yuvaci@...>
Date: Mon Jul 11, 2011 7:46 am
Subject: Re: Re: Junit Testcase help
musa.yuvaci
Send Email Send Email
 
Hi,

When you need to test this kind of dao class,  you create test area. You can
do this way (It is my advice, you can do that another different way) ,


1) Using hsqldb for database (http://hsqldb.org/)
2) Put some data in your database (you can use for that dbunit-
http://www.dbunit.org/). So now , you know your list size or elements
  because you add them.
3) Finally you can test your dao. Because now you know your data

You can reach informations about putting data to db before test. Shortly ,
you create a xml (dataset) file for your data and it is added to db by
dbunit.

http://www.oreillynet.com/onjava/blog/2005/10/dbunit_made_easy.html
http://www.dbunit.org/components.html

PS: I am not a native speaker, so that sorry for my english.









2011/7/11 Mihir Jhala <mihir_933@...>

> **
>
>
>
> Thanks all for help.
>
> But my next doubt is how about if return data has many rows which I don't
> know how many.So how can I test these kind of methods.
>
>
> --- In junit@yahoogroups.com, Musa YUVACI <musa.yuvaci@...> wrote:
> >
> > First of all, you want to test this DAO class, you MUST KNOW RETURN DATA
> > (For this you can use dbunit,hsqldb...).
> >
> > And... your test class can be like this
> >
> >
> > public class DaoTest {
> >
> > Dao dao = new Dao();
> >
> > @Test
> > public void testAMethod() {
> >
> > List aList = dao.getList();
> >
> > Assert.assertEquals(1,alList.size()); //compare list size
> > }
> >
> > }
> >
> >
> > PS: When you know return data , you can compare your list contents
> >
> >
> > 2011/7/8 Mihir Jhala <mihir_933@...>
> >
> > > **
>
> > >
> > >
> > > Hello Group,
> > >
> > > Can any body give me rough code to test a method
> > > which returns list of objects.Actually it is a DAO method.
> > > class Dao
> > > {
> > > public list A
> > >
> > > {
> > >
> > > List data=select * from tab1;
> > > return data;
> > >
> > > }
> > >
> > >
> > >
> >
> >
> >
> > --
> > *Musa YUVACI*
> > *Yazýlým Geliþtirme Uzmaný / Bilgisayar Mühendisi*
> > *Software Specialist / Computer Engineer*
> > *
> > musa.yuvaci@...
> > *
> > *
> > www.musayuvaci.com
>
> > *
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>



--
*Musa YUVACI*
*Yazılım Geliştirme Uzmanı / Bilgisayar Mühendisi*
*Software Specialist / Computer Engineer*
*
musa.yuvaci@...
*
*
www.musayuvaci.com
*


[Non-text portions of this message have been removed]

#23517 From: David Saff <david@...>
Date: Wed Jul 13, 2011 6:26 pm
Subject: Re: Why testMethod() should be void?
dsaff
Send Email Send Email
 
Gabriele,

It's mostly as a guide for users.  JUnit doesn't do anything with the
return value (for example, if you saw a test method returning boolean,
you might reasonably assume that the method could fail by returning
"false").  The added return line would in most cases be noise.

While there have been proposals for allowing a return type, and doing
something with it, none have yet reached the levels of general
usefulness and obvious syntax that would merit a change.

    David Saff

On Sat, Jul 9, 2011 at 6:02 AM, Gabriele Kahlout
<gabriele@...> wrote:
> Hello,
>
> I'm not sure I understand why this line code is needed in
> org.junit.runners.model.FrameworkMethod.validatePublicVoid(..).
>
> if (fMethod.getReturnType() != Void.TYPE)
>            errors.add(new Exception("Method " + fMethod.getName() + "()
> should be void"));
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the
> receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this)
∧ time(x)
> < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email
> does not contain a valid code then the email is not received. A valid code
> starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈
subject(x) ∧ y ∈
> L(-[a-z]+[0-9]X)).
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23518 From: "jens_schauder" <jens.schauder@...>
Date: Thu Jul 14, 2011 10:46 am
Subject: Re: Junit Testcase help
jens_schauder
Send Email Send Email
 
These articles might be helpful as well:

http://blog.schauderhaft.de/2011/03/13/testing-databases-with-junit-and-hibernat\
e-part-1-one-to-rule-them/

http://blog.schauderhaft.de/2011/03/20/testing-databases-with-junit-and-hibernat\
e-part-2-the-mother-of-all-things/

http://blog.schauderhaft.de/2011/03/27/testing-databases-with-junit-and-hibernat\
e-part-3-cleaning-up-and-further-ideas/

They do use hibernate, but the principles still apply independently of your way
to interface with the database

kind regards
Jens


> Hello Group,
>
> Can any body give me rough code to test a method
> which returns list of objects.Actually it is a DAO method.
> class Dao
> {
> public list A
>
> {
>
> List data=select * from tab1;
> return data;
>
> }

#23519 From: David Saff <david@...>
Date: Thu Jul 14, 2011 2:55 pm
Subject: Re: JUnit 4.9b3 (finally) (beta-)released
dsaff
Send Email Send Email
 
[+kcooney@...]

Someone (I believe kcooney) wanted to write a Runner that needed to
internally re-implement some of EachTestNotifier, but couldn't re-use
all of it.  Kevin, can you recall the specific example?

    David Saff



On Wed, Jul 6, 2011 at 6:52 PM, Bill Venners <bill@...> wrote:
> Hi David,
>
> Can you elaborate on how MultipleFailuresException going public will help
> extension writers? I'm curious what the use cases were for this.
>
> Thanks.
>
> Bill
>
> On Wed, Jul 6, 2011 at 2:57 PM, David Saff <david@...> wrote:
>
>> **
>>
>>
>> Five months and a dozen regression errors later, JUnit 4.9b3 is now
>> ready for your testing pleasure. This release's theme is Test-class
>> and suite level Rules. For details and links, please see:
>>
>> http://saffgreenbar.blogspot.com/2011/07/junit-49b3-beta-released.html
>>
>> Thanks to everyone for the feedback and patches. If no further
>> regressions are found in the next week, this release will go final.
>>
>> David Saff
>>
>>
>
>
>
> --
> Bill Venners
> Artima, Inc.
> http://www.artima.com
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23520 From: David Saff <david@...>
Date: Thu Jul 14, 2011 2:56 pm
Subject: Re: Running the same test in different scenarios
dsaff
Send Email Send Email
 
Andres,

Sorry for the slow reply.  The patterns from that page should work.
Did you give it a try?  Thanks,

    David

On Wed, Jul 6, 2011 at 2:59 PM, Andres Olarte <olarte.andres@...> wrote:
> David,
>
> I'm using junit 4 with annotations. Would those patterns work? I looked
> briefly over the page you posted and will work. I was hoping to not have
> extra classes per each implementation, but I can deal with that. I'll try
> that tonight.
>
> Thanks
> On Jul 5, 2011 1:44 PM, "David Saff" <david@...> wrote:
>> Andres,
>>
>> This sounds like a job for http://c2.com/cgi/wiki?AbstractTestCases,
>> or "contract tests". There's a couple patterns for implementing
>> this--are you using JUnit 3 or 4?
>>
>> David Saff
>>
>> On Fri, Jul 1, 2011 at 1:20 PM, Andres Olarte <olarte.andres@...>
> wrote:
>>> Hey all,
>>>
>>> I have a set of JUnit tests, that test the basic functionality of my
>>> services layer.  They're all coded against the interfaces, not the
>>> actual implementations.  Right now I have two different
>>> implementations.  I want to run the same set of tests against both
>>> implementations (in two different runs).  My question is how to
>>> arrange the test results so that reporting is useful?  I'm using
>>> Jenkins to run the tests and display the reports.
>>>
>>> Any idea would be appreciated,
>>>
>>> Thanks
>>>
>>> Andres
>>>
>>>
>>> ------------------------------------
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23521 From: "mdotrogers" <m--@...>
Date: Thu Jul 14, 2011 8:17 pm
Subject: NoSuchMethodError: java.lang.String.isEmpty()
mdotrogers
Send Email Send Email
 
Hi,

I'm using JUnit 4.9b2 for a cross-platform project that needs to run on OS X
10.4, where the highest available version of Java is 1.5. When running JUnit
tests with ant's junit task, I get the following error when a test fails:

[junit] Exception in thread "main" java.lang.NoSuchMethodError:
java.lang.String.isEmpty()Z

String.isEmpty() was added in Java 1.6, so I guess I need to find an older
version of JUnit that doesn't call that method. Can anyone tell me the newest
version of JUnit that's compatible with Java 1.5?

Thanks,
Michael

#23522 From: Andres Olarte <olarte.andres@...>
Date: Fri Jul 15, 2011 4:01 am
Subject: Re: Running the same test in different scenarios
olarte.andres@...
Send Email Send Email
 
David,

Yes,  I tried and it worked perfectly.  Thanks a lot.

On Thu, Jul 14, 2011 at 10:56 AM, David Saff <david@...> wrote:

> **
>
>
> Andres,
>
> Sorry for the slow reply. The patterns from that page should work.
> Did you give it a try? Thanks,
>
> David
>
>
> On Wed, Jul 6, 2011 at 2:59 PM, Andres Olarte <olarte.andres@...>
> wrote:
> > David,
> >
> > I'm using junit 4 with annotations. Would those patterns work? I looked
> > briefly over the page you posted and will work. I was hoping to not have
> > extra classes per each implementation, but I can deal with that. I'll try
> > that tonight.
> >
> > Thanks
> > On Jul 5, 2011 1:44 PM, "David Saff" <david@...> wrote:
> >> Andres,
> >>
> >> This sounds like a job for http://c2.com/cgi/wiki?AbstractTestCases,
> >> or "contract tests". There's a couple patterns for implementing
> >> this--are you using JUnit 3 or 4?
> >>
> >> David Saff
> >>
> >> On Fri, Jul 1, 2011 at 1:20 PM, Andres Olarte <olarte.andres@...>
> > wrote:
> >>> Hey all,
> >>>
> >>> I have a set of JUnit tests, that test the basic functionality of my
> >>> services layer.  They're all coded against the interfaces, not the
> >>> actual implementations.  Right now I have two different
> >>> implementations.  I want to run the same set of tests against both
> >>> implementations (in two different runs).  My question is how to
> >>> arrange the test results so that reporting is useful?  I'm using
> >>> Jenkins to run the tests and display the reports.
> >>>
> >>> Any idea would be appreciated,
> >>>
> >>> Thanks
> >>>
> >>> Andres
> >>>
> >>>
> >>> ------------------------------------
> >>>
> >>> Yahoo! Groups Links
> >>>
> >>>
> >>>
> >>>
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
>
>


[Non-text portions of this message have been removed]

#23523 From: "J. B. Rainsberger" <jbrains762@...>
Date: Fri Jul 15, 2011 11:38 am
Subject: Re: Running the same test in different scenarios
nails762
Send Email Send Email
 
On Wed, Jul 6, 2011 at 3:59 PM, Andres Olarte <olarte.andres@...>wrote:

> **
>
> I'm using junit 4 with annotations. Would those patterns work? I looked
> briefly over the page you posted and will work. I was hoping to not have
> extra classes per each implementation, but I can deal with that. I'll try
> that tonight.
>
An interesting proposition, though, and something for the JUnit 4 crowd to
consider:

Contract Tests generally give rise to a group of abstract creation methods
responsible for initialising the object under test into a particular state.
We write one test subclass per implementation primarily to implement these
abstract creation methods, effectively Factory methods, for each
implementation.

Could we do this in JUnit without n compile type classes? Would we prefer
it?
--
J. B. (Joe) Rainsberger :: http://www.jbrains.ca ::
http://www.thecodewhisperer.com
Your guide to software craftsmanship
JUnit Recipes: Practical Methods for Programmer Testing
2005 Gordon Pask Award for contribution Agile Software Practice


[Non-text portions of this message have been removed]

#23524 From: Gabriele Kahlout <gabriele@...>
Date: Fri Jul 15, 2011 2:44 pm
Subject: Re: Why testMethod() should be void?
gabriele.kah...
Send Email Send Email
 
aha..it seemed to me that the reason was 'political/artificial'. By waiting
it to 'reach the levels of general
usefulness and obvious syntax' I think we are just sacrificing power users
productivity/value in favor of  beginners - a classic struggle for interface
designers.

I'm strongly in favor of removing this limitation. I often  refactor
functionality of tests in other helper methods, but sometimes all I really
need (at that stage) is return some value created in a smaller test. Instead
of wrapping it verbatim in a helper method, i'd just return it from the
test.

Thank you for the answer.

On Wed, Jul 13, 2011 at 8:26 PM, David Saff <david@...> wrote:

> **
>
>
> Gabriele,
>
> It's mostly as a guide for users. JUnit doesn't do anything with the
> return value (for example, if you saw a test method returning boolean,
> you might reasonably assume that the method could fail by returning
> "false"). The added return line would in most cases be noise.
>
> While there have been proposals for allowing a return type, and doing
> something with it, none have yet reached the levels of general
> usefulness and obvious syntax that would merit a change.
>
> David Saff
>
>
> On Sat, Jul 9, 2011 at 6:02 AM, Gabriele Kahlout
> <gabriele@...> wrote:
> > Hello,
> >
> > I'm not sure I understand why this line code is needed in
> > org.junit.runners.model.FrameworkMethod.validatePublicVoid(..).
> >
> > if (fMethod.getReturnType() != Void.TYPE)
> >            errors.add(new Exception("Method " + fMethod.getName() + "()
> > should be void"));
> >
> > --
> > Regards,
> > K. Gabriele
> >
> > --- unchanged since 20/9/10 ---
> > P.S. If the subject contains "[LON]" or the addressee acknowledges the
> > receipt within 48 hours then I don't resend the email.
> > subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this)
∧
> time(x)
> > < Now + 48h) ⇒ ¬resend(I, this).
> >
> > If an email is sent by a sender that is not a trusted contact or the
> email
> > does not contain a valid code then the email is not received. A valid
> code
> > starts with a hyphen and ends with "X".
> > ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈
subject(x) ∧ y ∈
> > L(-[a-z]+[0-9]X)).
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
>
>



--
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧
time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x)
∧ y ∈
L(-[a-z]+[0-9]X)).


[Non-text portions of this message have been removed]

#23525 From: Michael Rogers <m--@...>
Date: Fri Jul 15, 2011 7:44 am
Subject: Re: NoSuchMethodError: java.lang.String.isEmpty()
mdotrogers
Send Email Send Email
 
Sorry for the noise - I see this was reported and fixed in 4.9b3, which
works fine with Java 1.5.

Thanks!
Michael

On 14/07/11 21:17, mdotrogers wrote:
> Hi,
>
> I'm using JUnit 4.9b2 for a cross-platform project that needs to run on OS X
10.4, where the highest available version of Java is 1.5. When running JUnit
tests with ant's junit task, I get the following error when a test fails:
>
> [junit] Exception in thread "main" java.lang.NoSuchMethodError:
java.lang.String.isEmpty()Z
>
> String.isEmpty() was added in Java 1.6, so I guess I need to find an older
version of JUnit that doesn't call that method. Can anyone tell me the newest
version of JUnit that's compatible with Java 1.5?
>
> Thanks,
> Michael
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#23526 From: David Saff <david@...>
Date: Fri Jul 15, 2011 3:48 pm
Subject: Re: NoSuchMethodError: java.lang.String.isEmpty()
dsaff
Send Email Send Email
 
Michael,

Glad the new beta works for you.  Thanks,

    David

On Fri, Jul 15, 2011 at 2:44 AM, Michael Rogers <m--@...> wrote:
> Sorry for the noise - I see this was reported and fixed in 4.9b3, which
> works fine with Java 1.5.
>
> Thanks!
> Michael
>
> On 14/07/11 21:17, mdotrogers wrote:
>> Hi,
>>
>> I'm using JUnit 4.9b2 for a cross-platform project that needs to run on OS X
10.4, where the highest available version of Java is 1.5. When running JUnit
tests with ant's junit task, I get the following error when a test fails:
>>
>> [junit] Exception in thread "main" java.lang.NoSuchMethodError:
java.lang.String.isEmpty()Z
>>
>> String.isEmpty() was added in Java 1.6, so I guess I need to find an older
version of JUnit that doesn't call that method. Can anyone tell me the newest
version of JUnit that's compatible with Java 1.5?
>>
>> Thanks,
>> Michael
>>
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23527 From: David Saff <david@...>
Date: Fri Jul 15, 2011 5:55 pm
Subject: Re: Why testMethod() should be void?
dsaff
Send Email Send Email
 
Note that power users have a fairly easy out: you can create your own
subclass of BlockJUnit4ClassRunner (KahloutRunner, say), which
overrides validateTestMethods with the logic you want, and then opt-in
to this logic by annotating your classes with
@RunWith(KahloutRunner.class).  If you find yourself using this a lot,
please consider contributing it to junit.contrib, so others can use
it.

    David Saff

On Fri, Jul 15, 2011 at 9:44 AM, Gabriele Kahlout
<gabriele@...> wrote:
> aha..it seemed to me that the reason was 'political/artificial'. By waiting
> it to 'reach the levels of general
> usefulness and obvious syntax' I think we are just sacrificing power users
> productivity/value in favor of  beginners - a classic struggle for interface
> designers.
>
> I'm strongly in favor of removing this limitation. I often  refactor
> functionality of tests in other helper methods, but sometimes all I really
> need (at that stage) is return some value created in a smaller test. Instead
> of wrapping it verbatim in a helper method, i'd just return it from the
> test.
>
> Thank you for the answer.
>
> On Wed, Jul 13, 2011 at 8:26 PM, David Saff <david@...> wrote:
>
>> **
>>
>>
>> Gabriele,
>>
>> It's mostly as a guide for users. JUnit doesn't do anything with the
>> return value (for example, if you saw a test method returning boolean,
>> you might reasonably assume that the method could fail by returning
>> "false"). The added return line would in most cases be noise.
>>
>> While there have been proposals for allowing a return type, and doing
>> something with it, none have yet reached the levels of general
>> usefulness and obvious syntax that would merit a change.
>>
>> David Saff
>>
>>
>> On Sat, Jul 9, 2011 at 6:02 AM, Gabriele Kahlout
>> <gabriele@...> wrote:
>> > Hello,
>> >
>> > I'm not sure I understand why this line code is needed in
>> > org.junit.runners.model.FrameworkMethod.validatePublicVoid(..).
>> >
>> > if (fMethod.getReturnType() != Void.TYPE)
>> >            errors.add(new Exception("Method " + fMethod.getName() +
"()
>> > should be void"));
>> >
>> > --
>> > Regards,
>> > K. Gabriele
>> >
>> > --- unchanged since 20/9/10 ---
>> > P.S. If the subject contains "[LON]" or the addressee acknowledges the
>> > receipt within 48 hours then I don't resend the email.
>> > subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x,
this) ∧
>> time(x)
>> > < Now + 48h) ⇒ ¬resend(I, this).
>> >
>> > If an email is sent by a sender that is not a trusted contact or the
>> email
>> > does not contain a valid code then the email is not received. A valid
>> code
>> > starts with a hyphen and ends with "X".
>> > ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈
subject(x) ∧ y ∈
>> > L(-[a-z]+[0-9]X)).
>> >
>> >
>> > [Non-text portions of this message have been removed]
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the
> receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this)
∧ time(x)
> < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email
> does not contain a valid code then the email is not received. A valid code
> starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈
subject(x) ∧ y ∈
> L(-[a-z]+[0-9]X)).
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23528 From: David Saff <david@...>
Date: Fri Jul 15, 2011 9:28 pm
Subject: Re: Running the same test in different scenarios
dsaff
Send Email Send Email
 
So, you can use Paramterized or Theories in many cases.  Neither maps
precisely onto every way that people often want to carry out this idea
of "the same test in different scenarios", which is, in one way or
another, a popular request.  I'd like to find a way to expose a hook
that would make it easier for people to fine-tune what to do in these
scenarios.

    David Saff

On Fri, Jul 15, 2011 at 6:38 AM, J. B. Rainsberger <jbrains762@...> wrote:
> On Wed, Jul 6, 2011 at 3:59 PM, Andres Olarte <olarte.andres@...>wrote:
>
>> **
>>
>> I'm using junit 4 with annotations. Would those patterns work? I looked
>> briefly over the page you posted and will work. I was hoping to not have
>> extra classes per each implementation, but I can deal with that. I'll try
>> that tonight.
>>
> An interesting proposition, though, and something for the JUnit 4 crowd to
> consider:
>
> Contract Tests generally give rise to a group of abstract creation methods
> responsible for initialising the object under test into a particular state.
> We write one test subclass per implementation primarily to implement these
> abstract creation methods, effectively Factory methods, for each
> implementation.
>
> Could we do this in JUnit without n compile type classes? Would we prefer
> it?
> --
> J. B. (Joe) Rainsberger :: http://www.jbrains.ca ::
> http://www.thecodewhisperer.com
> Your guide to software craftsmanship
> JUnit Recipes: Practical Methods for Programmer Testing
> 2005 Gordon Pask Award for contribution Agile Software Practice
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23529 From: "jcortez8080" <jmc0092@...>
Date: Sat Jul 16, 2011 5:30 am
Subject: Doubles Vs Floats Test
jcortez8080
Send Email Send Email
 
Hello,

I recently created and submitted a working patch for JUnit having to do with
Assert.assertArrayEquals(float[],float[],delta) throwing exceptions with doubles
instead of floats. It turns out that the floats were being casted to doubles, so
I modified the code so that the floats remained as floats. At the request of
David Saff, I attempted to write a test that would cause either the previous
implementation that printed out thrown exceptions with doubles, or my new
implementation that does the same with floats instead, to fail. So far, I have
only been able to write tests with wide varieties of input that cause both
implementations to fail, but not just one, just because of the messy nature of
floats and doubles. I have run out of ideas of input to use (two float arrays to
be compared against each other and a maximum delta when comparing the floats in
the two arrays) that would cause only one implementation to fail. Any ideas?

Regards,
Juan

#23530 From: Kevin Cooney <kcooney@...>
Date: Mon Jul 18, 2011 6:37 pm
Subject: Re: JUnit 4.9b3 (finally) (beta-)released
kevincooney2000
Send Email Send Email
 
Here are the related changes:

https://github.com/KentBeck/junit/commits/b22184577c3e73ae802c1c1246c72c3dcc5f4e\
d2/src/main/java/org/junit/runners/model/MultipleFailureException.java
https://github.com/KentBeck/junit/commit/bed58a573c373d57d64fa369f58b2a8f0dbee3d\
7#src/main/java/org/junit/runners/ParentRunner.java

Prior to these changes, custom runners could not support
MultipleFailureException (or ErrorCollector, which throws
MultipleFailureException) without using internal classes (EachTestNotifier
is an internal class). In addition, you could not easily test code that
threw MultipleFailureException without depending on internal classes.

-- Kevin


On Thu, Jul 14, 2011 at 7:55 AM, David Saff <david@...> wrote:

> [+kcooney@...]
>
> Someone (I believe kcooney) wanted to write a Runner that needed to
> internally re-implement some of EachTestNotifier, but couldn't re-use
> all of it.  Kevin, can you recall the specific example?
>
>   David Saff
>
>
>
> On Wed, Jul 6, 2011 at 6:52 PM, Bill Venners <bill@...> wrote:
> > Hi David,
> >
> > Can you elaborate on how MultipleFailuresException going public will help
> > extension writers? I'm curious what the use cases were for this.
> >
> > Thanks.
> >
> > Bill
> >
> > On Wed, Jul 6, 2011 at 2:57 PM, David Saff <david@...> wrote:
> >
> >> **
> >>
> >>
> >> Five months and a dozen regression errors later, JUnit 4.9b3 is now
> >> ready for your testing pleasure. This release's theme is Test-class
> >> and suite level Rules. For details and links, please see:
> >>
> >> http://saffgreenbar.blogspot.com/2011/07/junit-49b3-beta-released.html
> >>
> >> Thanks to everyone for the feedback and patches. If no further
> >> regressions are found in the next week, this release will go final.
> >>
> >> David Saff
> >>
> >>
> >
> >
> >
> > --
> > Bill Venners
> > Artima, Inc.
> > http://www.artima.com
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>


[Non-text portions of this message have been removed]

#23531 From: Björn Gustafsson <bjorng+TDD@...>
Date: Tue Jul 19, 2011 2:00 am
Subject: Re: Doubles Vs Floats Test
bjorn_ga
Send Email Send Email
 
Hi Juan,

Where can we find your patch?  Do you have a test that exhibits the
original exception bug that you describe below?

On Sat, Jul 16, 2011 at 1:30 AM, jcortez8080 <jmc0092@...> wrote:
> Hello,
>
> I recently created and submitted a working patch for JUnit having to do with
Assert.assertArrayEquals(float[],float[],delta) throwing exceptions with doubles
instead of floats. It turns out that the floats were being casted to doubles, so
I modified the code so that the floats remained as floats. At the request of
David Saff, I attempted to write a test that would cause either the previous
implementation that printed out thrown exceptions with doubles, or my new
implementation that does the same with floats instead, to fail. So far, I have
only been able to write tests with wide varieties of input that cause both
implementations to fail, but not just one, just because of the messy nature of
floats and doubles. I have run out of ideas of input to use (two float arrays to
be compared against each other and a maximum delta when comparing the floats in
the two arrays) that would cause only one implementation to fail. Any ideas?
>
> Regards,
> Juan

--
Björn Gustafsson

Messages 23502 - 23531 of 24405   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help