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...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 13007 - 13036 of 24404   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#13007 From: "John L. Webber" <John.Webber@...>
Date: Thu Mar 3, 2005 1:23 pm
Subject: Re: Re: Problems with assertEquals()
John.Webber@...
Send Email Send Email
 
An interesting discussion, and I have sympathy for both points of view.
One practical point- I've occasionally been bitten by writing:

assertNotNull("expected object was null");

and not catching the fact that the object was indeed null since I forgot
to write:

assertNotNull("expected object was null", object);

Anyone else been caught by this trap?

John


J. B. Rainsberger wrote:
>
> I don't doubt they're helpful, but I would have problems being on a
> project and being told, "Thou shalt write failure messages for each
> assertion." I think my productivity would go down 30% and I'd probably
> start looking for other work. It felt liike you wanted to institute such
> a rule on a project. I merely pointed out that perhaps that strategy,
> though safe, is quite less than optimal.

--
---------------------------------------------------------
   Jentro Technologies GmbH
   John L. Webber, Software Development
---------------------------------------------------------

#13008 From: Michael Schuerig <michael@...>
Date: Thu Mar 3, 2005 2:23 pm
Subject: Re: Testing callback event-generating code?
mschuerig
Send Email Send Email
 
On Thursday 03 March 2005 14:09, J. B. Rainsberger wrote:
> Michael Schuerig wrote:
> > I'm looking for a *convenient* way to test code that calls event
> > methods on a callback object. The callback object has an interface
> > similar to that of a SAX ContentHandler, i.e.
> >
> > interface CBH {
> >     void onThis(String s);
> >     void onThat(String s);
> >     String getSomething();
> > }
> >
> > Now, if there were only the first two methods, I'd use a simple
> > mock object that appends each call to a stream; then afterwards the
> > streamed string gets compared to a golden master.
>
> So... at different times you invoke getSomething() and it returns the
> string collected so far, is that it?

No, nothing of that kind. I'm using that interface, essentially a
Builder, in a class for converting tabular data to some other format.
Thus, roughly, I have a class

class RowProcessor {
     void processRow(CBH cbh) {
         // determine what to do
         ...
         String s = cbh.getSomething();
         rememberSomething(s);
         ...
         // then do it
         if (...)
             cbh.onThis("...");
         else
             cbh.onThat("...");
     }
}

Exactly what is done depends not only on the current row, but also on
the history of previous rows. What I'd like to verify is that for a
given sequence of values returned form CBH#getSomething() I get the
correct sequence of calls to onThis() and onThat(). Currently, I'm
doing this with an EasyMock-generated mock for CBH. It's just a bit
more tedious than I like it to be. Maybe I just need a terser way to
record the mock. Seems like a plan.

> That interface is too big.

Is it? Please suggest ways to improve it.

Michael

--
Michael Schuerig                  There is no matrix,
mailto:michael@...        only reality.
http://www.schuerig.de/michael/   --Lawrence Fishburn

#13009 From: Kevin Lawrence <kevin@...>
Date: Thu Mar 3, 2005 6:02 pm
Subject: Some Thoughts on Using Using EasyMock
kevinwilliam...
Send Email Send Email
 
Michael Schuerig wrote:
>
> Unfortunately, I've also got the third method that has to return
> something and there this approach does not work. So far, I've been
> using to EasyMock to prepare a mock callback handler, but it is pretty
> painful to record each and every expected call, even when using some
> procedural abstraction.
>

Related questions :

[I just flicked through all the relevant chapters in JUnit Recipes to
avoid the inevitable :-) ]

I have always written stubs/mocks/fakes by hand but I have wanted to
give EasyMock a try for a while now and did so on a toy project (a robot
for Robocode if you really want to know !)


With EasyMock. I found that all my tests suddenly got more verbose and
more fragile.


On fragility :

Lets say I want to pass an interface into a constructor :

public void testXXX {
    IRobot robot = <from easy mock>
    // setup some expectations

    Radar radar = new Radar(robot);
    // an assertion about the radar
}

I have a whole bunch of tests like this (suitably factored using setup()
and the like).

The problem comes when I later want to do something extra in the radar's
constructor, say robot.getRadarHeading().  Now every test that calls the
constructor will need to change to set the appropriate expectation.



On verbosity :

If I did this manually, I would probably generate a base mock object for
IRobot that has sensible default behavior and then extend it anonymously
for particular tests. If a method does three things, I can write a test
for just one of those things. I find that when I use EasyMock, every
test has to be aware of those three things and hence every test seems to
be about three times bigger than it would otherwise have been.


and one last quibble :

The vast majority of my tests lok like this :

public void testXXX() {
    // some setup
    // an operation
    // some assertions
}

but with easy mock my tests look more like this :

public void testXXX() {
    // some setup mixed in with expectations
    // an operation
    // verify
}

It's often hard to tell the setup from the expectations, which feels
like a loss from an "express intent" point of view.


Does this match other people's experience ? How do YOU deal with them ?
Any suggestions for me ? Am I doing everything completely wrong ? Should
I just suck it up ?


Thanks in advance !


Kevin

#13010 From: Kevin Lawrence <kevin@...>
Date: Thu Mar 3, 2005 6:07 pm
Subject: [OT] Beeping Asserts
kevinwilliam...
Send Email Send Email
 
I have an IBM Thinkpad and if I type *assertEquals() very quickly, it
beeps. It drives me crazy.

Is it just my Thinkpad or have other people experienced this ? Are
Thinkpads JUnit aware ?

