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 23405 - 23434 of 24385   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#23405 From: "marcotedone@..." <marco.tedone@...>
Date: Sun May 1, 2011 8:44 am
Subject: PODAM 1.0.0.RELEASE released
marcotedone...
Send Email Send Email
 
Dear all,

I'm proud to announce that PODAM 1.0.0.RELEASE was released and that it is now
available from Maven Central
(http://repo2.maven.org/maven2/uk/co/jemos/podam/podam/1.0.0.RELEASE/).

PODAM is a Java tool to auto-fill POJOs/JavaBeans with data. Although PODAM's
default strategy is to assign random values, users can implement their own Data
Provider Strategies to fill data.

PODAM provides the following functionalities:

- Auto-filling of simple/complex graphs of POJOs/JavaBeans with data (default
strategy is random data but you can provide your own)

- Inheritance (e.g. POJOs extending other [abstract] POJOs)

- Immutable-like classes (e.g. no setters, all final fields and full
constructor)

- Singleton-like classes (e.g. private constructor, public static factory
method)

PODAM home page can be found here: http://www.jemos.eu/projects/podam/

PODAM source code can be downloaded from here:
http://www.jemos.eu/viewgit/?a=summary&p=podam

PODAM community can be joined here: http://groups.google.com/group/podam

Bugs and RFEs can be filed here: http://www.jemos.eu/jira (requires creating a
JIRA account)

It would be nice to hear feedback from you.

#23406 From: "iv.hristov" <iv.hristov@...>
Date: Mon May 2, 2011 7:16 am
Subject: JUnitMatchers: assert that expected message occurs N times
iv.hristov
Send Email Send Email
 
May I suggest adding a static method in JUnitMatchers for the purpose of
asserting that string appears N times.

My current case of usability is as follows:

I am expecting an exception which should contain a certain message N
times so I use:

