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...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 19402 - 19431 of 24387   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#19402 From: "James Abley" <james.abley@...>
Date: Fri Jun 1, 2007 7:59 am
Subject: Re: Problem with after and before
taboozizi
Send Email Send Email
 
On 31/05/07, Pamela perez <patuco_69@...> wrote:
>
>
>
>
>
>
> It never executes the m'todo initEditionTestCase, still being static
>
>  public class EditionTestCase extends TestCase {

Are you sure it works when you mix JUnit 3 features (extending
TestCase) with JUnit 4 features (using annotations)?

Cheers,

James

>
>
>
>
>
>
>      private static Logger log = (Logger)
Logger.getInstance(Class.class.getName());
>
>      private static  EditionVO oEditionVO1;
>      private static  EditionVO oEditionVO2;
>
>
>  @BeforeClass
>      public static void InitEditionTestCase() {
>          try {
>              oEditionVO1    =   
(EditionVO)SpringXMLHelper.getInstance().getTestBean(EditionTestCase.class.getSi\
mpleName()+"1");
>              oEditionVO2    =   
(EditionVO)SpringXMLHelper.getInstance().getTestBean(EditionTestCase.class.getSi\
mpleName()+"2");
>          } catch (ErrorSpringException e) {
>              System.out.println(e.getMessage());
>          }
>      }
>
>  ----- Mensaje original ----
>  De: Lasse Koskela <lasse.koskela@...>
>  Para: junit@yahoogroups.com
>  Enviado: miércoles, 30 de mayo, 2007 21:08:27
>  Asunto: Re: [junit] Problem with after and before
>
>  Hi,
>
>  The @BeforeClass and @AfterClass methods also need to be static, not
>
>  instance methods.
>
>  --
>
>  Lasse Koskela
>
>  * Author of "Test Driven" (Manning Publications, 2007) *
>
>  On 5/30/07, Matthias Schmidt <matthias.schmidt@ framfab.com> wrote:
>
>  > Do you have Tests in your class?
>
>  >  Maybe it would be better if you sent your whole class.
>
>  >  ____________ _________ _________ __
>
>  >
>
>  >  From: junit@yahoogroups. com [mailto:junit@yahoogroups. com] On Behalf Of
>
>  >  patuco_69
>
>  >  Sent: Wednesday, May 30, 2007 1:22 PM
>
>  >  To: junit@yahoogroups. com
>
>  >  Subject: [junit] Problem with after and before
>
>  >
>
>  >  I work with J2se 5.0, eclipse 3.2.
>
>  >  Problem the methods:
>
>  >
>
>  >  @org.junit.BeforeCl ass
>
>  >  public void InitTest() {
>
>  >  System.out.println( "ESTO AL Inicio DEL TEST");
>
>  >
>
>  >  }
>
>  >
>
>  >  @AfterClass
>
>  >  public void endTest() {
>
>  >  System.out.println( "ESTO AL FINAL DEL TEST");
>
>  >  }
>
>  >
>
>  >  Are not they never executed for that?
>
>
>  <!--
>
>  #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
>  #ygrp-mlmsg table {font-size:inherit;font:100%;}
>  #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean,
sans-serif;}
>  #ygrp-mlmsg pre, code {font:115% monospace;}
>  #ygrp-mlmsg * {line-height:1.22em;}
>  #ygrp-text{
>  font-family:Georgia;
>  }
>  #ygrp-text p{
>  margin:0 0 1em 0;}
>  #ygrp-tpmsgs{
>  font-family:Arial;
>  clear:both;}
>  #ygrp-vitnav{
>  padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
>  #ygrp-vitnav a{
>  padding:0 1px;}
>  #ygrp-actbar{
>  clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
>  #ygrp-actbar .left{
>  float:left;white-space:nowrap;}
>  .bld{font-weight:bold;}
>  #ygrp-grft{
>  font-family:Verdana;font-size:77%;padding:15px 0;}
>  #ygrp-ft{
>  font-family:verdana;font-size:77%;border-top:1px solid #666;
>  padding:5px 0;
>  }
>  #ygrp-mlmsg #logo{
>  padding-bottom:10px;}
>
>  #ygrp-vital{
>  background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
>  #ygrp-vital #vithd{
> 
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:upp\
ercase;}
>  #ygrp-vital ul{
>  padding:0;margin:2px 0;}
>  #ygrp-vital ul li{
>  list-style-type:none;clear:both;border:1px solid #e0ecee;
>  }
>  #ygrp-vital ul li .ct{
> 
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-ri\
ght:.5em;}
>  #ygrp-vital ul li .cat{
>  font-weight:bold;}
>  #ygrp-vital a {
>  text-decoration:none;}
>
>  #ygrp-vital a:hover{
>  text-decoration:underline;}
>
>  #ygrp-sponsor #hd{
>  color:#999;font-size:77%;}
>  #ygrp-sponsor #ov{
>  padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
>  #ygrp-sponsor #ov ul{
>  padding:0 0 0 8px;margin:0;}
>  #ygrp-sponsor #ov li{
>  list-style-type:square;padding:6px 0;font-size:77%;}
>  #ygrp-sponsor #ov li a{
>  text-decoration:none;font-size:130%;}
>  #ygrp-sponsor #nc {
>  background-color:#eee;margin-bottom:20px;padding:0 8px;}
>  #ygrp-sponsor .ad{
>  padding:8px 0;}
>  #ygrp-sponsor .ad #hd1{
> 
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%\
;}
>  #ygrp-sponsor .ad a{
>  text-decoration:none;}
>  #ygrp-sponsor .ad a:hover{
>  text-decoration:underline;}
>  #ygrp-sponsor .ad p{
>  margin:0;}
>  o {font-size:0;}
>  .MsoNormal {
>  margin:0 0 0 0;}
>  #ygrp-text tt{
>  font-size:120%;}
>  blockquote{margin:0 0 0 4px;}
>  .replbq {margin:4;}
>  -->
>
>
>  ______________________________________________
>  LLama Gratis a cualquier PC del Mundo.
>  Llamadas a fijos y móviles desde 1 céntimo por minuto.
>  http://es.voice.yahoo.com
>
>  [Non-text portions of this message have been removed]
>
>
>
>

#19403 From: <Narasimha_Tadepalli@...>
Date: Thu May 31, 2007 11:36 pm
Subject: JUNIT Report
tn_rao
Send Email Send Email
 