Kevin

*actually, it beeps if you type e r t quickly in any windows application.

#13011 From: Kevin Klinemeier <zipwow@...>
Date: Thu Mar 3, 2005 7:44 pm
Subject: Re: [OT] Beeping Asserts
zipwow
Send Email Send Email
 
I have a T42, and haven't seen this behavior at all.


On Thu, 03 Mar 2005 10:07:15 -0800, Kevin Lawrence
<kevin@...> wrote:
>
> I have an IBM Thinkpad and if I type *assertEquals() very quickly, it
> beeps. It drives me crazy.
>
> Is it just my Thinkpad or have other people experienced this ? Are
> Thinkpads JUnit aware ?
>
> Kevin
>
> *actually, it beeps if you type e r t quickly in any windows application.
>
>
> Yahoo! Groups Links
>
>
>
>
>

#13012 From: "Crutcher, John" <john.crutcher@...>
Date: Wed Mar 2, 2005 7:18 pm
Subject: RE: Change the system time for the test
johnc32000
Send Email Send Email
 
Although I have never tried this in Java, I accessed the kernel32.dll to
read the time. That library has a function SetSystemTime to do what you
want.



Java has a class called Runtime that should allow you to use that
library.



Here's a link to MS's SetSystemTime:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo
/base/setsystemtime.asp



Here's how I did it in Basic:



Type SYSTEMTIME

    thisYear As integer

    thisMonth As integer

    thisDayOfWeek As integer

    thisDay As integer

    thisHour As integer

    thisMinute As integer

    thisSecond As integer

    thisMilliseconds As integer

End Type



Declare Sub GetSystemTime lib "kernel32" Alias "GetSystemTime" (ByRef
IpSystemTime As SYSTEMTIME)

Declare Function getMS() as long





Function getMS() as long

     Dim systime As SYSTEMTIME

     call GetSystemTime(systime) 'From kernel32.dll

     Dim total as long

     Dim minutes as long

     dim seconds as long

     dim hours as long



     hours = systime.thisHour * 3600000

     minutes = systime.thisMinute * 60000

     seconds = systime.thisSecond

     seconds = seconds * 1000

     total = hours + minutes + seconds + systime.thisMilliseconds



     getMS = total



End Function



John Crutcher

Administrative Office of the Courts

1206 Quince St. SE

PO Box 41170

Olympia, WA 98504-1170



-----Original Message-----
From: haefeleuser [mailto:haefeleuser@...]
Sent: Wednesday, March 02, 2005 10:33 AM
To: junit@yahoogroups.com
Subject: [junit] Change the system time for the test




For my JUnit tests I need to modify the system time.

Instead of doing this manually by changing the OS clock I would like
to change the clock programatically in Java.

Of course I can set the time on the Calendar object in the JUnit test.
But it has no effect on the tested class. In the tested class "new
Date() " returns always the current date and not the one which I set
in my JUnit test.

I have test data for business logic which I create before the test
starts and which contain absolute dates like 2004-12-31. So I need to
modify the system date for my tests.

What I need to test is calculation of the average sold quantity. But
only the last X weeks (from today) need to be considered. My test
sales data contains dates like 2004-12-31. Its much easier for me to
write and understand data with such "absolute" dates instead of
relative dates (by rolling the dates around and not understanding it
quickly). So it would be good for me to simply set the system date
before the test starts and thus use absolute dates for my tests
instead of relative ones.

Of course I could make the dates of the test data relative, but that
would be harder to code, understand and to maintain. It better for me
to change the system time. But it needs to be done programatically in
the JUnit test and not manually by changing the OS date by hand.

Can you provide a solution for that please?







Yahoo! Groups Sponsor