expectedException.expectMessage(JUnitMatchers.containsString("the
expected message"));

However this does not ensure that the message is present N times, so I
have to create my own matcher:

        private static class MyStringContains extends SubstringMatcher {

                private int matchesTimes;

                public MyStringContains(String string, int matchesTimes) {
                        super(string);
                        this.matchesTimes = matchesTimes;
                }

            @Factory
            public static Matcher<String> containsString(String substring, int
times) {
                return new MyStringContains(substring, times);
            }

                @Override
                protected boolean evalSubstringOf(String string) {
                        return StringUtils.countMatches(string, substring) ==
matchesTimes;
                }

                @Override
                protected String relationship() {
                        return "containing "+matchesTimes+" times";
                }
        }

Now I can use:


expectedException.expectMessage(JUnitMatchers.containsString("the
expected message", 5));


to check that "the expected message" appears 5 times in the exception
message body

#23407 From: David Saff <david@...>
Date: Tue May 3, 2011 1:19 am
Subject: Re: JUnitMatchers: assert that expected message occurs N times
dsaff
Send Email Send Email
 
iv,

I'm really glad that the matchers framework was flexible enough to
allow you to define your own matcher in this way.  In general, I would
encourage authors of new matchers to consider contributing them
directly to the hamcrest project, where they can be used for more
purposes than just JUnit.  Thanks,

    David

On Mon, May 2, 2011 at 3:16 AM, iv.hristov <iv.hristov@...> wrote:
> May I suggest adding a static method in JUnitMatchers for the purpose of
asserting that string appears N times.
>
> My current case of usability is as follows:
>
> I am expecting an exception which should contain a certain message N
> times so I use:
>
> expectedException.expectMessage(JUnitMatchers.containsString("the
> expected message"));
>
> However this does not ensure that the message is present N times, so I
> have to create my own matcher:
>
>       private static class MyStringContains extends SubstringMatcher {
>
>               private int matchesTimes;
>
>               public MyStringContains(String string, int matchesTimes) {
>                       super(string);
>                       this.matchesTimes = matchesTimes;
>               }
>
>           @Factory
>           public static Matcher<String> containsString(String substring, int
times) {
>               return new MyStringContains(substring, times);
>           }
>
>               @Override
>               protected boolean evalSubstringOf(String string) {
>                       return StringUtils.countMatches(string, substring) ==
matchesTimes;
>               }
>
>               @Override
>               protected String relationship() {
>                       return "containing "+matchesTimes+" times";
>               }
>       }
>
> Now I can use:
>
>
> expectedException.expectMessage(JUnitMatchers.containsString("the
> expected message", 5));
>
>
> to check that "the expected message" appears 5 times in the exception
> message body
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23408 From: Bill Venners <bill@...>
Date: Fri May 6, 2011 7:57 am
Subject: Re: [scalatest-users] Re: Mark failed assumptions as ignored?
billvenners
Send Email Send Email
 
Hi Joakim,

I just released a snapshot that includes a new ScalaTest "shell" that
was inspired primarily by your work on poju4s. A blog about it is
here:

http://www.artima.com/weblogs/viewpost.jsp?thread=326389

The snapshot works with Scala 2.8. You can download the snapshot
release via the scala-tools.org Maven repository with:

group id: org.scalatest
artifact id: scalatest_2.8.1
version: 1.5-SNAPSHOT

Or you can just grab the jar file from:

http://www.scala-tools.org/repo-snapshots/org/scalatest/scalatest_2.8.1/1.5-SNAP\
SHOT/scalatest_2.8.1-1.5-SNAPSHOT.jar

I put the Scaladoc for this snapshot release up here:

http://www.artima.com/docs-scalatest-1.5-SNAPSHOT-5-May-2011/

I didn't do the dots (i.e., outputting one green dot for each passed
test instead of the test name). It is something I could add later, but
I wanted to see how users actually used this first. If they don't use
it to run large suites, then probably dots aren't necessary. Also I
don't yet offer a way to run JUnit and TestNG tests that aren't a
JUnitSuite, JUnit3Suite, or TestNGSuite. Again I'm not sure people
would want to do that, so I left it out and will listen for grumbling.
It will be easy to add if that's actually something people want.

Give it a try and let me know what you think.

Thanks.

Bill

On Thu, Mar 17, 2011 at 1:33 PM, Joakim Ohlrogge
<joakim.ohlrogge@...> wrote:
> I just pushed an update to the poju4s wiki. Now all the basic-basic stuff is
> there (and some fancy coloring for fun). I think a direction to move this
> project is to fork of the run-stuff to another project and leave the JUnit
> specifics in poju4s. I'm not totally happy with it yet. Some solutions can
> definitely bi improved but it should be rather straight forward to add
> support for other frameworks. All that /should/ be needed is to implement an
> Intreaction and a Global for the new framework and then it should be
> possible to run and report in the same way from the new one.
> It is of course far from perfect I have a pretty good feeling about this way
> of finding, running and reporting on tests.
> If you want to play with it the latest is in the develop-branch.
> /Cheers!
>
>



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

#23409 From: Joakim Ohlrogge <joakim.ohlrogge@...>
Date: Fri May 6, 2011 11:00 am
Subject: Re: [scalatest-users] Re: Mark failed assumptions as ignored?
j0hlrogge
Send Email Send Email
 
Very good timing since I'm about to talk a little bit about scala test in a
scala user group meeting here in Stockholm soon. I'm of course very happy
that my experiment with poju4s sparked some inspiration for you and that it
became something "real". I'll see if I can show some shell stuff given the
mention (thanks) andd everything :)

My current ideas i want to try for poju4s seems like they will probably
branch off and focus more on integrating the REPL even tighter into the
workflow than on enabling JUnit for scala. But right now there are too many
ideas and too little time.

Cheers!
/J
-----------------------------------------------------
Joakim Ohlrogge
Agical AB
Västerlånggatan 79, 2 tr
111 29 Stockholm, SWEDEN

Mobile: +46-708-754004
Blog: johlrogge.wordpress.com
Twitter: @johlrogge
E-mail: joakim.ohlrogge@...


On Fri, May 6, 2011 at 9:57 AM, Bill Venners <bill@...> wrote:

> Hi Joakim,
>
> I just released a snapshot that includes a new ScalaTest "shell" that
> was inspired primarily by your work on poju4s. A blog about it is
> here:
>
> http://www.artima.com/weblogs/viewpost.jsp?thread=326389
>
> The snapshot works with Scala 2.8. You can download the snapshot
> release via the scala-tools.org Maven repository with:
>
> group id: org.scalatest
> artifact id: scalatest_2.8.1
> version: 1.5-SNAPSHOT
>
> Or you can just grab the jar file from:
>
>
>
http://www.scala-tools.org/repo-snapshots/org/scalatest/scalatest_2.8.1/1.5-SNAP\
SHOT/scalatest_2.8.1-1.5-SNAPSHOT.jar
>
> I put the Scaladoc for this snapshot release up here:
>
> http://www.artima.com/docs-scalatest-1.5-SNAPSHOT-5-May-2011/
>
> I didn't do the dots (i.e., outputting one green dot for each passed
> test instead of the test name). It is something I could add later, but
> I wanted to see how users actually used this first. If they don't use
> it to run large suites, then probably dots aren't necessary. Also I
> don't yet offer a way to run JUnit and TestNG tests that aren't a
> JUnitSuite, JUnit3Suite, or TestNGSuite. Again I'm not sure people
> would want to do that, so I left it out and will listen for grumbling.
> It will be easy to add if that's actually something people want.
>
> Give it a try and let me know what you think.
>
> Thanks.
>
> Bill
>
> On Thu, Mar 17, 2011 at 1:33 PM, Joakim Ohlrogge
> <joakim.ohlrogge@...> wrote:
> > I just pushed an update to the poju4s wiki. Now all the basic-basic stuff
> is
> > there (and some fancy coloring for fun). I think a direction to move this
> > project is to fork of the run-stuff to another project and leave the
> JUnit
> > specifics in poju4s. I'm not totally happy with it yet. Some solutions
> can
> > definitely bi improved but it should be rather straight forward to add
> > support for other frameworks. All that /should/ be needed is to implement
> an
> > Intreaction and a Global for the new framework and then it should be
> > possible to run and report in the same way from the new one.
> > It is of course far from perfect I have a pretty good feeling about this
> way
> > of finding, running and reporting on tests.
> > If you want to play with it the latest is in the develop-branch.
> > /Cheers!
> >
> >
>
>
>
> --
> Bill Venners
> Artima, Inc.
> http://www.artima.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalatest-users@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-users+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
>


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

#23410 From: David Saff <david@...>
Date: Tue May 10, 2011 6:21 pm
Subject: Re: How to create Progress Bar for JUnit?
dsaff
Send Email Send Email
 
i6941,

Sorry to be so long in getting back to you.  There was a GUI shipped
with JUnit 3, which you might be able to re-use.  You might also be
able to write your program as a custom Runner, so that you can run the
tests directly in Eclipse or NetBeans themselves.  Good luck,

    David

On Wed, Apr 20, 2011 at 2:03 AM, i6941 <id6941@...> wrote:
> I write a siple program convert user's input to test case and invoke JUnit to
run it. In Eclipse and Netbeans, you can see a progress bar when you run several
test cases, so how to do a similar thing in my program?
> Thanks!
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23411 From: David Saff <david@...>
Date: Tue May 10, 2011 6:32 pm
Subject: Re: Report "to implement" tests.
dsaff
Send Email Send Email
 
Lars,

Have you created a feature request at github to track our progress
toward this goal?

    David

On Thu, Apr 14, 2011 at 3:26 PM, lars.vonk <lars.vonk@...> wrote:
> Hi,
>
> I would like to see progress in (acceptance) tests not yet implemented. I want
these reported differently than normal failures. Is there a way in JUnit to
distinct between expected failing tests and "normal" failing tests?
>
> So in a report I would like to see something like:
>
> Tests: 42
> Failures:0
> Errors: 0
> Ignored: 0
> To implement: 12
>
> Regards, Lars
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23412 From: Bill Venners <bill@...>
Date: Tue May 10, 2011 8:24 pm
Subject: Re: How to create Progress Bar for JUnit?
billvenners
Send Email Send Email
 
Hi i6941,

I didn't realize you were looking for a GUI runner from your initial post.
ScalaTest has one, and it can run JUnit tests. You just pass -j
<JUnit-test-class-name> to Runner, as described here:

http://www.artima.com/docs-scalatest-1.5-SNAPSHOT-5-May-2011/#org.scalatest.tool\
s.Runner$

You'd need to put scala-library.jar on the class path, but wouldn't need to
use Scala to just run JUnit tests.

Bill

On Tue, May 10, 2011 at 11:21 AM, David Saff <david@...> wrote:

>
>
> i6941,
>
> Sorry to be so long in getting back to you. There was a GUI shipped
> with JUnit 3, which you might be able to re-use. You might also be
> able to write your program as a custom Runner, so that you can run the
> tests directly in Eclipse or NetBeans themselves. Good luck,
>
> David
>
>
> On Wed, Apr 20, 2011 at 2:03 AM, i6941 <id6941@...> wrote:
> > I write a siple program convert user's input to test case and invoke
> JUnit to run it. In Eclipse and Netbeans, you can see a progress bar when
> you run several test cases, so how to do a similar thing in my program?
> > Thanks!
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
>



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


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

#23413 From: "oldnslow69" <rosebrockr@...>
Date: Wed May 11, 2011 9:11 pm
Subject: junit install fails
oldnslow69
Send Email Send Email
 
downloaded junit4.9b2.zip
Followed this.
To install JUnit on Windows, follow these steps:

1.Unzip the junit.zip distribution file to a directory referred to as
%JUNIT_HOME%.

2.Add JUnit to the classpath:
set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar

so now i have a c:\%JUNIT_HOME% directory and here is result of setting
classpats and test, it fails

****
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar

C:\Users\rrosebrock>
C:\Users\rrosebrock>classpath /?
'classpath' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar

C:\Users\rrosebrock>java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUni
tCore
Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.junit.runner.JUnitCore.  Program will exit.

C:\Users\rrosebrock>set classpath=%classpath%;INSTALL_DIR\junit-4.6.jar;INSTALL_
DIR

C:\Users\rrosebrock>java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUni
tCore
Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.junit.runner.JUnitCore.  Program will exit.

C:\Users\rrosebrock>
  what am i doing wrong?
TIA

#23414 From: Joakim Ohlrogge <joakim.ohlrogge@...>
Date: Thu May 12, 2011 7:25 am
Subject: Re: junit install fails
j0hlrogge
Send Email Send Email
 
what have you set your JUNIT_HOME environment variable to?
When you change to INSTALL_DIR is that the name of your directory? Shouldn't
that be an absolute path?

I generally do not use the CLASS_PATH environmnet variable, I simply do
this:
java -cp junit.jar org.junit.runner.JUnitCore org.junit.tests.AllTests

(Or actually, I just run JUnit via Mave,Ant, Eclipse, Gradle, Sbt, Buildr,
IntelliJ or some other IDE/Build tool I happen to be using for my current
project so I pretty much never start the runner from the command line but if
I would do that I would specify the CLASS_PATH on the command line. Windows
used to have a pretty retareded limitation on a command line not being able
to be more than 255 characters long so if you exceed that you may need to
specify an environment variable)

Don't know if this helps. JUnit is like any other java program, specify your
classpath, point to your main class, provide the arguments for main and off
you gol. So there is no magic involved.

/J
-----------------------------------------------------
Joakim Ohlrogge
Agical AB
Västerlånggatan 79, 2 tr
111 29 Stockholm, SWEDEN

Mobile: +46-708-754004
Blog: johlrogge.wordpress.com
Twitter: @johlrogge
E-mail: joakim.ohlrogge@...


On Wed, May 11, 2011 at 11:11 PM, oldnslow69 <rosebrockr@...> wrote:

>
>
> downloaded junit4.9b2.zip
> Followed this.
> To install JUnit on Windows, follow these steps:
>
> 1.Unzip the junit.zip distribution file to a directory referred to as
> %JUNIT_HOME%.
>
> 2.Add JUnit to the classpath:
> set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
>
> so now i have a c:\%JUNIT_HOME% directory and here is result of setting
> classpats and test, it fails
>
> ****
> Microsoft Windows [Version 6.1.7600]
> Copyright (c) 2009 Microsoft Corporation. All rights reserved.
>
> C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
>
> C:\Users\rrosebrock>
> C:\Users\rrosebrock>classpath /?
> 'classpath' is not recognized as an internal or external command,
> operable program or batch file.
>
> C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
>
> C:\Users\rrosebrock>java org.junit.runner.JUnitCore
> org.junit.tests.AllTests
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/junit/runner/JUni
> tCore
> Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> Could not find the main class: org.junit.runner.JUnitCore. Program will
> exit.
>
> C:\Users\rrosebrock>set
> classpath=%classpath%;INSTALL_DIR\junit-4.6.jar;INSTALL_
> DIR
>
> C:\Users\rrosebrock>java org.junit.runner.JUnitCore
> org.junit.tests.AllTests
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/junit/runner/JUni
> tCore
> Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> Could not find the main class: org.junit.runner.JUnitCore. Program will
> exit.
>
> C:\Users\rrosebrock>
> what am i doing wrong?
> TIA
>
>
>


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

#23415 From: "oldnslow69" <rosebrockr@...>
Date: Thu May 12, 2011 1:03 pm
Subject: Re: junit install fails
oldnslow69
Send Email Send Email
 
Joakin,
  I'm brand new to java and junit. I'll try and answer as best I can your
questions in order asked!

  JUNIT_HOME environment variable? I have no idea what that is or where.

  INSTALL_DIR? I'm guessing C:\%JUNIT_HOME%\junit4.9b2\junit-4.9b2.jar

  absolute path? Sorry don't know what "absolute path" is or means.

  I tried: java -cp junit.jar org.junit.runner.JUnitCore org.junit.tests.AllTests

And got this.

C:\>java -cp junit.jar org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUni
tCore
Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.junit.runner.JUnitCore.  Program will exit.

C:\>


TIA
Randy

--- In junit@yahoogroups.com, Joakim Ohlrogge <joakim.ohlrogge@...> wrote:
>
> what have you set your JUNIT_HOME environment variable to?
> When you change to INSTALL_DIR is that the name of your directory? Shouldn't
> that be an absolute path?

>
> I generally do not use the CLASS_PATH environmnet variable, I simply do
> this:
> java -cp junit.jar org.junit.runner.JUnitCore org.junit.tests.AllTests
>
> (Or actually, I just run JUnit via Mave,Ant, Eclipse, Gradle, Sbt, Buildr,
> IntelliJ or some other IDE/Build tool I happen to be using for my current
> project so I pretty much never start the runner from the command line but if
> I would do that I would specify the CLASS_PATH on the command line. Windows
> used to have a pretty retareded limitation on a command line not being able
> to be more than 255 characters long so if you exceed that you may need to
> specify an environment variable)
>
> Don't know if this helps. JUnit is like any other java program, specify your
> classpath, point to your main class, provide the arguments for main and off
> you gol. So there is no magic involved.
>
> /J
> -----------------------------------------------------
> Joakim Ohlrogge
> Agical AB
> Västerlånggatan 79, 2 tr
> 111 29 Stockholm, SWEDEN
>
> Mobile: +46-708-754004
> Blog: johlrogge.wordpress.com
> Twitter: @johlrogge
> E-mail: joakim.ohlrogge@...
>
>
> On Wed, May 11, 2011 at 11:11 PM, oldnslow69 <rosebrockr@...> wrote:
>
> >
> >
> > downloaded junit4.9b2.zip
> > Followed this.
> > To install JUnit on Windows, follow these steps:
> >
> > 1.Unzip the junit.zip distribution file to a directory referred to as
> > %JUNIT_HOME%.
> >
> > 2.Add JUnit to the classpath:
> > set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
> >
> > so now i have a c:\%JUNIT_HOME% directory and here is result of setting
> > classpats and test, it fails
> >
> > ****
> > Microsoft Windows [Version 6.1.7600]
> > Copyright (c) 2009 Microsoft Corporation. All rights reserved.
> >
> > C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
> >
> > C:\Users\rrosebrock>
> > C:\Users\rrosebrock>classpath /?
> > 'classpath' is not recognized as an internal or external command,
> > operable program or batch file.
> >
> > C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
> >
> > C:\Users\rrosebrock>java org.junit.runner.JUnitCore
> > org.junit.tests.AllTests
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/junit/runner/JUni
> > tCore
> > Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
> > at java.net.URLClassLoader$1.run(Unknown Source)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(Unknown Source)
> > at java.lang.ClassLoader.loadClass(Unknown Source)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> > at java.lang.ClassLoader.loadClass(Unknown Source)
> > Could not find the main class: org.junit.runner.JUnitCore. Program will
> > exit.
> >
> > C:\Users\rrosebrock>set
> > classpath=%classpath%;INSTALL_DIR\junit-4.6.jar;INSTALL_
> > DIR
> >
> > C:\Users\rrosebrock>java org.junit.runner.JUnitCore
> > org.junit.tests.AllTests
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/junit/runner/JUni
> > tCore
> > Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
> > at java.net.URLClassLoader$1.run(Unknown Source)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(Unknown Source)
> > at java.lang.ClassLoader.loadClass(Unknown Source)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> > at java.lang.ClassLoader.loadClass(Unknown Source)
> > Could not find the main class: org.junit.runner.JUnitCore. Program will
> > exit.
> >
> > C:\Users\rrosebrock>
> > what am i doing wrong?
> > TIA
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>

#23416 From: Kalyan Kundu <smartu14@...>
Date: Fri May 13, 2011 8:07 am
Subject: jUnit Test case generator
smartu14
Send Email Send Email
 
Hi ALL:This is Kalyan here from India.I got this group id from jUnit site.Its my
pleasure to write to you.First of all I know to know if there is any automated
testcase generator for jUnit(both 3 and 4)?If it is there it is OK nothing to
say.Otherwise
  I am telling
  you for experimental purposes to serve my  own requirement, I wrote one
  framework that I will generate the tesecases automatically for the
classes provided in a directory in a package structure.
I will take two parameters 1. folder where classses are stored 2. jUNit version
(3.0 to 4.9) and the output directory.It will generate the testcasses for the
specified folder.The generated code if fully compiled.For private method I used
reflection to invoke.
I
  am not supposed to provide the input parameters because it can vary.But I have
kept the provision to provide it.
It will look like following:-
String args1 = null;String args2 = null;String expectedResult = null;
String ret = object.invokeOriginalMethod(args1,
args2);assertEquals(expectedResult, ret);
Now null will be filled up by the original tester.
It will run in all 1.3 to 1.6 environment.
Is it at all useful to generate testcase?

Eagerly waiting for your reply.
Thanks and Regards,Kalyan Kundu.

--- On Fri, 5/13/11, Kalyan Kundu <kalyankundu@...> wrote:

From: Kalyan Kundu <kalyankundu@...>
Subject: Fw: Re: jUnit Test case generator
To: smartu14@...
Date: Friday, May 13, 2011, 11:44 AM

FYI.
--- On Fri, 13/5/11, Kent Beck <kent@...> wrote:

From: Kent Beck <kent@...>
Subject: Re: jUnit Test case generator
To: "Kalyan Kundu" <kalyankundu@...>
Date: Friday, 13 May, 2011, 5:58 AM

I don't really have time to give you extended replies. I recommend you write a
message demonstrating your tool and post it to the JUnit mailing list
http://groups.yahoo.com/group/junit.
Best regards,
Kent
On May 11, 2011, at 7:04 PM, Kalyan Kundu wrote:
For example I am saying I can not assume what can be the method
characteristics.How it can fail or pass.From outside, I can do to test the api
it provides at least by jUnit, may be it is private may be public, may be it is
a method or may be constructor, does not matter.But apart from this, what did
you exactly mean?Please tell me, I can try for you to implement it.
Thanks and Regards,Kalyan Kundu. 

--- On Thu, 12/5/11, Kent Beck <kent@...> wrote:

From: Kent Beck <kent@...>
Subject: Re: jUnit Test case generator
To: "Kalyan Kundu" <kalyankundu@...>
Date: Thursday, 12 May,
  2011, 7:17 AM

Several people have written test case generators. The problem I have seen so far
is that they can only test the semantics that are already latent in the code, so
the resulting tests always pass. This can tell you if you accidentally change
the semantics, which can be useful.
Best regards,
Kent
On May 7, 2011, at 10:06 PM, Kalyan Kundu wrote:
Hi KentBeck,This is Kalyan here from India.I got your mailid from jUnit site.Its
my pleasure to write to you.First of all I know to know if there is any
automated testcase generator for jUnit(both 3 and 4)?If it is there it is OK
nothing to say.Otherwise I am telling
  you for experimental purposes to serve my  own requirement, I wrote one
framework that I will generate the tesecases automatically for the classes
provided in a directory in a package structure.
I will take two parameters 1. folder where classses are stored 2. jUNit version
(3.0 to 4.9) and the output directory.It will generate the testcasses for the
specified folder.The generated code if fully compiled.For private method I used
reflection to invoke.
I
  am not supposed to provide the input parameters because it can vary.But I have
kept the provision to provide it.
It will look like following:-
String args1 = null;String args2 = null;String expectedResult = null;
String ret = object.invokeOriginalMethod(args1,
args2);assertEquals(expectedResult, ret);
Now null will be filled up by the original tester.
It will run in all 1.3 to 1.6 environment.
Now I am confused what to do with this tool.Somebody is suggesting that no such
tool has been invented so far that generates automated jUnit test so make it a
costly testing tool and sell.Someone is saying to make it open source.
I don't know anything about this.Could you please advise me what are all
  those and should I do anything with it.
Eagerly waiting for your reply.
Thanks and Regards,Kalyan Kundu.






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

#23417 From: Kalyan Kundu <smartu14@...>
Date: Fri May 13, 2011 6:20 am
Subject: Re: Fw: Re: jUnit Test case generator
smartu14
Send Email Send Email
 
Hi All.
I have got the following mail from Kent Beck.
Can someone answer the questions in his/her leisure?

Thanks in advance.
Kalyan Kundu.


--- On Fri, 5/13/11, Kalyan Kundu <kalyankundu@...> wrote:

From: Kalyan Kundu <kalyankundu@...>
Subject: Fw: Re: jUnit Test case generator
To: smartu14@...
Date: Friday, May 13, 2011, 11:44 AM

FYI.
--- On Fri, 13/5/11, Kent Beck <kent@...> wrote:

From: Kent Beck <kent@...>
Subject: Re: jUnit Test case generator
To: "Kalyan Kundu" <kalyankundu@...>
Date: Friday, 13 May, 2011, 5:58 AM

I don't really have time to give you extended replies. I recommend you write a
message demonstrating your tool and post it to the JUnit mailing list
http://groups.yahoo.com/group/junit.
Best regards,
Kent
On May 11, 2011, at 7:04 PM, Kalyan Kundu wrote:
For example I am saying I can not assume what can be the method
characteristics.How it can fail or pass.From outside, I can do to test the api
it provides at least by jUnit, may be it is private may be public, may be it is
a method or may be constructor, does not matter.But apart from this, what did
you exactly mean?Please tell me, I can try for you to implement it.
Thanks and Regards,Kalyan Kundu. 

--- On Thu, 12/5/11, Kent Beck <kent@...> wrote:

From: Kent Beck <kent@...>
Subject: Re: jUnit Test case generator
To: "Kalyan Kundu" <kalyankundu@...>
Date: Thursday, 12 May,
  2011, 7:17 AM

Several people have written test case generators. The problem I have seen so far
is that they can only test the semantics that are already latent in the code, so
the resulting tests always pass. This can tell you if you accidentally change
the semantics, which can be useful.
Best regards,
Kent
On May 7, 2011, at 10:06 PM, Kalyan Kundu wrote:
Hi KentBeck,This is Kalyan here from India.I got your mailid from jUnit site.Its
my pleasure to write to you.First of all I know to know if there is any
automated testcase generator for jUnit(both 3 and 4)?If it is there it is OK
nothing to say.Otherwise I am telling
  you for experimental purposes to serve my  own requirement, I wrote one
framework that I will generate the tesecases automatically for the classes
provided in a directory in a package structure.
I will take two parameters 1. folder where classses are stored 2. jUNit version
(3.0 to 4.9) and the output directory.It will generate the testcasses for the
specified folder.The generated code if fully compiled.For private method I used
reflection to invoke.
I
  am not supposed to provide the input parameters because it can vary.But I have
kept the provision to provide it.
It will look like following:-
String args1 = null;String args2 = null;String expectedResult = null;
String ret = object.invokeOriginalMethod(args1,
args2);assertEquals(expectedResult, ret);
Now null will be filled up by the original tester.
It will run in all 1.3 to 1.6 environment.
Now I am confused what to do with this tool.Somebody is suggesting that no such
tool has been invented so far that generates automated jUnit test so make it a
costly testing tool and sell.Someone is saying to make it open source.
I don't know anything about this.Could you please advise me what are all
  those and should I do anything with it.
Eagerly waiting for your reply.
Thanks and Regards,Kalyan Kundu.






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

#23418 From: Esko Luontola <esko.luontola@...>
Date: Fri May 13, 2011 9:30 pm
Subject: Re: jUnit Test case generator
egeluontola
Send Email Send Email
 
Kalyan Kundu wrote on 13.5.2011 11:07:
> First of all I know to know if
> there is any automated testcase generator for jUnit(both 3 and 4)?

There is at least this one:
http://www.agitar.com/solutions/products/automated_junit_generation.html

Personally I wouldn't use any test generation, because a human is needed
to write tests which communicate well the intent of the behaviour being
specified by the code [1]. Neither could it be used to drive the design
of the production code.

Also I have my doubts that how useful such tools would be in dealing
with legacy code [2], when the code to be tested has non-trivial
dependencies. If the class is easy enough to cover with tests, that even
a program can do it, it would be easy for a human to write the same
tests. It would be a bit slower, but at the same time his understanding
of the code would increase and he would be able to write more meaningful
tests.

Generating the production code based on the tests would be more
interesting... [3]

[1] http://dannorth.net/introducing-bdd/
[2]
http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052
[3] http://cleancoder.posterous.com/the-transformation-priority-premise
http://cleancoder.posterous.com/fib-the-transformation-priority-premise

--
Esko Luontola
www.orfjackal.net

#23419 From: Kalyan Kundu <smartu14@...>
Date: Fri May 13, 2011 9:52 pm
Subject: Re: jUnit Test case generator
smartu14
Send Email Send Email
 
Esko:
Many thanks.
I will answer you after some tests.
Please wait until then.

Thanks and Regards,
Kalyan Kundu.


--- On Sat, 5/14/11, Esko Luontola <esko.luontola@...> wrote:

From: Esko Luontola <esko.luontola@...>
Subject: Re: [junit] jUnit Test case generator
To: junit@yahoogroups.com
Date: Saturday, May 14, 2011, 3:00 AM
















 









       Kalyan Kundu wrote on 13.5.2011 11:07:

> First of all I know to know if

> there is any automated testcase generator for jUnit(both 3 and 4)?



There is at least this one:

http://www.agitar.com/solutions/products/automated_junit_generation.html



Personally I wouldn't use any test generation, because a human is needed

to write tests which communicate well the intent of the behaviour being

specified by the code [1]. Neither could it be used to drive the design

of the production code.



Also I have my doubts that how useful such tools would be in dealing

with legacy code [2], when the code to be tested has non-trivial

dependencies. If the class is easy enough to cover with tests, that even

a program can do it, it would be easy for a human to write the same

tests. It would be a bit slower, but at the same time his understanding

of the code would increase and he would be able to write more meaningful

tests.



Generating the production code based on the tests would be more

interesting... [3]



[1] http://dannorth.net/introducing-bdd/

[2]

http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052

[3] http://cleancoder.posterous.com/the-transformation-priority-premise

http://cleancoder.posterous.com/fib-the-transformation-priority-premise



--

Esko Luontola

www.orfjackal.net

























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

#23420 From: Charlie Poole <charliepoole@...>
Date: Sat May 14, 2011 8:34 pm
Subject: Re: jUnit Test case generator
cpoole98370
Send Email Send Email
 
Hi Esko,

It's not clear to me whether Kalyan wants to generate tests or test cases,
or
even whether you, he and I have the same meaning for those words.

I will use "test case" to mean a set of data for an already existing
parametrized
test and "test" for the method itself, which has already been written by the

developer in the normal way - that is using TDD.

Using that terminology, I can see some benefit in generating additional test

cases for the preexisting test, since there might be some situations that
have
been missed in course of writing them. I think such an approach would always
be secondary to regular TDD - at least in my own work - but it could be
useful.

This is something like the effect one gets already from "surprising"
combinations
of Datapoints using Theories and it's easy to imagine a program that
generated
additional "surprises."

Charlie

On Fri, May 13, 2011 at 11:30 PM, Esko Luontola <esko.luontola@...>wrote:

>
>
> Kalyan Kundu wrote on 13.5.2011 11:07:
>
> > First of all I know to know if
> > there is any automated testcase generator for jUnit(both 3 and 4)?
>
> There is at least this one:
> http://www.agitar.com/solutions/products/automated_junit_generation.html
>
> Personally I wouldn't use any test generation, because a human is needed
> to write tests which communicate well the intent of the behaviour being
> specified by the code [1]. Neither could it be used to drive the design
> of the production code.
>
> Also I have my doubts that how useful such tools would be in dealing
> with legacy code [2], when the code to be tested has non-trivial
> dependencies. If the class is easy enough to cover with tests, that even
> a program can do it, it would be easy for a human to write the same
> tests. It would be a bit slower, but at the same time his understanding
> of the code would increase and he would be able to write more meaningful
> tests.
>
> Generating the production code based on the tests would be more
> interesting... [3]
>
> [1] http://dannorth.net/introducing-bdd/
> [2]
>
>
http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052
> [3] http://cleancoder.posterous.com/the-transformation-priority-premise
> http://cleancoder.posterous.com/fib-the-transformation-priority-premise
>
> --
> Esko Luontola
> www.orfjackal.net
>
>


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

#23421 From: Kalyan Kundu <smartu14@...>
Date: Sun May 15, 2011 12:31 am
Subject: Re: jUnit Test case generator
smartu14
Send Email Send Email
 
Charlie,
I wanted to mean about the test (method) not the test case(data) according to
you.

Thanks and Regards,
Kalyan Kundu.


--- On Sun, 5/15/11, Charlie Poole <charliepoole@...> wrote:

From: Charlie Poole <charliepoole@...>
Subject: Re: [junit] jUnit Test case generator
To: junit@yahoogroups.com
Date: Sunday, May 15, 2011, 2:04 AM

Hi Esko,

It's not clear to me whether Kalyan wants to generate tests or test cases,
or
even whether you, he and I have the same meaning for those words.

I will use "test case" to mean a set of data for an already existing
parametrized
test and "test" for the method itself, which has already been written by the

developer in the normal way - that is using TDD.

Using that terminology, I can see some benefit in generating additional test

cases for the preexisting test, since there might be some situations that
have
been missed in course of writing them. I think such an approach would always
be secondary to regular TDD - at least in my own work - but it could be
useful.

This is something like the effect one gets already from "surprising"
combinations
of Datapoints using Theories and it's easy to imagine a program that
generated
additional "surprises."

Charlie

On Fri, May 13, 2011 at 11:30 PM, Esko Luontola <esko.luontola@...>wrote:

>
>
> Kalyan Kundu wrote on 13.5.2011 11:07:
>
> > First of all I know to know if
> > there is any automated testcase generator for jUnit(both 3 and 4)?
>
> There is at least this one:
> http://www.agitar.com/solutions/products/automated_junit_generation.html
>
> Personally I wouldn't use any test generation, because a human is needed
> to write tests which communicate well the intent of the behaviour being
> specified by the code [1]. Neither could it be used to drive the design
> of the production code.
>
> Also I have my doubts that how useful such tools would be in dealing
> with legacy code [2], when the code to be tested has non-trivial
> dependencies. If the class is easy enough to cover with tests, that even
> a program can do it, it would be easy for a human to write the same
> tests. It would be a bit slower, but at the same time his understanding
> of the code would increase and he would be able to write more meaningful
> tests.
>
> Generating the production code based on the tests would be more
> interesting... [3]
>
> [1] http://dannorth.net/introducing-bdd/
> [2]
>
>
http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052
> [3] http://cleancoder.posterous.com/the-transformation-priority-premise
> http://cleancoder.posterous.com/fib-the-transformation-priority-premise
>
> --
> Esko Luontola
> www.orfjackal.net
> 
>


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



------------------------------------

Yahoo! Groups Links





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

#23422 From: David Saff <david@...>
Date: Wed May 18, 2011 7:23 pm
Subject: Re: Re: junit install fails
dsaff
Send Email Send Email
 
Randy,

Sorry for a late response on this.

On Thu, May 12, 2011 at 9:03 AM, oldnslow69 <rosebrockr@...> wrote:
> Joakin,
>  I'm brand new to java and junit. I'll try and answer as best I can your
questions in order asked!
>
>  JUNIT_HOME environment variable? I have no idea what that is or where.
>
>  INSTALL_DIR? I'm guessing C:\%JUNIT_HOME%\junit4.9b2\junit-4.9b2.jar
>
>  absolute path? Sorry don't know what "absolute path" is or means.
>
>  I tried: java -cp junit.jar org.junit.runner.JUnitCore
org.junit.tests.AllTests

This should work, if "junit.jar" is a valid filename from the
directory where you're running it.  For example, if you actually see
junit.jar when you type "dir".  Otherwise, you'll need to type in the
full path to junit.jar.

    David Saff

>
> And got this.
>
> C:\>java -cp junit.jar org.junit.runner.JUnitCore org.junit.tests.AllTests
> Exception in thread "main" java.lang.NoClassDefFoundError:
org/junit/runner/JUni
> tCore
> Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
>        at java.net.URLClassLoader$1.run(Unknown Source)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
> Could not find the main class: org.junit.runner.JUnitCore.  Program will exit.
>
> C:\>
>
>
> TIA
> Randy
>
> --- In junit@yahoogroups.com, Joakim Ohlrogge <joakim.ohlrogge@...> wrote:
>>
>> what have you set your JUNIT_HOME environment variable to?
>> When you change to INSTALL_DIR is that the name of your directory? Shouldn't
>> that be an absolute path?
>
>>
>> I generally do not use the CLASS_PATH environmnet variable, I simply do
>> this:
>> java -cp junit.jar org.junit.runner.JUnitCore org.junit.tests.AllTests
>>
>> (Or actually, I just run JUnit via Mave,Ant, Eclipse, Gradle, Sbt, Buildr,
>> IntelliJ or some other IDE/Build tool I happen to be using for my current
>> project so I pretty much never start the runner from the command line but if
>> I would do that I would specify the CLASS_PATH on the command line. Windows
>> used to have a pretty retareded limitation on a command line not being able
>> to be more than 255 characters long so if you exceed that you may need to
>> specify an environment variable)
>>
>> Don't know if this helps. JUnit is like any other java program, specify your
>> classpath, point to your main class, provide the arguments for main and off
>> you gol. So there is no magic involved.
>>
>> /J
>> -----------------------------------------------------
>> Joakim Ohlrogge
>> Agical AB
>> Västerlånggatan 79, 2 tr
>> 111 29 Stockholm, SWEDEN
>>
>> Mobile: +46-708-754004
>> Blog: johlrogge.wordpress.com
>> Twitter: @johlrogge
>> E-mail: joakim.ohlrogge@...
>>
>>
>> On Wed, May 11, 2011 at 11:11 PM, oldnslow69 <rosebrockr@...> wrote:
>>
>> >
>> >
>> > downloaded junit4.9b2.zip
>> > Followed this.
>> > To install JUnit on Windows, follow these steps:
>> >
>> > 1.Unzip the junit.zip distribution file to a directory referred to as
>> > %JUNIT_HOME%.
>> >
>> > 2.Add JUnit to the classpath:
>> > set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
>> >
>> > so now i have a c:\%JUNIT_HOME% directory and here is result of setting
>> > classpats and test, it fails
>> >
>> > ****
>> > Microsoft Windows [Version 6.1.7600]
>> > Copyright (c) 2009 Microsoft Corporation. All rights reserved.
>> >
>> > C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
>> >
>> > C:\Users\rrosebrock>
>> > C:\Users\rrosebrock>classpath /?
>> > 'classpath' is not recognized as an internal or external command,
>> > operable program or batch file.
>> >
>> > C:\Users\rrosebrock>set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
>> >
>> > C:\Users\rrosebrock>java org.junit.runner.JUnitCore
>> > org.junit.tests.AllTests
>> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> > org/junit/runner/JUni
>> > tCore
>> > Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
>> > at java.net.URLClassLoader$1.run(Unknown Source)
>> > at java.security.AccessController.doPrivileged(Native Method)
>> > at java.net.URLClassLoader.findClass(Unknown Source)
>> > at java.lang.ClassLoader.loadClass(Unknown Source)
>> > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>> > at java.lang.ClassLoader.loadClass(Unknown Source)
>> > Could not find the main class: org.junit.runner.JUnitCore. Program will
>> > exit.
>> >
>> > C:\Users\rrosebrock>set
>> > classpath=%classpath%;INSTALL_DIR\junit-4.6.jar;INSTALL_
>> > DIR
>> >
>> > C:\Users\rrosebrock>java org.junit.runner.JUnitCore
>> > org.junit.tests.AllTests
>> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> > org/junit/runner/JUni
>> > tCore
>> > Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
>> > at java.net.URLClassLoader$1.run(Unknown Source)
>> > at java.security.AccessController.doPrivileged(Native Method)
>> > at java.net.URLClassLoader.findClass(Unknown Source)
>> > at java.lang.ClassLoader.loadClass(Unknown Source)
>> > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>> > at java.lang.ClassLoader.loadClass(Unknown Source)
>> > Could not find the main class: org.junit.runner.JUnitCore. Program will
>> > exit.
>> >
>> > C:\Users\rrosebrock>
>> > what am i doing wrong?
>> > TIA
>> >
>> >
>> >
>>
>>
>> [Non-text portions of this message have been removed]
>>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23423 From: "marcotedone@..." <marco.tedone@...>
Date: Wed May 18, 2011 9:40 pm
Subject: PODAM 2.3.4.RELEASE released
marcotedone...
Send Email Send Email
 
This is a major release to which you should upgrade to. This release
makes PODAM very fault-taulerant. PODAM will create a POJO no matter
which constructor type you declared (public no-arg, private no-arg,
public with args, non-public with args).

The difference between 2.3.3 is that while before non-public, non-
default constructors were not covered now they are; additionally while
before in case of non JavaBean standard constuctors PODAM created an
instance but did not populate its attributes, now it both creates an
instance and populates its attributes.

Regards,

Marco

#23424 From: "lewismc2" <lewis.mcgibbney@...>
Date: Mon May 23, 2011 3:58 pm
Subject: missing junit.jar in Ant1.8.2
lewismc2
Send Email Send Email
 
Hi list,

Having read the content here [1] I realise that I am missing 'junit.jar' from my
ant dist. I am unsure of what to package to download and add to my /lib dir
within ant.

Any suggestions please?

Thanks

Lewis

[1] http://ant.apache.org/manual/Tasks/junit.html

#23425 From: David Saff <david@...>
Date: Tue May 24, 2011 7:05 pm
Subject: Re: missing junit.jar in Ant1.8.2
dsaff
Send Email Send Email
 
https://github.com/downloads/KentBeck/junit/junit-4.8.2.jar should
work fine.  Good luck!

    David Saff

On Mon, May 23, 2011 at 11:58 AM, lewismc2 <lewis.mcgibbney@...> wrote:
> Hi list,
>
> Having read the content here [1] I realise that I am missing 'junit.jar' from
my ant dist. I am unsure of what to package to download and add to my /lib dir
within ant.
>
> Any suggestions please?
>
> Thanks
>
> Lewis
>
> [1] http://ant.apache.org/manual/Tasks/junit.html
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#23426 From: "adeithzya" <adeithzya@...>
Date: Wed May 25, 2011 11:06 am
Subject: Testing for Spring MVC Portlet
adeithzya
Send Email Send Email
 
Hi All,
I've setup a project for portlet using Spring MVC Portlet application. Now I
need to add testing capabilites using JUnit, my goal is so I don't need to
deploy every time I make some changes e.g in the Controller.

Thanks

#23427 From: Alistair Israel <aisrael@...>
Date: Fri May 27, 2011 2:47 am
Subject: Re: Testing for Spring MVC Portlet
aisrael
Send Email Send Email
 
On Wed, May 25, 2011 at 7:06 PM, adeithzya <adeithzya@...> wrote:

> I've setup a project for portlet using Spring MVC Portlet application. Now I
need to add testing capabilites using JUnit, my
> goal is so I don't need to deploy every time I make some changes e.g in the
Controller.

Whether using Spring 2.x or 3.x, unit testing MVC controllers
shouldn't be that hard. This is a testament to the highly decoupled
design of the Spring framework.  In Spring 3.x, they take
non-intrusiveness even further by relying heavily on annotations and
letting you use POJOs wherever possible.

In general, you just need to write a JUnit test class that'll perform
the responsibilities of the Spring container and provide test
scaffolding for your controller's dependencies. Now, if you follow the
principle of "design by contract" (also evident throughout the Spring
framework) then your controller should be depending upon interfaces,
not concrete classes.

If so, then personally I prefer mocking those dependency interfaces at
test time (using a convenient mocking framework such as Mockito). To a
large extent you can still mock concrete classes but using actual
dependencies usually introduces transitive dependencies which just
makes your test scaffolding more complicated or bloated.

As a general example, take a 2.x SimpleFormController that calls an
EJB to update an entity.
1. Mock the EJB interface
2. Instantiate the controller
3. Supply the mock to the controller
4. Mock the request & response parameters
5. Call doSubmitAction()
6. Verify that the proper ModelAndView are returned
7. Verify that the mock EJB's update method was called with the proper
parameters

Like I said, Spring 2.5.x and above simplifies the above greatly by
letting you call your controller methods directly with the actual
parameters they'll need (you don't have to mock the request or
response interfaces).

Without specifics as to your controllers, forms and views then this is
as much as I can give you. Hope this helps!

- alistair
--
http://alistairisrael.wordpress.com

#23428 From: "J. B. Rainsberger" <jbrains762@...>
Date: Sat May 28, 2011 10:04 pm
Subject: Re: Testing for Spring MVC Portlet
nails762
Send Email Send Email
 
adeithzya wrote:

> I've setup a project for portlet using Spring MVC Portlet application.
> Now I need to add testing capabilites using JUnit, my goal is so I don't
> need to deploy every time I make some changes e.g in the Controller.

For controllers in particular, you should have no trouble simply
instantiating the controller in a JUnit test, invoking its
handleRequest() method (or whatever they call it these days--I'm offline
so I can't check) and checking the content of the ModelAndView object
that it returns. If you need to run your container to run your
controller method, then you've broken the principle of context
independence: you've made your controller depend on the container,
rather than the other way around.

If your controller depends on something from the container, or from
Spring, then I recommend changing the controller to depend on an
interface that that thing can implement. If you pass that dependency in
through your controller's constructor, then you'll easy be able to use
method stubs or expectations to check that your controller interacts
with its immediate dependencies correctly, and be able to run the tests
entirely in memory.

I hope this helps, and if you need to know more, I'm sure we'll help you.
-- J. B. Rainsberger :: http://www.jbrains.ca ::
http://www.thecodewhisperer.com

#23429 From: gerald.w.winkler@...
Date: Sat May 28, 2011 10:07 pm
Subject: AUTO: Gerald W Winkler is out of the office. (returning 05/31/2011)
gerald.w.winkler@...
Send Email Send Email
 
I am out of the office until 05/31/2011.

I will be out of the office from May 27th to the 31st. I will be returning
to the office on May 31st.

I can be reached for critical issues via cell phone at 616-836-9030.


Note: This is an automated response to your message  "Re: [junit] Testing
for Spring MVC Portlet" sent on 5/28/2011 6:04:04 PM.

This is the only notification you will receive while this person is away.

#23430 From: "congzb" <zhebincong@...>
Date: Wed Jun 1, 2011 7:39 pm
Subject: mock javax.naming.InitialContext
zhebincong
Send Email Send Email
 
Hello,

in my source code, including following code:

		 InitialContext ctx = new InitialContext();
		 ............= (...........)ctx.lookup("java:comp/env/service/someservce");

so i wonder, in my junit test case, how to mock the InitialContext to look up
and return a mock service?
Thanks.

#23431 From: Alistair Israel <aisrael@...>
Date: Wed Jun 1, 2011 11:24 pm
Subject: Re: mock javax.naming.InitialContext
aisrael
Send Email Send Email
 
On Thu, Jun 2, 2011 at 3:39 AM, congzb <zhebincong@...> wrote:

> in my source code, including following code:
>
>                InitialContext ctx = new InitialContext();
>                ............=
(...........)ctx.lookup("java:comp/env/service/someservce");
>
> so i wonder, in my junit test case, how to mock the InitialContext to look up
and return a mock service?

The simplest thing I found that worked was to write a StubContext
(implements Context) and a StubContextFactoryBuilder (implements
InitialContextFactoryBuilder) that returns instances of my
StubContext.

Not quite a dynamic mock, but I suppose you can use the same
techniques with a Mockito-synthesized mock Context. I wasn't
interested in mocking the JNDI context per se, anyway. I just needed a
convenient way for JNDI client code to be able to resolve names at
test time.

Anyway—in my test's setup method I call
NamingManager.setInitialContextFactoryBuilder() passing it an instance
of my StubContextFactoryBuilder(). I also added a check to
hasInitialContextFactoryBuilder() to avoid an exception when
setInitialContextFactoryBuilder() is called more than once.

You're welcome to look at StubJndiContext.java on junit-rules for the
code that packages up the above as a @Rule:
https://github.com/AlistairIsrael/junit-rules/blob/master/src/main/java/junit/ru\
les/jndi/StubJndiContext.java

Hope this helps!

- alistair
--
http://alistairisrael.wordpress.com

#23432 From: Joakim Ohlrogge <joakim.ohlrogge@...>
Date: Thu Jun 2, 2011 9:19 pm
Subject: Re: mock javax.naming.InitialContext
j0hlrogge
Send Email Send Email
 
I would wrap the context behind my own interface and stub/mock/whatever
testdouble technique you prefer that. Then I would add just enough system
level tests to make sure it works with a JNDI context in place and use my
own interface in the rest of my code. The instance of my interface would be
injected something like this:

ServiceFactory services = new ServiceFactoryStub();
SomethingIWantToTest subject = new SomethingIWantToTest(services);

Then you don't have to worry about JNDI anywhere in our code except of
course in the JNDI service implementation which would look something like
the code you provided internally.

When it comes to mocking frameworks, unless you are interested in verifying
interactions then roll your own stubs. That way your stub code will be in
one place and not spread out and duplicated all over your tests and become
an unmaintainable mess of expectations that you don't really care about
except as a way to make mocks return the proper values for invocations that
happen to occur in your tests.
If on the other hand you believe that interactions between roles are
important to verify then pick a good mock framework like JMock and learn how
to use it properly. I have not read the book yet but I hear good things
about Growing Object Oriented systems. I would assume, given who wrote it,
that you will find everything you need to understand about mock frameworks
and how to use them properly and efficiently without making a mess.

I hope this helps some.
Good luck!


-----------------------------------------------------
Joakim Ohlrogge
Agical AB
Västerlånggatan 79, 2 tr
111 29 Stockholm, SWEDEN

Blog: johlrogge.wordpress.com
Twitter: @johlrogge
E-mail: joakim.ohlrogge@...


On Wed, Jun 1, 2011 at 9:39 PM, congzb <zhebincong@...> wrote:

>
>
> Hello,
>
> in my source code, including following code:
>
> InitialContext ctx = new InitialContext();
> ............= (...........)ctx.lookup("java:comp/env/service/someservce");
>
> so i wonder, in my junit test case, how to mock the InitialContext to look
> up and return a mock service?
> Thanks.
>
>
>


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

#23433 From: "J. B. Rainsberger" <jbrains762@...>
Date: Sat Jun 4, 2011 8:06 pm
Subject: Re: mock javax.naming.InitialContext
nails762
Send Email Send Email
 
congzb wrote:

> InitialContext ctx = new InitialContext();
> ............= (...........)ctx.lookup("java:comp/env/service/someservce");
>
> so i wonder, in my junit test case, how to mock the InitialContext to
> look up and return a mock service?

Two things.

1. Look for MockEJB, which I used years ago, and does what you want
right now.

2. Stop trying to do this as soon as you can. Read these:

http://www.mockobjects.com/2008/11/only-mock-types-you-own-revisited.html
http://www.davesquared.net/2011/04/dont-mock-types-you-dont-own.html
http://dotnet.dzone.com/news/tdd-only-mock-types-you-own

Enjoy.
--
J. B. Rainsberger :: http://www.jbrains.ca ::
http://www.thecodewhisperer.com

#23434 From: "asdflkajsd187" <willie.owens91@...>
Date: Wed Jun 8, 2011 11:45 pm
Subject: @BeforeClass not being executed
asdflkajsd187
Send Email Send Email
 
I have a static method with the @BeforeClass annotation, and it is not being run
at all before my JUnit tests. My class extends TestCase and is a JUnit 4 test.

I simply have:

@BeforeClass
public static void Up() {
    System.out.println("this should show up in the console");
}

Any ideas why this shouldn't be working?

Messages 23405 - 23434 of 24385   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