HI All

                    Could somebody advice me how to generate JUnit
reports without using ANT?

Thanks
Narasimha


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

#19404 From: "j_cumps" <j_cumps@...>
Date: Fri Jun 1, 2007 1:38 pm
Subject: Re: JUNIT Report
j_cumps
Send Email Send Email
 
Narasimha,

The only option I know of is via Maven.
Maven 1: http://maven.apache.org/maven-1.x/plugins/junit-
report/changes-report.html

Maven 2: http://maven.apache.org/plugins/maven-surefire-report-plugin/

Regards, Jan


--- In junit@yahoogroups.com, <Narasimha_Tadepalli@...> wrote:
>
> HI All
>
>                    Could somebody advice me how to generate JUnit
> reports without using ANT?
>
> Thanks
> Narasimha
>
>
> [Non-text portions of this message have been removed]
>

#19405 From: "James Abley" <james.abley@...>
Date: Fri Jun 1, 2007 2:21 pm
Subject: Re: Re: JUNIT Report
taboozizi
Send Email Send Email
 
On 01/06/07, j_cumps <j_cumps@...> wrote:
>
>
>
>
>
>
> Narasimha,
>
>  The only option I know of is via Maven.
>  Maven 1: http://maven.apache.org/maven-1.x/plugins/junit-
>  report/changes-report.html
>
>  Maven 2: http://maven.apache.org/plugins/maven-surefire-report-plugin/
>
>  Regards, Jan
>
>  --- In junit@yahoogroups.com, <Narasimha_Tadepalli@...> wrote:
>  >
>  > HI All
>  >
>  >                    Could somebody advice me how to generate JUnit
>  > reports without using ANT?
>  >

Could you tell us more about why you are unable to use ANT, so that we
are better equipped to advise on alternatives?

Cheers,

James

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

#19406 From: <Narasimha_Tadepalli@...>
Date: Fri Jun 1, 2007 2:38 pm
Subject: RE: Re: JUNIT Report
tn_rao
Send Email Send Email
 
Hi James



               I didn't say I am unable to use ANT. My purpose here is I
would like to execute remote JUnit tests through java, any where I am
not using ANT except in some testing. So I am exploring other possible
and better options.



Thanks

Narasimha



From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of
James Abley
Sent: Friday, June 01, 2007 9:22 AM
To: junit@yahoogroups.com
Subject: Re: [junit] Re: JUNIT Report



On 01/06/07, j_cumps <j_cumps@... <mailto:j_cumps%40yahoo.com> >
wrote:
>
>
>
>
>
>
> Narasimha,
>
> The only option I know of is via Maven.
> Maven 1: http://maven.apache.org/maven-1.x/plugins/junit-
> report/changes-report.html
>
> Maven 2: http://maven.apache.org/plugins/maven-surefire-report-plugin/
>
> Regards, Jan
>
> --- In junit@yahoogroups.com <mailto:junit%40yahoogroups.com> ,
<Narasimha_Tadepalli@...> wrote:
> >
> > HI All
> >
> > Could somebody advice me how to generate JUnit
> > reports without using ANT?
> >

Could you tell us more about why you are unable to use ANT, so that we
are better equipped to advise on alternatives?

Cheers,

James

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





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

#19407 From: "James Abley" <james.abley@...>
Date: Fri Jun 1, 2007 3:14 pm
Subject: Re: Re: JUNIT Report
taboozizi
Send Email Send Email
 
On 01/06/07, Narasimha_Tadepalli@... <Narasimha_Tadepalli@...> wrote:
>
>
>
>
>
>
> Hi James
>
>  I didn't say I am unable to use ANT. My purpose here is I
>  would like to execute remote JUnit tests through java, any where I am
>  not using ANT except in some testing. So I am exploring other possible
>  and better options.

Hi Narasimha,

My point being that your question read (at least to me) as a solution
requiring input on the implementation, rather than a problem in
context with possible solutions. Now that we have a little more
context, I might suggest looking at SmartFrog. Remote JUnit tests -
well, Eclipse uses (I think) a Socket-based approach to run tests and
collect results. You might try looking at that too.

As it is, I still don't have enough to properly understand what the
problem is that you're trying to solve. I'm willing to learn though!

Sorry,

James


>
>  Thanks
>
>  Narasimha
>
>  From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of
>  James Abley
>  Sent: Friday, June 01, 2007 9:22 AM
>  To: junit@yahoogroups.com
>  Subject: Re: [junit] Re: JUNIT Report
>
>  On 01/06/07, j_cumps <j_cumps@... <mailto:j_cumps%40yahoo.com> >
>  wrote:
>  >
>  >
>  >
>  >
>  >
>  >
>  > Narasimha,
>  >
>  > The only option I know of is via Maven.
>  > Maven 1: http://maven.apache.org/maven-1.x/plugins/junit-
>  > report/changes-report.html
>  >
>  > Maven 2: http://maven.apache.org/plugins/maven-surefire-report-plugin/
>  >
>  > Regards, Jan
>  >
>  > --- In junit@yahoogroups.com <mailto:junit%40yahoogroups.com> ,
>
>  <Narasimha_Tadepalli@...> wrote:
>  > >
>  > > HI All
>  > >
>  > > Could somebody advice me how to generate JUnit
>  > > reports without using ANT?
>  > >
>
>  Could you tell us more about why you are unable to use ANT, so that we
>  are better equipped to advise on alternatives?
>
>  Cheers,
>
>  James
>
>  >
>  >
>  >
>  >
>  >
>  >
>  > > Thanks
>  > > Narasimha
>  > >
>  > >
>  > > [Non-text portions of this message have been removed]
>  > >
>  >
>  >
>
>  [Non-text portions of this message have been removed]
>
>
>
>
>

#19408 From: <Narasimha_Tadepalli@...>
Date: Fri Jun 1, 2007 6:37 pm
Subject: RE: Re: JUNIT Report
tn_rao
Send Email Send Email
 
Looks like maven is nice alternative. Thanks Jan.





From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of
j_cumps
Sent: Friday, June 01, 2007 8:39 AM
To: junit@yahoogroups.com
Subject: [junit] Re: JUNIT Report



Narasimha,

The only option I know of is via Maven.
Maven 1: http://maven.apache.org/maven-1.x/plugins/junit-
report/changes-report.html