ADVERTISEMENT
click here
<http://us.ard.yahoo.com/SIG=12945os7l/M=298184.6018725.7038619.3001176/
D=groups/S=1705006905:HM/EXP=1109874852/A=2593423/R=0/SIG=11el9gslf/*htt
p:/www.netflix.com/Default?mqso=60190075>


<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
s/S=:HM/A=2593423/rand=813537480>



   _____

Yahoo! Groups Links

*         To visit your group on the web, go to:
http://groups.yahoo.com/group/junit/


*         To unsubscribe from this group, send an email to:
junit-unsubscribe@yahoogroups.com
<mailto:junit-unsubscribe@yahoogroups.com?subject=Unsubscribe>


*         Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



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

#13013 From: "jsarniak2" <jsarniak@...>
Date: Thu Mar 3, 2005 5:24 pm
Subject: junit problems with jaxb
jsarniak2
Send Email Send Email
 
I am a novice user of junit. I am trying to use it to test an
application that uses JAXB. I am using JUnit 3.8.1. When I use the
textui.testrunner to run the test, everything works fine and as
expected. However when I try to use the awui or the swingui, I get a
ClassCastException when it executes the marshalling statement

eg.
ArchiveLogArchiveLogElement archiveLogElement =
(ArchiveLogArchiveLogElement)
           unmarshaller.unmarshal(new File(fileName));

The only message that comes along with this exception is the dreaded
word "null".

I cetainly can use the textui but I want to use the swingui.

Any ideas out there as to why this is happening.

#13014 From: "Coolspot714" <Coolspot714@...>
Date: Thu Mar 3, 2005 2:26 pm
Subject: Experience with LoadTesting using JUnit?
Coolspot714
Send Email Send Email
 
Hi everybody,

I was wondering if any of you are actually using JUnit + something
for perfomance testing. I see the advantage of being able to reuse
the existing unit-tests for performance testing without having to
write the testcases again (maybe even in a different (scripting)
language). But I'm sure one has to bear in mind that the unit tests
are to be used for performance testing as well, especially regarding
granularity and test-data. I also fear that JUnit tests ususally tend
to not represent user-behavior, which is supposed to be simulated
during load-tests. But I'm pretty sure than can be achieved with
appropriate scheduling.

So do you have any experience about how JUnit + JUnitPerf/+The
Grinder/... competes against "pure" load-test tools like Mercury's
LoadRunner, Rational Robot, OpenSTA, The Grinder(without JUnit) etc.?

The reason why I'm asking is because our developers start to use
JUnit (I made them buy your book J.B. ;-) from now on (some already
have used it) and I'm dealing with developing performance/loadtesting
processes. Most of our applications run as EJBs on Bea WLS 8.1 with
oracle DBs.

Thanks in advance,
Thomas

#13015 From: "myraghava" <myraghava@...>
Date: Thu Mar 3, 2005 6:56 am
Subject: I am new to Junit
myraghava
Send Email Send Email
 
Hi
     I am new member of this Group. I am new to junit and white box
testing. I  had exp in black box testing.

    Now i am planing to learn junit. I don't have much knowldge about
java. Any one sugest how to use junit and How to run the code.

    I downloaded the junit and install in my pc. after creating the
TEst Case and Test Suite in Eclipse and running the test case and Test
Suits it is giving error "Could not determine test plugin Id - project
is not a plugin"

Any one Give me the solution for this question?

#13016 From: "Bradley, Todd" <todd.bradley@...>
Date: Thu Mar 3, 2005 8:13 pm
Subject: RE: Experience with LoadTesting using JUnit?
todd404
Send Email Send Email
 
So do you have any experience about how JUnit + JUnitPerf/+The
	 Grinder/... competes against "pure" load-test tools like
Mercury's
	 LoadRunner, Rational Robot, OpenSTA, The Grinder(without JUnit)
etc.?


One thing's for sure.  LoadRunner or Rational Robot will lose in the
area of price.  Outfitting a development team with licenses for either
of those is an expensive proposition.  All our load testing is done with
either free tools (JMeter, etc.) or homebrew tools.


Todd.


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

#13017 From: "Bradley, Todd" <todd.bradley@...>
Date: Thu Mar 3, 2005 8:14 pm
Subject: RE: [OT] Beeping Asserts
todd404
Send Email Send Email
 
You must be using a different version of JUnit.  ;-)


________________________________

	 From: Kevin Klinemeier [mailto:zipwow@...]
	 Sent: Thursday, March 03, 2005 12:45 PM
	 To: junit@yahoogroups.com
	 Subject: Re: [junit] [OT] Beeping Asserts


	 I have a T42, and haven't seen this behavior at all.


	 On Thu, 03 Mar 2005 10:07:15 -0800, Kevin Lawrence
	 <kevin@...> wrote:
	 >
	 > I have an IBM Thinkpad and if I type *assertEquals() very
quickly, it
	 > beeps. It drives me crazy.
	 >
	 > Is it just my Thinkpad or have other people experienced this ?
Are
	 > Thinkpads JUnit aware ?
	 >
	 > Kevin
	 >
	 > *actually, it beeps if you type e r t quickly in any windows
application.
	 >
	 >
	 > Yahoo! Groups Links
	 >
	 >
	 >
	 >
	 >


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
<http://us.ard.yahoo.com/SIG=129623hm6/M=298184.6018725.7038619.3001176/
D=groups/S=1705006905:HM/EXP=1109965506/A=2593423/R=0/SIG=11el9gslf/*htt
p://www.netflix.com/Default?mqso=60190075>

<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
s/S=:HM/A=2593423/rand=463377756>


________________________________

	 Yahoo! Groups Links


	 * To visit your group on the web, go to:
		 http://groups.yahoo.com/group/junit/

	 * To unsubscribe from this group, send an email to:
		 junit-unsubscribe@yahoogroups.com
<mailto:junit-unsubscribe@yahoogroups.com?subject=Unsubscribe>

	 * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service <http://docs.yahoo.com/info/terms/> .




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

#13018 From: "Bradley, Todd" <todd.bradley@...>
Date: Thu Mar 3, 2005 8:17 pm
Subject: RE: I am new to Junit
todd404
Send Email Send Email
 
Make sure in Eclipse you're doing "Run As JUnit Test" and not "Run As
JUnit Plug-in Test".  That's assuming your first JUnit test is a very
simple test of some plain old Java object, like most tutorials
recommend.


Todd.



________________________________

	 From: myraghava [mailto:myraghava@...]
	 Sent: Wednesday, March 02, 2005 11:57 PM
	 To: junit@yahoogroups.com
	 Subject: [junit] I am new to Junit




	 Hi
	     I am new member of this Group. I am new to junit and white
box
	 testing. I  had exp in black box testing.

	    Now i am planing to learn junit. I don't have much knowldge
about
	 java. Any one sugest how to use junit and How to run the code.

	    I downloaded the junit and install in my pc. after creating
the
	 TEst Case and Test Suite in Eclipse and running the test case
and Test
	 Suits it is giving error "Could not determine test plugin Id -
project
	 is not a plugin"

	 Any one Give me the solution for this question?








Yahoo! Groups Sponsor
ADVERTISEMENT
click here
<http://us.ard.yahoo.com/SIG=129dbh6pj/M=298184.6018725.7038619.3001176/
D=groups/S=1705006905:HM/EXP=1109966989/A=2593423/R=0/SIG=11el9gslf/*htt
p://www.netflix.com/Default?mqso=60190075>

<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
s/S=:HM/A=2593423/rand=305583747>


________________________________

	 Yahoo! Groups Links


	 * To visit your group on the web, go to:
		 http://groups.yahoo.com/group/junit/

	 * To unsubscribe from this group, send an email to:
		 junit-unsubscribe@yahoogroups.com
<mailto:junit-unsubscribe@yahoogroups.com?subject=Unsubscribe>

	 * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service <http://docs.yahoo.com/info/terms/> .




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

#13019 From: Kevin Klinemeier <zipwow@...>
Date: Thu Mar 3, 2005 8:50 pm
Subject: Re: Some Thoughts on Using Using EasyMock
zipwow
Send Email Send Email
 
I agree, I use the HTTP Mock API, and I hate that it has discrete
expectations about the *number* of times an accessor is called.  I
looked desperately for a way to turn this off/tell it I don't care,
but I didn't find it.  For now, I just deal, but if I found a mock
HTTP interface that was complete and didn't have this behavior, I'd be
very tempted to jump ship.

-Kevin


On Thu, 03 Mar 2005 10:02:43 -0800, Kevin Lawrence
<kevin@...> wrote:
> With EasyMock. I found that all my tests suddenly got more verbose and
> more fragile.

#13020 From: twall <twall@...>
Date: Thu Mar 3, 2005 8:53 pm
Subject: Re: Some Thoughts on Using Using EasyMock
timothyrwall
Send Email Send Email
 
I use the easymock "createNiceMock" rather frequently.  It makes the mock not
care which methods are called, how often, or in what order, since that is
*rarely* what I want to check.

On Thu, 3 Mar 2005 at 15:50:13, Kevin Klinemeier wrote:

> I agree, I use the HTTP Mock API, and I hate that it has discrete
> expectations about the *number* of times an accessor is called.  I
> looked desperately for a way to turn this off/tell it I don't care,
> but I didn't find it.  For now, I just deal, but if I found a mock
> HTTP interface that was complete and didn't have this behavior, I'd be
> very tempted to jump ship.
>
> -Kevin
>
>
> On Thu, 03 Mar 2005 10:02:43 -0800, Kevin Lawrence
> <kevin@...> wrote:
> > With EasyMock. I found that all my tests suddenly got more verbose and
> > more fragile.

#13021 From: Soaring Eagle <comfortable.numb@...>
Date: Thu Mar 3, 2005 9:17 pm
Subject: Re: Experience with LoadTesting using JUnit?
comfortable_...
Send Email Send Email
 
How about apache JMeter? I do not have any experience but would love
to hear if anyone else has.


On Thu, 03 Mar 2005 14:26:16 -0000, Coolspot714 <Coolspot714@...> wrote:
>
>
> Hi everybody,
>
> I was wondering if any of you are actually using JUnit + something
> for perfomance testing. I see the advantage of being able to reuse
> the existing unit-tests for performance testing without having to
> write the testcases again (maybe even in a different (scripting)
> language). But I'm sure one has to bear in mind that the unit tests
> are to be used for performance testing as well, especially regarding
> granularity and test-data. I also fear that JUnit tests ususally tend
> to not represent user-behavior, which is supposed to be simulated
> during load-tests. But I'm pretty sure than can be achieved with
> appropriate scheduling.
>
> So do you have any experience about how JUnit + JUnitPerf/+The
> Grinder/... competes against "pure" load-test tools like Mercury's
> LoadRunner, Rational Robot, OpenSTA, The Grinder(without JUnit) etc.?
>
> The reason why I'm asking is because our developers start to use
> JUnit (I made them buy your book J.B. ;-) from now on (some already
> have used it) and I'm dealing with developing performance/loadtesting
> processes. Most of our applications run as EJBs on Bea WLS 8.1 with
> oracle DBs.
>
> Thanks in advance,
> Thomas
>
>
>
>
>
>
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
> ________________________________
> Yahoo! Groups Links
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/junit/
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

#13022 From: "Bradley, Todd" <todd.bradley@...>
Date: Thu Mar 3, 2005 9:23 pm
Subject: RE: Experience with LoadTesting using JUnit?
todd404
Send Email Send Email
 
Of people in my company who have used it, 1 really likes it and 2 hate
it because of its reliance on using GUI for test case development.  No
programmer I know likes to build program logic by drag-and-drop.


Todd.



________________________________

	 From: Soaring Eagle [mailto:comfortable.numb@...]
	 Sent: Thursday, March 03, 2005 2:18 PM
	 To: junit@yahoogroups.com
	 Subject: Re: [junit] Experience with LoadTesting using JUnit?


	 How about apache JMeter? I do not have any experience but would
love
	 to hear if anyone else has.


	 On Thu, 03 Mar 2005 14:26:16 -0000, Coolspot714
<Coolspot714@...> wrote:
	 >
	 >
	 > Hi everybody,
	 >
	 > I was wondering if any of you are actually using JUnit +
something
	 > for perfomance testing. I see the advantage of being able to
reuse
	 > the existing unit-tests for performance testing without having
to
	 > write the testcases again (maybe even in a different
(scripting)
	 > language). But I'm sure one has to bear in mind that the unit
tests
	 > are to be used for performance testing as well, especially
regarding
	 > granularity and test-data. I also fear that JUnit tests
ususally tend
	 > to not represent user-behavior, which is supposed to be
simulated
	 > during load-tests. But I'm pretty sure than can be achieved
with
	 > appropriate scheduling.
	 >
	 > So do you have any experience about how JUnit + JUnitPerf/+The

	 > Grinder/... competes against "pure" load-test tools like
Mercury's
	 > LoadRunner, Rational Robot, OpenSTA, The Grinder(without
JUnit) etc.?
	 >
	 > The reason why I'm asking is because our developers start to
use
	 > JUnit (I made them buy your book J.B. ;-) from now on (some
already
	 > have used it) and I'm dealing with developing
performance/loadtesting
	 > processes. Most of our applications run as EJBs on Bea WLS 8.1
with
	 > oracle DBs.
	 >
	 > Thanks in advance,
	 > Thomas
	 >
	 >
	 >
	 >
	 >
	 >
	 >
	 >
	 > Yahoo! Groups Sponsor
	 > ADVERTISEMENT
	 >
	 > ________________________________
	 > Yahoo! Groups Links
	 > To visit your group on the web, go to:
	 > http://groups.yahoo.com/group/junit/
	 >
	 > To unsubscribe from this group, send an email to:
	 > junit-unsubscribe@yahoogroups.com
	 >
	 > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
<http://us.ard.yahoo.com/SIG=12957qeh8/M=298184.6018725.7038619.3001176/
D=groups/S=1705006905:HM/EXP=1109971086/A=2593423/R=0/SIG=11el9gslf/*htt
p://www.netflix.com/Default?mqso=60190075>

<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
s/S=:HM/A=2593423/rand=787744137>


________________________________

	 Yahoo! Groups Links


	 * To visit your group on the web, go to:
		 http://groups.yahoo.com/group/junit/

	 * To unsubscribe from this group, send an email to:
		 junit-unsubscribe@yahoogroups.com
<mailto:junit-unsubscribe@yahoogroups.com?subject=Unsubscribe>

	 * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service <http://docs.yahoo.com/info/terms/> .




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

#13023 From: Chris Dollin <kers@...>
Date: Fri Mar 4, 2005 7:33 am
Subject: Re: I am new to Junit
anover_alias
Send Email Send Email
 
On Thursday 03 March 2005 06:56, myraghava wrote:
> Hi
>     I am new member of this Group. I am new to junit and white box
> testing. I  had exp in black box testing.
>
>    Now i am planing to learn junit. I don't have much knowldge about
> java. Any one sugest how to use junit and How to run the code.
>
>    I downloaded the junit and install in my pc. after creating the
> TEst Case and Test Suite in Eclipse and running the test case and Test
> Suits it is giving error "Could not determine test plugin Id - project
> is not a plugin"
>
> Any one Give me the solution for this question?

Are you accidentally running it as a JUnit Plugin Test instead of as
a JUnit Test?

--
Chris "electric hedgehog" Dollin

#13024 From: Mithun Ravi <mithunr1982@...>
Date: Fri Mar 4, 2005 1:30 pm
Subject: Please tell me how to rectify this
mithunr1982
Send Email Send Email
 
Please tell me how to rectify this error in httpunit


java.lang.IllegalStateException: may not run
executeScript() from class
com.meterware.httpunit.javascript.JavaScript$Form
	 at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.discardDocumentWri\
teBuffer(JavaScript.java:150)
	 at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript(Java\
Script.java:139)
	 at
com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate\
.java:65)
	 at
gx.TestFindSenderRetailer.testSprintPCS(TestFindSenderRetailer.java:77)
	 at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav\
a:25)
	 at java.lang.reflect.Method.invoke(Method.java:324)
	 at
junit.framework.TestCase.runTest(TestCase.java:154)
	 at
junit.framework.TestCase.runBare(TestCase.java:127)
	 at
junit.framework.TestResult$1.protect(TestResult.java:106)
	 at
junit.framework.TestResult.runProtected(TestResult.java:124)
	 at
junit.framework.TestResult.run(TestResult.java:109)
	 at junit.framework.TestCase.run(TestCase.java:118)
	 at
junit.framework.TestSuite.runTest(TestSuite.java:208)
	 at junit.framework.TestSuite.run(TestSuite.java:203)
	 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner\
.java:421)
	 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java\
:305)
	 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav\
a:186)



Mithun R
rmithun@...




__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/

#13025 From: Mithun Ravi <mithunr1982@...>
Date: Fri Mar 4, 2005 1:17 pm
Subject: How can I implement document.write() to the current response object.
mithunr1982
Send Email Send Email
 
How can I run a javascript using httpunit.

How can I implement document.write() to the current
response object.

Mithun R
rmithun@...




__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/

#13026 From: Rohan Talip <rohan-yahoo-2005@...>
Date: Fri Mar 4, 2005 1:47 am
Subject: Re: [OT] Beeping Asserts
rohan_talip
Send Email Send Email
 
[Warning: offtopic, in case it wasn't obvious in the subject]

I have a IBM Thinkpad T22 and I had noticed similar behaviour before on Windows
2000 Professional but I thought it was with a different set of 3 keystrokes ...
so being test-driven I typed out a little test ;-) (i.e. started pressing random
keys)

I have discovered that if I ert press nm, various cvb combinations hjk of yui
three tyu keys ghj at the same time or very quickly one after the other I can
easily get my keyboard to beep.

This only seems to work for some 3 key combinations, however the keys don't
necessarily have to be close in proximity to each other.

I have not yet found a 2 key combination that does this.

I wonder if it is specific to IBM Thinkpads; maybe it is specific to particular
models.

I have not yet tried booting it up in Linux to see if it is the hardware or some
Windows driver that is doing it.

No idea why this happens, however I do have some solutions to stop it beeping :

a) turn your sound down or off (probably not practical if you're listening to
MP3s etc)
b) type s-l-o-w-e-r (unless your keyboard is more sensitive than mine)

:-)

Rohan

P.S. You owe the Oracle a set of ear plugs to block out the sound of millions of
keyboards beeping over the next 24 hours as the junit mailing list subscribers
read their email (and these offtopic messages), and try this out. :-)

P.P.S. If you've never heard of the Usenet^H^H^H^H^H^HInternet Oracle s/he will
answer your questions at http://cgi.cs.indiana.edu/~oracle/index.cgi  (Strangely
enough the keys Z-O-T don't beep for me)


On Thu, Mar 03, 2005 at 11:44:40AM -0800, Kevin Klinemeier wrote:
>
> I have a T42, and haven't seen this behavior at all.
>
>
> On Thu, 03 Mar 2005 10:07:15 -0800, Kevin Lawrence
> <kevin@...> wrote:
> >
> > I have an IBM Thinkpad and if I type *assertEquals() very quickly, it
> > beeps. It drives me crazy.
> >
> > Is it just my Thinkpad or have other people experienced this ? Are
> > Thinkpads JUnit aware ?
> >
> > Kevin
> >
> > *actually, it beeps if you type e r t quickly in any windows application.

#13027 From: Stéphane TRAUMAT <stephane.traumat@...>
Date: Thu Mar 3, 2005 9:38 pm
Subject: Re: Experience with LoadTesting using JUnit?
stephane.traumat@...
Send Email Send Email
 
Hello,

I'm would like to advise you an open source project we created:
http://junitscenario.sourceforge.net/

JUnitScenario is tool to simulate real life usage of applications. It
allows you to describe scenarios that are composed of unit tests calls
and simulate several users following those scenarios.

You have less options than tools like JUnitPerf but it's very easy to
make it work... just write an xml file like this:
<scenario name="cashier" users="20" loops="500">
  <task JUnitClass="org.mybank.MyFirstTest"
JUnitMethod="testCreateAccount" wait="10"/>
  <task JUnitClass="org.mybank.MyFirstTest"
JUnitMethod="testDipositMoney" wait="10"/>
  <task JUnitClass="org.mybank.MyFirstTest"
JUnitMethod="testWithdrawMoney" wait="50"/>
</scenario>

It doesn't have all the options of JMeter or JUnitPerf but it allows
anyone to create unit tests in 10 minutes without having to write lots
of files.. and there is nothing to compile :)

--
Stéphane TRAUMAT
scub.net
+33 (0)6 18 39 77 25

#13028 From: "tangents01" <tangents01@...>
Date: Thu Mar 3, 2005 10:53 pm
Subject: Running junit.swingui.TestRunner.run
tangents01
Send Email Send Email
 
So here's my problem:

In a class, let's call RunTest (which extends TestCase), I make a call
to junit.swingui.TestRunner.run(CLASS) to run the test and bring up
the dialogue.  The problem is that I have a static variable in the
CLASS I am trying to test, and I need to set it with a value before.
So I call:
   CLASS.static_var = foo;
   junit.swingui.TestRunner.run(CLASS)
but the static_var gets replaced whenever I make the second call.

One thing to note is that when I use juint.textui.TestRunner.run it
can take in a TestSuite, which I generate using addTestSuite, and it
doesn't write over static_var.  Using the textui interface works fine
in this case.

So my question is:  Is there to keep a static variable value when
passing into junit.swingui.TestRunner.run or perhaps a way to pass
junit.swingui.TestRunner.run a TestSuite object?

-Tan

#13029 From: "DiracBeltrami" <rdecampo@...>
Date: Thu Mar 3, 2005 8:05 pm
Subject: JUnit, ANT, log4j, System.out issue
DiracBeltrami
Send Email Send Email
 
Hello,

I am experiencing an issue with the combination of ANT, JUnit and
log4j.  Here's the situation.  The ANT build file uses the <junit>
task.  Log4j is configured to print to the console.  There are also
times when the unit tests use System.out directly.  The problem is
that the log4j statements are not captured by the <junit> as part of
the standard output.  The logging statements do appear on the console
when I run the tests.  But since they are not captured by <junit>,
they do not appear in the XML files and are lost forever.

I'm going to attempt to post the relevant portions of the relevant
files, but I've never posted to Yahoo before and they are XML, so it
might not work...

Here's the ANT target:

     <target name="run-test" depends="init,test-setup">
         <!-- execute the test -->
         <junit fork="yes"
                dir="${basedir}"
                haltonfailure="${test.halt.on.failure}"
                printsummary="withOutAndErr">
             <classpath refid="test.classpath" />
             <formatter type="xml" />
             <formatter type="plain" usefile="false"/>
             <jvmarg line="${test.jvmargs}" />
             <batchtest fork="yes" todir="${test.report.xml.dir}">

                 <fileset dir="${test.src}" >
                     <include name="${test.full.includes}" />
                     <exclude name="${test.full.excludes}" />
                  </fileset>
             </batchtest>
         </junit>
     </target>

Here's the log4j configuration:

<log4j:configuration debug="false">
<!-- debug is for configuration file debugging -->
         <appender name="SYS_OUT" class="org.apache.log4j.ConsoleAppender">
             <param name="Target" value="System.out"/>
             <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="%-5p %c{2} -%m%n"/>
             </layout>
         </appender>

         <root>
             <level value="INFO"/>
             <appender-ref ref="SYS_OUT"/>
         </root>
</log4j:configuration>

If anybody could enlighten me on the subject, I'd appreciate it.

Thanks,
Ray

#13030 From: Jason Rogers <jacaetevha@...>
Date: Fri Mar 4, 2005 9:09 pm
Subject: Re: Please tell me how to rectify this
jacaetev
Send Email Send Email
 
Mithun Ravi wrote:

>
> Please tell me how to rectify this error in httpunit
>
>
> java.lang.IllegalStateException: may not run
> executeScript() from class
> com.meterware.httpunit.javascript.JavaScript$Form
>       at
>
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.discardDocumentWri\
teBuffer(JavaScript.java:150)

There is a mailing list for HTTPUnit.  While there are folks trolling
this list that use HTTPUnit, we are not necessarily the experts.  You
ought to therefore post on the HTTPUnit mailing list.

--
Jason Rogers

"I am crucified with Christ: nevertheless I live; yet not I,
but Christ liveth in me: and the life which I now live in
the flesh I live by the faith of the Son of God, who loved
me, and gave himself for me."
     Galatians 2:20

#13031 From: "Jirong Hu" <hujirong888@...>
Date: Fri Mar 4, 2005 10:25 pm
Subject: How to handle the kind of RuntimeError?
hujirong888
Send Email Send Email
 
Hi

Lots of smoke, but basically what I try to do is insert a new object
without set the Non-nullable columns. So Hibernate gives an error. I
did wraper the code with catch Exception, why it still gives error?

Jirong

.1    [main] DEBUG com.sun.ccqa.im.UserTest  - setUp():ENTRY
10   [main] DEBUG com.sun.ccqa.im.IMBaseTestCase  -
getEMFactory():Initializing EntityManagerFactory...
229  [main] DEBUG com.sun.ccqa.im.IMBaseTestCase  - getEMFactory():...done
7231 [main] DEBUG com.sun.ccqa.im.UserTest  - setUp():Created new
EntityManager OK
7233 [main] DEBUG com.sun.ccqa.im.UserTest  - setUp():Started
transaction OK
7234 [main] DEBUG com.sun.ccqa.im.UserTest  - setUp():EXIT
7290 [main] DEBUG com.sun.ccqa.im.UserTest  - testAddUser():ENTRY
7299 [main] ERROR com.sun.cc.ia.EntityManagerImpl  -
save.error,entity=com.sun.cc.ia.v01.user.UserImpl@1bdc3
net.sf.hibernate.PropertyValueException: not-null property references
a null or transient value: com.sun.cc.ia.v01.user.UserImpl.account
     at
net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1286)
     at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:937)
     at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:866)
     at
net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:7\
84)
     at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4062)
     at
net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:4029)
     at com.sun.cc.ia.EntityManagerImpl.save(EntityManagerImpl.java:307)
     at
com.sun.ccqa.im.UserTest.testAddUserWithNullAccount(UserTest.java:41)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav\
a:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at junit.framework.TestCase.runTest(TestCase.java:154)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     at junit.textui.TestRunner.doRun(TestRunner.java:109)
     at junit.textui.TestRunner.run(TestRunner.java:72)
     at com.sun.ccqa.im.UserTest.main(UserTest.java:122)
7499 [main] ERROR net.sf.hibernate.AssertionFailure  - an assertion
failure occured (this may indicate a bug in Hibernate, but is more
likely due to unsafe use of the session)
net.sf.hibernate.AssertionFailure: null id in entry (don't flush the
Session after an exception occurs)
     at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2661)
     at
net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2485)
     at
net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2478)
     at
net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2280)
     at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)
     at
net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
     at com.sun.cc.ia.tran.TransactionImpl.commit(TransactionImpl.java:35)
     at com.sun.cc.ia.EntityManagerImpl.commit(EntityManagerImpl.java:130)
     at com.sun.ccqa.im.UserTest.tearDown(UserTest.java:81)
     at junit.framework.TestCase.runBare(TestCase.java:130)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     at junit.textui.TestRunner.doRun(TestRunner.java:109)
     at junit.textui.TestRunner.run(TestRunner.java:72)
     at com.sun.ccqa.im.UserTest.main(UserTest.java:122)
E
Time: 7.528
There was 1 error:
1)
testAddUserWithNullAccount(com.sun.ccqa.im.UserTest)net.sf.hibernate.AssertionFa\
ilure:
null id in entry (don't flush the Session after an exception occurs)
     at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2661)
     at
net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2485)
     at
net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2478)
     at
net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2280)
     at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)
     at
net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
     at com.sun.cc.ia.tran.TransactionImpl.commit(TransactionImpl.java:35)
     at com.sun.cc.ia.EntityManagerImpl.commit(EntityManagerImpl.java:130)
     at com.sun.ccqa.im.UserTest.tearDown(UserTest.java:81)
     at com.sun.ccqa.im.UserTest.main(UserTest.java:122)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

BUILD SUCCESSFUL (total time: 8 seconds)

#13032 From: Vasiliu Florin <florin198028@...>
Date: Fri Mar 4, 2005 10:29 pm
Subject: tomcat
florin198028
Send Email Send Email
 
hy,

I make a application in Jsp using tomcat 5. I want to go to url
/">http://<servername>/ and to run my index pagenot tomcat-apache default page



Vasiliu Florin
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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

#13033 From: Paul King <paulk@...>
Date: Fri Mar 4, 2005 10:19 pm
Subject: Re: How can I implement document.write() to the current response object.
paulk@...
Send Email Send Email
 
HttpUnit has limited support for JavaScript. I think
document.write() might be one of the not implemented
features at the moment but haven't checked for a while.
You might also consider HtmlUnit. It has better
JavaScript support at the moment. You can think of
it as an equivalent replacement to HttpUnit but
it does have a different API so you would need to
rewrite (some of) your tests. There should be no
problem using them together (not for the same test
but for different tests) so you probably only need
to rewrite your JavaScript-related test.

Paul.
P.S. document.write() is supported to some
extent by HtmlUnit (I have used it) but it may
not be fully supported. You might also consider
using Canoo WebTest which sits above HtmlUnit
and lets you write your tests declaratively
using XML.

Mithun Ravi wrote:
>
> How can I run a javascript using httpunit.
>
> How can I implement document.write() to the current
> response object.
>
> Mithun R
> rmithun@...
>
>
>
>
> __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>

#13034 From: "J. B. Rainsberger" <jbrains@...>
Date: Tue Mar 8, 2005 12:22 am
Subject: Re: Testing callback event-generating code?
nails762
Send Email Send Email
 
Michael Schuerig wrote:

>  > > interface CBH {
>  > >     void onThis(String s);
>  > >     void onThat(String s);
>  > >     String getSomething();
>  > > }
>  > That interface is too big.
>
> Is it? Please suggest ways to improve it.

Well, getSomething() seems not to have anything to do with the event
handler methods, so I'd move that to a different class. Maybe I need to
see it used in context, but I even have to wonder why you'd need one of
these things to give you a String so you could give it back Strings
later. Why does it not just remember the String it has?
--
J. B. (Joe) Rainsberger
Diaspar Software Services
http://www.diasparsoftware.com
Author, JUnit Recipes: Practical Methods for Programmer Testing

#13035 From: "Jagdish Dhuleshia" <dhuleshia@...>
Date: Mon Mar 7, 2005 8:34 pm
Subject: RE: Running junit.swingui.TestRunner.run
jdhulesh
Send Email Send Email
 
Hi Tan,

Instead of calling junit.swingui.TestRunner.run(CLASS), use following peice
of code to invoke the TestRunner.

String[] testArgs = new String[3];
testArgs[0] = "-noloading";
testArgs[1] = "-c";
testArgs[2] = <Your class name>.class.getName();
junit.swingui.TestRunner tRunner = new junit.swingui.TestRunner();
tRunner.start(testArgs);

This way, it will not re-load your class and it will have a correct value of
the static variable.

-Jagdish
   -----Original Message-----
   From: tangents01 [mailto:tangents01@...]
   Sent: Thursday, March 03, 2005 5:53 PM
   To: junit@yahoogroups.com
   Subject: [junit] Running junit.swingui.TestRunner.run




   So here's my problem:

   In a class, let's call RunTest (which extends TestCase), I make a call
   to junit.swingui.TestRunner.run(CLASS) to run the test and bring up
   the dialogue.  The problem is that I have a static variable in the
   CLASS I am trying to test, and I need to set it with a value before.
   So I call:
     CLASS.static_var = foo;
     junit.swingui.TestRunner.run(CLASS)
   but the static_var gets replaced whenever I make the second call.

   One thing to note is that when I use juint.textui.TestRunner.run it
   can take in a TestSuite, which I generate using addTestSuite, and it
   doesn't write over static_var.  Using the textui interface works fine
   in this case.

   So my question is:  Is there to keep a static variable value when
   passing into junit.swingui.TestRunner.run or perhaps a way to pass
   junit.swingui.TestRunner.run a TestSuite object?

   -Tan







         Yahoo! Groups Sponsor
               ADVERTISEMENT





----------------------------------------------------------------------------
--
   Yahoo! Groups Links

     a.. To visit your group on the web, go to:
     http://groups.yahoo.com/group/junit/

     b.. To unsubscribe from this group, send an email to:
     junit-unsubscribe@yahoogroups.com

     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



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

#13036 From: "J. B. Rainsberger" <jbrains@...>
Date: Tue Mar 8, 2005 12:24 am
Subject: Re: Experience with LoadTesting using JUnit?
nails762
Send Email Send Email
 
Coolspot714 wrote:

> So do you have any experience about how JUnit + JUnitPerf/+The
> Grinder/... competes against "pure" load-test tools like Mercury's
> LoadRunner, Rational Robot, OpenSTA, The Grinder(without JUnit) etc.?

I don't. What I do is watch the 20 slowest tests every week, then look
for performance hotspots as they evolve. This seems to help me avoid at
least common performance problems.

> The reason why I'm asking is because our developers start to use
> JUnit (I made them buy your book J.B. ;-) from now on (some already
> have used it) and I'm dealing with developing performance/loadtesting
> processes. Most of our applications run as EJBs on Bea WLS 8.1 with
> oracle DBs.

Best of luck. Performance testing, proper, is not my strong point. I
defer to Mike Clark (JUnitPerf) and Mike Bowler (HtmlUnit, Java
performance guru).
--
J. B. (Joe) Rainsberger
Diaspar Software Services
http://www.diasparsoftware.com
Author, JUnit Recipes: Practical Methods for Programmer Testing

Messages 13007 - 13036 of 24404   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