Maven 2: http://maven.apache.org/plugins/maven-surefire-report-plugin/

Regards, Jan

--- In junit@yahoogroups.com <mailto:junit%40yahoogroups.com> ,
<Narasimha_Tadepalli@...> wrote:
>
> HI All
>
> Could somebody advice me how to generate JUnit
> reports without using ANT?
>
> Thanks
> Narasimha
>
>
> [Non-text portions of this message have been removed]
>





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

#19409 From: "Ray Vanderborght" <voidstar@...>
Date: Fri Jun 1, 2007 6:45 pm
Subject: issue with junit and ant
ttftestrayv
Send Email Send Email
 
I have a project with tests that all pass for me locally, but then they
error out on our build machine.  I've tracked the problem down to the ant
versions being different on the two machines.  I can workaround the problem
by setting fork to false on the junit task, which makes it work under ant
1.7.0, but causes junit to hang under 1.6.2.

I guess I'll upgrade my local ant to 1.7.0 and keep set fork to false, but
I'm just wondering if anyone else has run into this problem.

My local machine with junit fork=true:
C:\workspace>ant -version
Apache Ant version 1.6.2 compiled on July 16 2004
...tests pass

The build machine with junit fork=true:
[root@build ~]# ant -version
Apache Ant version 1.7.0 compiled on December 13 2006

     [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.216 sec
     [junit] java.io.FileNotFoundException:
/home/root/.hudson/jobs/lds-30-trunk/workspace/trunk/junitvmwatcher2092053623.pr\
operties
(No such file or directory)
     [junit]     at java.io.FileInputStream.open(Native Method)
     [junit]     at java.io.FileInputStream.<init>(FileInputStream.java:106)
     [junit]     at java.io.FileReader.<init>(FileReader.java:55)
     [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(
JUnitTask.java:1028)
     [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
JUnitTask.java:817)
     [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(
JUnitTask.java:1657)
     [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
JUnitTask.java:764)
     [junit]     at org.apache.tools.ant.UnknownElement.execute(
UnknownElement.java:288)
     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
     [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
     [junit]     at java.lang.reflect.Method.invoke(Method.java:585)
     [junit]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(
DispatchUtils.java:105)
     [junit]     at org.apache.tools.ant.Task.perform(Task.java:348)
     [junit]     at org.apache.tools.ant.Target.execute(Target.java:357)
     [junit]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
     [junit]     at org.apache.tools.ant.Project.executeSortedTargets(
Project.java:1329)
     [junit]     at org.apache.tools.ant.Project.executeTarget(Project.java
:1298)
     [junit]     at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
DefaultExecutor.java:41)
     [junit]     at org.apache.tools.ant.Project.executeTargets(Project.java
:1181)
     [junit]     at org.apache.tools.ant.Main.runBuild(Main.java:698)
     [junit]     at org.apache.tools.ant.Main.startAnt(Main.java:199)
     [junit]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java
:257)
     [junit]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java
:104)

junit.framework.AssertionFailedError: Forked Java VM exited
abnormally. Please note the time in the report does not reflect the
time until the VM exit.


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

#19410 From: <Narasimha_Tadepalli@...>
Date: Fri Jun 1, 2007 3:44 pm
Subject: RE: Re: JUNIT Report
tn_rao
Send Email Send Email
 
Hi James



               Thanks for your inputs and appreciate you interest in
understanding the situation. Ok, what I did is, I developed some
parameterized JUnit tests and input would be xml file with bunch of
parameters. I would like to deploy as one webapplication with one
webservice which accepts xml input and returns back JUnit results as xml
output. Currently I am triggering ant scripts though this webapplication
from out of the webcontext.  User triggers the webservice and it looks
for locally configured ant script which is out of webserver and out of
webcontext and after completion again it looks for JUnit xml results in
another folder and captures it and return back.





                                 I hope you understood what's my problem
here and appreciate your inputs on creating as one webapplication. Let
me know if you need more clarifications.



Thanks

Narasimha





From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of
James Abley
Sent: Friday, June 01, 2007 10:14 AM
To: junit@yahoogroups.com
Subject: Re: [junit] Re: JUNIT Report



On 01/06/07, Narasimha_Tadepalli@...
<mailto:Narasimha_Tadepalli%40dell.com>  <Narasimha_Tadepalli@...
<mailto:Narasimha_Tadepalli%40dell.com> > wrote:
>
>
>
>
>
>
> Hi James
>
> I didn't say I am unable to use ANT. My purpose here is I
> would like to execute remote JUnit tests through java, any where I am
> not using ANT except in some testing. So I am exploring other possible
> and better options.

Hi Narasimha,

My point being that your question read (at least to me) as a solution
requiring input on the implementation, rather than a problem in
context with possible solutions. Now that we have a little more
context, I might suggest looking at SmartFrog. Remote JUnit tests -
well, Eclipse uses (I think) a Socket-based approach to run tests and
collect results. You might try looking at that too.

As it is, I still don't have enough to properly understand what the
problem is that you're trying to solve. I'm willing to learn though!

Sorry,

James

>
> Thanks
>
> Narasimha
>
> From: junit@yahoogroups.com <mailto:junit%40yahoogroups.com>
[mailto:junit@yahoogroups.com <mailto:junit%40yahoogroups.com> ] On
Behalf Of
> James Abley
> Sent: Friday, June 01, 2007 9:22 AM
> To: junit@yahoogroups.com <mailto:junit%40yahoogroups.com>
> Subject: Re: [junit] Re: JUNIT Report
>
> On 01/06/07, j_cumps <j_cumps@... <mailto:j_cumps%40yahoo.com>
<mailto:j_cumps%40yahoo.com> >
> wrote:
> >
> >
> >
> >
> >
> >
> > Narasimha,
> >
> > The only option I know of is via Maven.
> > Maven 1: http://maven.apache.org/maven-1.x/plugins/junit-
> > report/changes-report.html
> >
> > Maven 2:
http://maven.apache.org/plugins/maven-surefire-report-plugin/
> >
> > Regards, Jan
> >
> > --- In junit@yahoogroups.com <mailto:junit%40yahoogroups.com>
<mailto:junit%40yahoogroups.com> ,
>
> <Narasimha_Tadepalli@...> wrote:
> > >
> > > HI All
> > >
> > > Could somebody advice me how to generate JUnit
> > > reports without using ANT?
> > >
>
> Could you tell us more about why you are unable to use ANT, so that we
> are better equipped to advise on alternatives?
>
> Cheers,
>
> James
>
> >
> >
> >
> >
> >
> >
> > > Thanks
> > > Narasimha
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
>
> [Non-text portions of this message have been removed]
>
>
>
>
>





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

#19411 From: "J. B. Rainsberger" <jbrains762@...>
Date: Fri Jun 1, 2007 7:43 pm
Subject: Re: Dinamic tests with JUnit
nails762
Send Email Send Email
 
Emerson wrote:

> hey all, does anyone know how I could execute dinamic tests methods
> using Junit? I mean, I have a framework that uses xml configuration
> and XPATH to make some assertion tests from our server, and I would
> like to run them using junit, as it would be easier to generate
> reports and so on. The problem is that the tests are dinamic and
> depend on an external configuration file. So if i do asserts inside a
> loop it would leave the method on the first fail/error, is there any
> way to store all the asserts and process them afterwards? what would
> you suggest?

Chapter 5 (I believe) of the book _JUnit Recipes_ ("Working with test
data") would help you here. Scott Stirling wrote about this quite deeply.

My first choice is for each test to provide its own configuration data
by creating a different Configuration object, instead of an XML
document. This is like Spring framework, which allows configuration in
XML and configuration in Java.

When I can't do this easily, I create a test/data/configuration
directory in my project with a different configuration file for each
test. You still need to point your code to the configuration file for
each test, but at least all the test data is in one directory and you
can name each file to match the name of the test method.

The Parameterized Test Case is another choice, depending on how many
assertions you need to make and how many different inputs there are. If
you have just one input (the configuration file path) and a few outputs
to check, try it; but if the expected results are very different for
each test, then I recommend simply writing the tests and extracting the
common code into methods (usually setUp() in JUnit 3 or a @Before method
in JUnit 4).

Good luck.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.ca
Your guide to software craftsmanship
JUnit Recipes: Practical Methods for Programmer Testing
2005 Gordon Pask Award for contribution Agile Software Practice

#19412 From: "J. B. Rainsberger" <jbrains762@...>
Date: Fri Jun 1, 2007 7:45 pm
Subject: Re: Disabling Inherited Tests
nails762
Send Email Send Email
 
Ole Ersoy wrote:
>
>
> Hi,
>
> I've created
> a SetupTest class
> that just performs setup,
> but also tests the setup.
>
> So when other test
> classes inherit from it,
> the inherited tests run
> each time.
>
> Anyone know if I can disable the inherited tests?

You can't. I suggest pulling the setup code one more superclass higher,
making that superclass abstract, then adding one subclass that contains
the setup tests.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.ca
Your guide to software craftsmanship
JUnit Recipes: Practical Methods for Programmer Testing
2005 Gordon Pask Award for contribution Agile Software Practice

#19413 From: Ole Ersoy <ole.ersoy@...>
Date: Fri Jun 1, 2007 8:48 pm
Subject: Re: Disabling Inherited Tests
ole.ersoy@...
Send Email Send Email
 
Thanks JB.  It's excellent advice.  David also suggested it and it's running
beautifully.

Thanks again,
- Ole

J. B. Rainsberger wrote:
>
>
> Ole Ersoy wrote:
>  >
>  >
>  > Hi,
>  >
>  > I've created
>  > a SetupTest class
>  > that just performs setup,
>  > but also tests the setup.
>  >
>  > So when other test
>  > classes inherit from it,
>  > the inherited tests run
>  > each time.
>  >
>  > Anyone know if I can disable the inherited tests?
>
> You can't. I suggest pulling the setup code one more superclass higher,
> making that superclass abstract, then adding one subclass that contains
> the setup tests.
> --
> J. B. (Joe) Rainsberger :: http://www.jbrains.ca <http://www.jbrains.ca>
> Your guide to software craftsmanship
> JUnit Recipes: Practical Methods for Programmer Testing
> 2005 Gordon Pask Award for contribution Agile Software Practice
>
>

#19414 From: russgold@...
Date: Sat Jun 2, 2007 4:58 am
Subject: Your document
russgold
Send Email Send Email
 
Please, picture document.




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

#19415 From: "James Abley" <james.abley@...>
Date: Sat Jun 2, 2007 7:10 am
Subject: Re: issue with junit and ant
taboozizi
Send Email Send Email
 
On 01/06/07, Ray Vanderborght <voidstar@...> wrote:
>
>   I have a project with tests that all pass for me locally, but then they
> error out on our build machine. I've tracked the problem down to the ant
> versions being different on the two machines. I can workaround the problem
> by setting fork to false on the junit task, which makes it work under ant
> 1.7.0, but causes junit to hang under 1.6.2.
>
> I guess I'll upgrade my local ant to 1.7.0 and keep set fork to false, but
> I'm just wondering if anyone else has run into this problem.
>
> My local machine with junit fork=true:
> C:\workspace>ant -version
> Apache Ant version 1.6.2 compiled on July 16 2004
> ...tests pass
>
> The build machine with junit fork=true:
> [root@build ~]# ant -version
> Apache Ant version 1.7.0 compiled on December 13 2006
>
> [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.216 sec
> [junit] java.io.FileNotFoundException:
>
>
/home/root/.hudson/jobs/lds-30-trunk/workspace/trunk/junitvmwatcher2092053623.pr\
operties
> (No such file or directory)
> [junit] at java.io.FileInputStream.open(Native Method)
> [junit] at java.io.FileInputStream.<init>(FileInputStream.java:106)
> [junit] at java.io.FileReader.<init>(FileReader.java:55)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(
> JUnitTask.java:1028)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
> JUnitTask.java:817)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(
> JUnitTask.java:1657)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
> JUnitTask.java:764)
> [junit] at org.apache.tools.ant.UnknownElement.execute(
> UnknownElement.java:288)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.java:105)
> [junit] at org.apache.tools.ant.Task.perform(Task.java:348)
> [junit] at org.apache.tools.ant.Target.execute(Target.java:357)
> [junit] at org.apache.tools.ant.Target.performTasks(Target.java:385)
> [junit] at org.apache.tools.ant.Project.executeSortedTargets(
> Project.java:1329)
> [junit] at org.apache.tools.ant.Project.executeTarget(Project.java
> :1298)
> [junit] at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> DefaultExecutor.java:41)
> [junit] at org.apache.tools.ant.Project.executeTargets(Project.java
> :1181)
> [junit] at org.apache.tools.ant.Main.runBuild(Main.java:698)
> [junit] at org.apache.tools.ant.Main.startAnt(Main.java:199)
> [junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java
> :257)
> [junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java
> :104)
>
> junit.framework.AssertionFailedError: Forked Java VM exited
> abnormally. Please note the time in the report does not reflect the
> time until the VM exit.
>
> [Non-text portions of this message have been removed]
>
>
>

Sounds more like an ANT issue, which should be reported to the apache
ant-users / ant-devs list?

James


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

#19416 From: "hperryman" <heath@...>
Date: Sun Jun 3, 2007 7:11 am
Subject: "No tests found" failures in Ant but not Eclipsee a
hperryman
Send Email Send Email
 
We are using JUnit 3.8.1 and have our code in /src and /test trees as
widely suggested in JUnit literature. However, we also have test code
that is not using JUnit in the /test tree. Eclipse doesn't care, but
running the tests using Ant with batchtest generates exceptions for all
the classes not using JUnit. We don't want to have the failures in the
test results, but also don't want to store test code in /src.

What is the best practice in this situation? Apologies if this is
obvious or answered many times, I've searched to no avail.

Thanks very much.

Heath

#19417 From: "perryn_fowler" <pezlists@...>
Date: Sun Jun 3, 2007 12:17 pm
Subject: SetUp for entire suite in Junit 4?
perryn_fowler
Send Email Send Email
 
I use JUnit to run in-container funtional testing of my web apps.

When using JUnit 3, I used to use the technique decribed here
(http://www.dogbiscuit.org/mdub/weblog/Tech/Programming/Java/JettyTestSetup)
to start up and shut down a jetty web server once for a whole suite of
functional tests.

Any ideas how I might acheive something similar with Junit 4?

thanks Perryn

#19418 From: "perryn_fowler" <fowlerp@...>
Date: Mon Jun 4, 2007 6:43 am
Subject: Re: SetUp for entire suite in Junit 4?
perryn_fowler
Send Email Send Email
 
To answer my own question, it turns out that if you use
@RunWith(Suite.class) on a class and add @BeforeClass and @AfterClass
to that class, then they will run before and after the whole suite.

nice.

#19419 From: Patrick Breucking <breucking@...>
Date: Mon Jun 4, 2007 2:42 pm
Subject: Test-First with Derby
marquies_666
Send Email Send Email
 
Hi All,

my topic is not really JUnit relevant, but you are the test-freaks and I
think you can help me! I have to test some methods, wich generate tables
from database information. They calculate new numbers and this I have
to  validate.  To became  system independent, I consider to use Derby as
test-database with static values.

Do you think this a good idea?

Thanks,
Patrick

--
Patrick Breucking <breucking@...> (System Engineer)
* GONICUS GmbH * NL Arnsberg * Moehnestrasse 11-17 * D-59755 Arnsberg
* Tel.: +49 (0) 29 32 / 9 16 - 0 * Fax: +49 (0) 29 32 / 9 16 - 278
* http://www.GONICUS.de

*Sitz der Gesellschaft: Moehnestrasse 11-17 * D-59755 Arnsberg
*Geschaeftsfuehrer: Rainer Luelsdorf, Alfred Schroeder
*Vorsitzender des Beirats: Juergen Michels
*Amtsgericht Arnsberg * HRB 1968

#19420 From: "Lasse Koskela" <lasse.koskela@...>
Date: Mon Jun 4, 2007 4:34 pm
Subject: Re: Test-First with Derby
lassekoskela
Send Email Send Email
 
Hi Patrick,

On 6/4/07, Patrick Breucking <breucking@...> wrote:
> my topic is not really JUnit relevant, but you are the test-freaks and I
> think you can help me! I have to test some methods, wich generate tables
> from database information. They calculate new numbers and this I have
> to  validate.  To became  system independent, I consider to use Derby as
> test-database with static values.
>
> Do you think this a good idea?

What do you mean by "static values"? If you're generating the tables,
isn't the database content created during and by the test itself?

Lasse

--
Lasse Koskela
* Author of "Test Driven" (Manning Publications, 2007) *

#19421 From: Patrick Breucking <breucking@...>
Date: Mon Jun 4, 2007 5:35 pm
Subject: Re: Test-First with Derby
marquies_666
Send Email Send Email
 
Hi Lasse,

the "static values" in the databse should never change before, while  or
after a test. In operation, the code reads values from an external
database. (My code do some select-queries only.)

I guess it will be better, if I fill a new derby-db with test-values
(and delete after test) "beforeClass" instead of use a "backed-up" copy
(restoring beforeClass). Or?

Lasse Koskela schrieb:
>
> Hi Patrick,
>
> On 6/4/07, Patrick Breucking <breucking@...
> <mailto:breucking%40gonicus.de>> wrote:
> > my topic is not really JUnit relevant, but you are the test-freaks and I
> > think you can help me! I have to test some methods, wich generate tables
> > from database information. They calculate new numbers and this I have
> > to validate. To became system independent, I consider to use Derby as
> > test-database with static values.
> >
> > Do you think this a good idea?
>
> What do you mean by "static values"? If you're generating the tables,
> isn't the database content created during and by the test itself?
>
> Lasse
>
> --
> Lasse Koskela
> * Author of "Test Driven" (Manning Publications, 2007) *
>
>

#19422 From: Stephen Smith <steve@...>
Date: Mon Jun 4, 2007 7:08 pm
Subject: Re: "No tests found" failures in Ant but not Eclipsee a
steve@...
Send Email Send Email
 
Eclipse is a lot smarter than Ant at dynamically discovering source
code/config, which can be a good thing or bad thing. Ant has a far
simpler discovery mechanism - I suspect you need to tweak your Ant
<batchtest/> pattern to only run your designated tests.

----
Stephen Smith, MEng (Wales).
http://www.stephen-smith.co.uk/

hperryman wrote:
>
>
> We are using JUnit 3.8.1 and have our code in /src and /test trees as
> widely suggested in JUnit literature. However, we also have test code
> that is not using JUnit in the /test tree. Eclipse doesn't care, but
> running the tests using Ant with batchtest generates exceptions for all
> the classes not using JUnit. We don't want to have the failures in the
> test results, but also don't want to store test code in /src.
>
> What is the best practice in this situation? Apologies if this is
> obvious or answered many times, I've searched to no avail.
>
> Thanks very much.
>
> Heath
>
>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.472 / Virus Database: 269.8.7/830 - Release Date: 03/06/2007
12:47

#19423 From: "hperryman" <heath@...>
Date: Tue Jun 5, 2007 12:24 am
Subject: Re: "No tests found" failures in Ant but not Eclipsee a
hperryman
Send Email Send Email
 
Ah, bummer, that would make build script maintenance much more tricky.
I'm surprised though: don't people often write helper classes for
testing? If so, where do they put them?

Heath

--- In junit@yahoogroups.com, Stephen Smith <steve@...> wrote:
>
> Eclipse is a lot smarter than Ant at dynamically discovering source
> code/config, which can be a good thing or bad thing. Ant has a far
> simpler discovery mechanism - I suspect you need to tweak your Ant
> <batchtest/> pattern to only run your designated tests.
>
> ----
> Stephen Smith, MEng (Wales).
> http://www.stephen-smith.co.uk/
>
> hperryman wrote:
> >
> >
> > We are using JUnit 3.8.1 and have our code in /src and /test trees as
> > widely suggested in JUnit literature. However, we also have test code
> > that is not using JUnit in the /test tree. Eclipse doesn't care, but
> > running the tests using Ant with batchtest generates exceptions
for all
> > the classes not using JUnit. We don't want to have the failures in the
> > test results, but also don't want to store test code in /src.
> >
> > What is the best practice in this situation? Apologies if this is
> > obvious or answered many times, I've searched to no avail.
> >
> > Thanks very much.
> >
> > Heath
> >
> >
> >
> >
> >
------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.472 / Virus Database: 269.8.7/830 - Release Date:
03/06/2007 12:47
>

#19424 From: "Ray Vanderborght" <voidstar@...>
Date: Tue Jun 5, 2007 5:52 am
Subject: Re: issue with junit and ant
ttftestrayv
Send Email Send Email
 
Yup, it's an ant issue.  I'll answer it here in case anyone runs into it and
searches this list's archives in the future.  It boils down to my project
having ant 1.6 jars on the classpath.  Removing them made fork="true" work
under ant 1.7.0.

here's some relevant ant bugzillas...
http://issues.apache.org/bugzilla/show_bug.cgi?id=41511
http://issues.apache.org/bugzilla/show_bug.cgi?id=41104


On 6/2/07, James Abley <james.abley@...> wrote:
>
> On 01/06/07, Ray Vanderborght <voidstar@...> wrote:
> >
> >   I have a project with tests that all pass for me locally, but then
> they
> > error out on our build machine. I've tracked the problem down to the ant
> > versions being different on the two machines. I can workaround the
> problem
> > by setting fork to false on the junit task, which makes it work under
> ant
> > 1.7.0, but causes junit to hang under 1.6.2.
> >
> > I guess I'll upgrade my local ant to 1.7.0 and keep set fork to false,
> but
> > I'm just wondering if anyone else has run into this problem.
> >
> > My local machine with junit fork=true:
> > C:\workspace>ant -version
> > Apache Ant version 1.6.2 compiled on July 16 2004
> > ...tests pass
> >
> > The build machine with junit fork=true:
> > [root@build ~]# ant -version
> > Apache Ant version 1.7.0 compiled on December 13 2006
> >
> > [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.216 sec
> > [junit] java.io.FileNotFoundException:
> >
> >
>
/home/root/.hudson/jobs/lds-30-trunk/workspace/trunk/junitvmwatcher2092053623.pr\
operties
> > (No such file or directory)
> > [junit] at java.io.FileInputStream.open(Native Method)
> > [junit] at java.io.FileInputStream.<init>(FileInputStream.java:106)
> > [junit] at java.io.FileReader.<init>(FileReader.java:55)
> > [junit] at
> > org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(
> > JUnitTask.java:1028)
> > [junit] at
> > org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
> > JUnitTask.java:817)
> > [junit] at
> > org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(
> > JUnitTask.java:1657)
> > [junit] at
> > org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
> > JUnitTask.java:764)
> > [junit] at org.apache.tools.ant.UnknownElement.execute(
> > UnknownElement.java:288)
> > [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> > [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> > [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> > [junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> > DispatchUtils.java:105)
> > [junit] at org.apache.tools.ant.Task.perform(Task.java:348)
> > [junit] at org.apache.tools.ant.Target.execute(Target.java:357)
> > [junit] at org.apache.tools.ant.Target.performTasks(Target.java:385)
> > [junit] at org.apache.tools.ant.Project.executeSortedTargets(
> > Project.java:1329)
> > [junit] at org.apache.tools.ant.Project.executeTarget(Project.java
> > :1298)
> > [junit] at
> > org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> > DefaultExecutor.java:41)
> > [junit] at org.apache.tools.ant.Project.executeTargets(Project.java
> > :1181)
> > [junit] at org.apache.tools.ant.Main.runBuild(Main.java:698)
> > [junit] at org.apache.tools.ant.Main.startAnt(Main.java:199)
> > [junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java
> > :257)
> > [junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java
> > :104)
> >
> > junit.framework.AssertionFailedError: Forked Java VM exited
> > abnormally. Please note the time in the report does not reflect the
> > time until the VM exit.
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> Sounds more like an ANT issue, which should be reported to the apache
> ant-users / ant-devs list?
>
> James
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Yahoo! Groups Links
>
>
>
>


--
Why "re-invent the wheel?"
Because this time we can make it rounder!


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

#19425 From: "Lasse Koskela" <lasse.koskela@...>
Date: Tue Jun 5, 2007 3:34 pm
Subject: Re: Re: "No tests found" failures in Ant but not Eclipsee a
lassekoskela
Send Email Send Email
 
Hi Heath,

A lot of people write "helper classes for testing" and they put them
into what you have labeled "/test" source tree. I suspect that your
Ant script has something crooked--could you post the <target/> where
the exception is coming from?

Lasse

--
Lasse Koskela
* Author of "Test Driven" (Manning Publications, 2007) *

On 6/5/07, hperryman <heath@...> wrote:
> Ah, bummer, that would make build script maintenance much more tricky.
>  I'm surprised though: don't people often write helper classes for
>  testing? If so, where do they put them?
>
>  Heath
>
>
>  --- In junit@yahoogroups.com, Stephen Smith <steve@...> wrote:
>  >
>  > Eclipse is a lot smarter than Ant at dynamically discovering source
>  > code/config, which can be a good thing or bad thing. Ant has a far
>  > simpler discovery mechanism - I suspect you need to tweak your Ant
>  > <batchtest/> pattern to only run your designated tests.
>  >
>  > ----
>  > Stephen Smith, MEng (Wales).
>  > http://www.stephen-smith.co.uk/
>  >
>  > hperryman wrote:
>  > >
>  > >
>  > > We are using JUnit 3.8.1 and have our code in /src and /test trees as
>  > > widely suggested in JUnit literature. However, we also have test code
>  > > that is not using JUnit in the /test tree. Eclipse doesn't care, but
>  > > running the tests using Ant with batchtest generates exceptions
>  for all
>  > > the classes not using JUnit. We don't want to have the failures in the
>  > > test results, but also don't want to store test code in /src.
>  > >
>  > > What is the best practice in this situation? Apologies if this is
>  > > obvious or answered many times, I've searched to no avail.
>  > >
>  > > Thanks very much.
>  > >
>  > > Heath

#19426 From: "Lasse Koskela" <lasse.koskela@...>
Date: Tue Jun 5, 2007 3:31 pm
Subject: Re: Test-First with Derby
lassekoskela
Send Email Send Email
 
Hi Patrick,

On 6/4/07, Patrick Breucking <breucking@...> wrote:
>  the "static values" in the databse should never change before, while  or
>  after a test. In operation, the code reads values from an external
>  database. (My code do some select-queries only.)
>
>  I guess it will be better, if I fill a new derby-db with test-values
>  (and delete after test) "beforeClass" instead of use a "backed-up" copy
>  (restoring beforeClass). Or?

Yeah, this sounds like a good use for @BeforeClass and @AfterClass.

Lasse

--
Lasse Koskela
* Author of "Test Driven" (Manning Publications, 2007) *

#19427 From: slawalata <slawalata@...>
Date: Wed Jun 6, 2007 1:45 pm
Subject: Asking how to test class with collaboration to a static method
k4mpret77
Send Email Send Email
 
Greetings,

I am trying to find how I can test a class which has collaboration with
a singleton or static class.

I have attached the source code in this email. I have read many papers
in google and mostly they says that single ton is ugly etc :) but i must
test it and no other way.

I want to test OrderBusinessDelegate.isPossible() (a singleton class)
which has collaboration with another static class method
ProductDelegate.getOderByPno()

I try to isolate the OrderBusinessDelegate and change the
ProductDelegate with MockProductDelegate and still it doesnt work like I
expect.

This is the output

[code]
0    [main] DEBUG Order.OrderBusinessDelegate  - returning
ProductDelegate
2    [main] DEBUG Order.ProductDelegate  - getOrderByPno from
ProductDelegate
2    [main] DEBUG TestOrderDelegate  - isPossible() : 1 <->
OrderBusinessDelegate
3    [main] DEBUG Order.MockOrderBusinessDelegate  -
MockOrderBusinessdelegate is instanciated
3    [main] DEBUG Order.MockOrderBusinessDelegate  - returning
MockProductDelegate
3    [main] DEBUG Order.ProductDelegate  - getOrderByPno from
ProductDelegate
3    [main] DEBUG TestOrderDelegate  - isPossible() : 1 <->
MockOrderBusinessDelegate
[/code]

if ProductDelegate.getOderByPno() and
MockProductDelegate.getOderByPno() are changed into non static, i get
the expected result (inheritance)

[code]
0    [main] DEBUG Order.OrderBusinessDelegate  - returning
ProductDelegate
2    [main] DEBUG Order.ProductDelegate  - getOrderByPno from
ProductDelegate
2    [main] DEBUG TestOrderDelegate  - isPossible() : 1 <->
OrderBusinessDelegate
3    [main] DEBUG Order.MockOrderBusinessDelegate  -
MockOrderBusinessdelegate is instanciated
3    [main] DEBUG Order.MockOrderBusinessDelegate  - returning
MockProductDelegate
3    [main] DEBUG Order.MockProductDelegate  - getOrderByPno from
MockProductDelegate
3    [main] DEBUG TestOrderDelegate  - isPossible() : 10 <->
MockOrderBusinessDelegate
[/code]


I know it is not related with how to use JUnit but maybe someone has
already some experience how to test this unit or class. And later I can
use JUnit to perform automatic testing.

Thanks for any advices and responds

best regards
sanga lawalata

belows are the java codes :

TestOrderDelegate.java
[code]
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import Order.MockOrderBusinessDelegate;
import Order.OrderBusinessDelegate;


public class TestOrderDelegate {

	 private static Logger logger =
Logger.getLogger(TestOrderDelegate.class);

	 public static void main (String[] args){

		 PropertyConfigurator.configure("src/log4j.properties");

		 //1.
		 OrderBusinessDelegate orderDelegate =
OrderBusinessDelegate.getInstance();
		 logger.debug("isPossible() : "+orderDelegate.isPossible()+" <->
"+orderDelegate.toString());


		 //2.
		 OrderBusinessDelegate mockOrderDelegate =
MockOrderBusinessDelegate.getInstance();
		 if (mockOrderDelegate instanceof MockOrderBusinessDelegate) {
			 MockOrderBusinessDelegate new_name = (MockOrderBusinessDelegate)
mockOrderDelegate;
			 logger.debug("isPossible() : "+mockOrderDelegate.isPossible()+" <->
"+mockOrderDelegate.toString());
		 }else logger.debug("new_name is not MockOrderDelegate");


	 }

}
[/code]

OrderBusinessDelegate.java
[code]
package Order;

import org.apache.log4j.Logger;

public class OrderBusinessDelegate {

	 private static Logger logger =
Logger.getLogger(OrderBusinessDelegate.class);

	 private static OrderBusinessDelegate instance = null;

	 protected OrderBusinessDelegate() {
		 super();
	 }

	 public static synchronized OrderBusinessDelegate getInstance() {
		 if (instance == null) {
			 instance = new OrderBusinessDelegate();
		 }
		 return instance;
	 }


	 public int isPossible(){
		 return getProductDelegate().getOderByPno();
	 }

	 public String toString(){
		 return "OrderBusinessDelegate";
	 }

	 public ProductDelegate getProductDelegate(){
		 logger.debug("returning ProductDelegate");
		 return new ProductDelegate();
	 }
}
[/code]

MockOrderBusinessDeleate.java
[code]
package Order;

import org.apache.log4j.Logger;

public class MockOrderBusinessDelegate extends OrderBusinessDelegate {

	 private static Logger logger = Logger
			 .getLogger(MockOrderBusinessDelegate.class);

	 private static MockOrderBusinessDelegate instance = null;

	 private MockOrderBusinessDelegate() {
		 logger.debug("MockOrderBusinessdelegate is instanciated");
	 }

	 public static synchronized OrderBusinessDelegate getInstance() {
		 if (instance == null) {
			 instance = new MockOrderBusinessDelegate();
		 }
		 return instance;
	 }

	 public ProductDelegate getProductDelegate() {
		 logger.debug("returning MockProductDelegate");
		 return new MockProductDelegate();
	 }

	 public String toString(){
		 return "MockOrderBusinessDelegate";
	 }

}
[/code]

ProductDelegate.java
[code]
package Order;

import org.apache.log4j.Logger;

public class ProductDelegate {

	 private static Logger logger = Logger.getLogger(ProductDelegate.class);

	 public  int getOderByPno() {
		 logger.debug("getOrderByPno from ProductDelegate");
		 return 1;
	 }

}
[/code]

MockProductDelegate.java
[code]
package Order;

import org.apache.log4j.Logger;

import sun.awt.motif.MPopupMenuPeer;
import sun.security.jca.GetInstance;

public class MockProductDelegate  extends ProductDelegate{

	 private static Logger logger =
Logger.getLogger(MockProductDelegate.class);


	 public  int getOderByPno() {
		 logger.debug("getOrderByPno from MockProductDelegate");
		 return 10;
	 }
}
[/code]

#19428 From: "hperryman" <heath@...>
Date: Wed Jun 6, 2007 8:45 pm
Subject: Re: "No tests found" failures in Ant but not Eclipsee a
hperryman
Send Email Send Email
 
Here is the part of the script that seems relevant, can you see
anything that I'm missing?

Thanks very much for your help!!!

Heath


<property name="project1.tests" location="test" />
<property name="project1.junit.results" location="junit" />
<property name="project1.junit.results.xml" location="junit/xml" />
.
.
.
<target name="build-and-test">
.
.
    <junit dir="../WorkingDir" printsummary="yes">
       <classpath refid="junit.classpath" />
       <env key="PATH" path="${java.library.path}:${win32.libs}" />
       <formatter type="xml" />
       <batchtest fork="yes" todir="${project1.junit.results.xml}">
          <fileset dir="${project1.tests}">
             <include name="**/*.java" />
          </fileset>
       </batchtest>
    </junit>
</target>


--- In junit@yahoogroups.com, "Lasse Koskela" <lasse.koskela@...> wrote:
>
> Hi Heath,
>
> A lot of people write "helper classes for testing" and they put them
> into what you have labeled "/test" source tree. I suspect that your
> Ant script has something crooked--could you post the <target/> where
> the exception is coming from?
>
> Lasse
>
> --
> Lasse Koskela
> * Author of "Test Driven" (Manning Publications, 2007) *

#19429 From: "Lasse Koskela" <lasse.koskela@...>
Date: Wed Jun 6, 2007 9:34 pm
Subject: Re: Re: "No tests found" failures in Ant but not Eclipsee a
lassekoskela
Send Email Send Email
 
Hello Heath,

Could you still list the contents of this classpath entry:

     <classpath refid="junit.classpath" />

In order for Ant's JUnit task to see all the necessary code, that classpath
must point to both production and test source trees.

Other than that, I cannot spot what else could be the culprit. Maybe someone
else has more fresh pair of eyes than myself?

Lasse

--
Lasse Koskela
* Author of "Test Driven" (Manning Publications, 2007) *

On 6/6/07, hperryman <heath@...> wrote:
>
>   Here is the part of the script that seems relevant, can you see
> anything that I'm missing?
>
> Thanks very much for your help!!!
>
> Heath
>
> <property name="project1.tests" location="test" />
> <property name="project1.junit.results" location="junit" />
> <property name="project1.junit.results.xml" location="junit/xml" />
> .
> .
> .
> <target name="build-and-test">
> .
> .
> <junit dir="../WorkingDir" printsummary="yes">
> <classpath refid="junit.classpath" />
> <env key="PATH" path="${java.library.path}:${win32.libs}" />
> <formatter type="xml" />
> <batchtest fork="yes" todir="${project1.junit.results.xml}">
> <fileset dir="${project1.tests}">
> <include name="**/*.java" />
> </fileset>
> </batchtest>
> </junit>
> </target>
>
> --- In junit@yahoogroups.com <junit%40yahoogroups.com>, "Lasse Koskela" <
> lasse.koskela@...> wrote:
> >
> > Hi Heath,
> >
> > A lot of people write "helper classes for testing" and they put them
> > into what you have labeled "/test" source tree. I suspect that your
> > Ant script has something crooked--could you post the <target/> where
> > the exception is coming from?
> >
> > Lasse
> >
> > --
> > Lasse Koskela
> > * Author of "Test Driven" (Manning Publications, 2007) *
>
>
>


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

#19430 From: "p_thanuja82" <p_thanuja82@...>
Date: Thu Jun 7, 2007 8:43 am
Subject: With out changing the excepted value in my code regularly
p_thanuja82
Send Email Send Email
 
Hi All,

       In my test cases the excepted value will be changing
frequently.so that i have to in to my code and have to change the
excepted value.

       Instead of doing this is there any way that I need not to change
the value in the source code.Please anybody clarify this problem.

Thanks & Regards,
Thanuja

#19431 From: "p_thanuja82" <p_thanuja82@...>
Date: Thu Jun 7, 2007 5:06 am
Subject: With out changing the excepted value in my code regularly
p_thanuja82
Send Email Send Email
 
Hi All,

        In my test case the excepted value will be changed frequently.
so I have to change my excepted data each and every time in my code. I
dont want to go in to my code and change the excepted data.

        Instead of doing this, I want to get the data with out changing
it every time. Please suggest me any other methods with out changing
the excepted data in my code.

Thanks & Regards,
Thanuja.

Messages 19402 - 19431 of 24387   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