You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Marcus <ma...@criticalpointsoftware.com> on 2001/12/27 01:37:34 UTC

junit specify system properties

HI,

I have the following in my code:
    <junit printsummary="yes" fork="yes" haltonfailure="no">
      <jvmarg value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties  "/>
      <classpath>
        <fileset dir="${java_deploy_dir}/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${JLIB}">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <formatter type="xml" />
      <test name="cp_test.system.TestSubmitQueryMThread" />
    </junit>

but i want not only to pass a property file but the code needs additional parameters pass to it, that meaning our code.

cp_test.system.TestSubmitQueryMThread -Dmdb.properties.file=mdb.testsubmitqueryMthread.properties minitest questionsfile answerfile 1  

Question: how doe sone pass more args in using junit?

Thanks
-mez

Re: junit specify system properties

Posted by Marcus <ma...@criticalpointsoftware.com>.
ok, i got it so it now accepts the parameters, but:
Cannot instantiate test case: testSubmitQueryMThread

junit.framework.AssertionFailedError: Cannot instantiate test case:
testSubmitQueryMThread
at junit.framework.Assert.fail(Assert.java:143)
at junit.framework.TestSuite$1.runTest(TestSuite.java:178)
at junit.framework.TestCase.runBare(TestCase.java:129)
at junit.framework.TestResult$1.protect(TestResult.java:100)
at junit.framework.TestResult.runProtected(TestResult.java:117)
at junit.framework.TestResult.run(TestResult.java:103)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.run(TestSuite.java:144)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:231)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:409)

thx
-mez
----- Original Message -----
From: "Erik Hatcher" <ja...@ehatchersolutions.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 6:13 PM
Subject: Re: junit specify system properties


> As I've mentioned to you in private mail, you're example is way too
> convoluted to make much sense out of it.  Please try and simplify it down
to
> a barebones test case that gets a property from System.getProperty and
uses
> that as a filename.  Create a contrived example that will eliminate all
your
> domain specific property names and post what you have back for us if you
> still have issues.
>
> Typically the act of creating a contrived working example will shed light
on
> the actual problem though.
>
> More comments below....
>
> >       <sysproperty key="mdb.properties.file1"
> > value="mdb.properties.file1.properties"/>
>
> Ok, so you've got this set and being fed into JUnit...
>
> > i have a file mdb.properties.file1.properties that has teh following
line:
> > minitest QUESTIONFILE_minimetanet questionfile 1
>
> Ok, again we're getting convoluted here... simplify!
>
> > here is the output:
> > which are parameters that i pass in for my unit test.
> >     [junit] Running cp_test.system.TestSubmitQueryMThread
> >     [junit] Executing:
> > p:\thirdparty\win32\runnable\jdk\13\jre\..\bin\java.exe -
> >
>
Dmdb.properties.file=mdb.testsubmitqueryMthread.properties -Dmdb.properties.
> > file
> > 1=mdb.properties.file1.properties
>
> Ok, you can clearly see that your property is being sent into Ant's
> JUnitTestRunner.
>
> >     [junit] TEST cp_test.system.TestSubmitQueryMThread FAILED
>
> So the failure is in your test case from what your output is showing.
> Without seeing those details (and we don't need to see them if you create
a
> trivial example showing the problem) we can't tell why its failing.
>
> > BUILD SUCCESSFUL
>
> And *never ever* let a build finish successfully if tests failed!!!!!  :))
>
>     Erik
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: junit specify system properties

Posted by Marcus <ma...@criticalpointsoftware.com>.
Erik,

Thanks for the help it is useful to start with a simple set of instructions.

I did do that and still see the same problem.

As far and the build success I still haven't put in the check for failure on
tests, but will do
as soon as I get this running.

-mez
----- Original Message -----
From: "Erik Hatcher" <ja...@ehatchersolutions.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 6:13 PM
Subject: Re: junit specify system properties


> As I've mentioned to you in private mail, you're example is way too
> convoluted to make much sense out of it.  Please try and simplify it down
to
> a barebones test case that gets a property from System.getProperty and
uses
> that as a filename.  Create a contrived example that will eliminate all
your
> domain specific property names and post what you have back for us if you
> still have issues.
>
> Typically the act of creating a contrived working example will shed light
on
> the actual problem though.
>
> More comments below....
>
> >       <sysproperty key="mdb.properties.file1"
> > value="mdb.properties.file1.properties"/>
>
> Ok, so you've got this set and being fed into JUnit...
>
> > i have a file mdb.properties.file1.properties that has teh following
line:
> > minitest QUESTIONFILE_minimetanet questionfile 1
>
> Ok, again we're getting convoluted here... simplify!
>
> > here is the output:
> > which are parameters that i pass in for my unit test.
> >     [junit] Running cp_test.system.TestSubmitQueryMThread
> >     [junit] Executing:
> > p:\thirdparty\win32\runnable\jdk\13\jre\..\bin\java.exe -
> >
>
Dmdb.properties.file=mdb.testsubmitqueryMthread.properties -Dmdb.properties.
> > file
> > 1=mdb.properties.file1.properties
>
> Ok, you can clearly see that your property is being sent into Ant's
> JUnitTestRunner.
>
> >     [junit] TEST cp_test.system.TestSubmitQueryMThread FAILED
>
> So the failure is in your test case from what your output is showing.
> Without seeing those details (and we don't need to see them if you create
a
> trivial example showing the problem) we can't tell why its failing.
>
> > BUILD SUCCESSFUL
>
> And *never ever* let a build finish successfully if tests failed!!!!!  :))
>
>     Erik
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: junit specify system properties

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
As I've mentioned to you in private mail, you're example is way too
convoluted to make much sense out of it.  Please try and simplify it down to
a barebones test case that gets a property from System.getProperty and uses
that as a filename.  Create a contrived example that will eliminate all your
domain specific property names and post what you have back for us if you
still have issues.

Typically the act of creating a contrived working example will shed light on
the actual problem though.

More comments below....

>       <sysproperty key="mdb.properties.file1"
> value="mdb.properties.file1.properties"/>

Ok, so you've got this set and being fed into JUnit...

> i have a file mdb.properties.file1.properties that has teh following line:
> minitest QUESTIONFILE_minimetanet questionfile 1

Ok, again we're getting convoluted here... simplify!

> here is the output:
> which are parameters that i pass in for my unit test.
>     [junit] Running cp_test.system.TestSubmitQueryMThread
>     [junit] Executing:
> p:\thirdparty\win32\runnable\jdk\13\jre\..\bin\java.exe -
>
Dmdb.properties.file=mdb.testsubmitqueryMthread.properties -Dmdb.properties.
> file
> 1=mdb.properties.file1.properties

Ok, you can clearly see that your property is being sent into Ant's
JUnitTestRunner.

>     [junit] TEST cp_test.system.TestSubmitQueryMThread FAILED

So the failure is in your test case from what your output is showing.
Without seeing those details (and we don't need to see them if you create a
trivial example showing the problem) we can't tell why its failing.

> BUILD SUCCESSFUL

And *never ever* let a build finish successfully if tests failed!!!!!  :))

    Erik




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: junit specify system properties

Posted by Marcus <ma...@criticalpointsoftware.com>.
it isn't working. porbably still don't understand:

here is what I have:
    <junit printsummary="yes" fork="yes" haltonfailure="no">
      <!-- <jvmarg
value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties"/> -->
      <sysproperty key="mdb.properties.file"
value="mdb.testsubmitqueryMthread.properties"/>
      <sysproperty key="mdb.properties.file1"
value="mdb.properties.file1.properties"/>
       <classpath>
        <fileset dir="${java_deploy_dir}/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${JLIB}">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <formatter type="xml" />
     <test name="cp_test.system.TestSubmitQueryMThread" />
    </junit>

i have a file mdb.properties.file1.properties that has teh following line:
minitest QUESTIONFILE_minimetanet questionfile 1

here is the output:
which are parameters that i pass in for my unit test.
    [junit] Running cp_test.system.TestSubmitQueryMThread
    [junit] Executing:
p:\thirdparty\win32\runnable\jdk\13\jre\..\bin\java.exe -
Dmdb.properties.file=mdb.testsubmitqueryMthread.properties -Dmdb.properties.
file
1=mdb.properties.file1.properties -classpath
P:\thirdparty\jvm\ant\lib\junit.jar
;P:\thirdparty\jvm\ant\lib\ant.jar;P:\thirdparty\jvm\ant\lib\jakarta-ant-1.4
.1-o
ptional.jar;P:\cpdev\main\src\html\prototype\WEB-INF\lib\log4j.jar;P:\cpdev\
main
\src\html\prototype\WEB-INF\lib\mdb.jar;P:\cpdev\main\src\html\prototype\WEB
-INF
\lib\mdb_tests.jar;P:\cpdev\main\src\html\prototype\WEB-INF\lib\mysqlJdbcDri
ver.
jar;P:\cpdev\main\src\html\prototype\WEB-INF\lib\saxon.jar;P:\cpdev\main\bui
ld\l
ib\FTKAudio.jar;P:\cpdev\main\build\lib\FTKTTSLV.jar;P:\cpdev\main\build\lib
\FTK
TTSSV.jar;P:\cpdev\main\build\lib\FTKUtils.jar;P:\cpdev\main\build\lib\httpu
nit.
jar;P:\cpdev\main\build\lib\j2ee.jar;P:\cpdev\main\build\lib\jdeps.jar;P:\cp
dev\
main\build\lib\junit.jar;P:\cpdev\main\build\lib\log4j.jar;P:\cpdev\main\bui
ld\l
ib\mysqlJdbcDriver.jar;P:\cpdev\main\build\lib\saxon.jar;P:\cpdev\main\build
\lib
\xalan.jar;P:\cpdev\main\build\lib\xerces.jar
org.apache.tools.ant.taskdefs.opti
onal.junit.JUnitTestRunner cp_test.system.TestSubmitQueryMThread
haltOnError=fal
se haltOnFailure=false
formatter=org.apache.tools.ant.taskdefs.optional.junit.Su
mmaryJUnitResultFormatter
formatter=org.apache.tools.ant.taskdefs.optional.junit
.XMLJUnitResultFormatter,P:\cpdev\main\src\TEST-cp_test.system.TestSubmitQue
ryMT
hread.xml propsfile=p:\cpdev\main\src\junit287580240072358566.properties
    [junit] Logging level set to: DEBUG
    [junit] Log tracing ENABLED
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.13 sec
    [junit] TEST cp_test.system.TestSubmitQueryMThread FAILED
[junitreport] Parsing file:
'P:\cpdev\main\src\TEST-cp_test.system.TestSubmitQue
ryMThread.xml'
[junitreport] Using Xalan version: 2.0_D07
[junitreport] Transform time: 1102ms

BUILD SUCCESSFUL

Sorry I don't understand.

-mez


----- Original Message -----
From: "Erik Hatcher" <ja...@ehatchersolutions.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 5:35 PM
Subject: Re: junit specify system properties


> Yup, thats what I meant.... and your test case would read the file with
the
> filename it gets from System.getProperty("mdb.properties.file1")
>
>     Erik
>
>
> ----- Original Message -----
> From: "Marcus" <ma...@criticalpointsoftware.com>
> To: "Ant Users List" <an...@jakarta.apache.org>
> Sent: Wednesday, December 26, 2001 8:34 PM
> Subject: Re: junit specify system properties
>
>
> > Is this what you mean?
> >
> >    <junit printsummary="yes" fork="yes" haltonfailure="no">
> >       <!-- <jvmarg
> >
value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties"/> -->
> >       <sysproperty key="mdb.properties.file"
> > value="mdb.testsubmitqueryMthread.properties"/>
> >       <sysproperty key="mdb.properties.file1" value="minitest"/>
> >
> > where minitest is a file with:
> > minitest questionsfile answerfile 1?
> >
> >
> > ----- Original Message -----
> > From: "Erik Hatcher" <ja...@ehatchersolutions.com>
> > To: "Ant Users List" <an...@jakarta.apache.org>
> > Sent: Wednesday, December 26, 2001 4:59 PM
> > Subject: Re: junit specify system properties
> >
> >
> > > Use <sysproperty> rather than <jvmarg>.
> > >
> > > <junit...>
> > > ...
> > >     <sysproperty key="mdb.properties.file" value="...."/>
> > > ...
> > > </junit>
> > >
> > > You can specify as many <sysproperty>'s as you need.
> > >
> > >     Erik
> > >
> > > ----- Original Message -----
> > > From: "Marcus" <ma...@criticalpointsoftware.com>
> > > To: "Ant Users List" <an...@jakarta.apache.org>
> > > Sent: Wednesday, December 26, 2001 7:37 PM
> > > Subject: junit specify system properties
> > >
> > >
> > > HI,
> > >
> > > I have the following in my code:
> > >     <junit printsummary="yes" fork="yes" haltonfailure="no">
> > >       <jvmarg
> > > value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties
"/>
> > >       <classpath>
> > >         <fileset dir="${java_deploy_dir}/lib">
> > >           <include name="*.jar"/>
> > >         </fileset>
> > >         <fileset dir="${JLIB}">
> > >           <include name="*.jar"/>
> > >         </fileset>
> > >       </classpath>
> > >       <formatter type="xml" />
> > >       <test name="cp_test.system.TestSubmitQueryMThread" />
> > >     </junit>
> > >
> > > but i want not only to pass a property file but the code needs
> additional
> > > parameters pass to it, that meaning our code.
> > >
> > >
> >
>
cp_test.system.TestSubmitQueryMThread -Dmdb.properties.file=mdb.testsubmitqu
> > > eryMthread.properties minitest questionsfile answerfile 1
> > >
> > > Question: how doe sone pass more args in using junit?
> > >
> > > Thanks
> > > -mez
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: junit specify system properties

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Yup, thats what I meant.... and your test case would read the file with the
filename it gets from System.getProperty("mdb.properties.file1")

    Erik


----- Original Message -----
From: "Marcus" <ma...@criticalpointsoftware.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 8:34 PM
Subject: Re: junit specify system properties


> Is this what you mean?
>
>    <junit printsummary="yes" fork="yes" haltonfailure="no">
>       <!-- <jvmarg
> value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties"/> -->
>       <sysproperty key="mdb.properties.file"
> value="mdb.testsubmitqueryMthread.properties"/>
>       <sysproperty key="mdb.properties.file1" value="minitest"/>
>
> where minitest is a file with:
> minitest questionsfile answerfile 1?
>
>
> ----- Original Message -----
> From: "Erik Hatcher" <ja...@ehatchersolutions.com>
> To: "Ant Users List" <an...@jakarta.apache.org>
> Sent: Wednesday, December 26, 2001 4:59 PM
> Subject: Re: junit specify system properties
>
>
> > Use <sysproperty> rather than <jvmarg>.
> >
> > <junit...>
> > ...
> >     <sysproperty key="mdb.properties.file" value="...."/>
> > ...
> > </junit>
> >
> > You can specify as many <sysproperty>'s as you need.
> >
> >     Erik
> >
> > ----- Original Message -----
> > From: "Marcus" <ma...@criticalpointsoftware.com>
> > To: "Ant Users List" <an...@jakarta.apache.org>
> > Sent: Wednesday, December 26, 2001 7:37 PM
> > Subject: junit specify system properties
> >
> >
> > HI,
> >
> > I have the following in my code:
> >     <junit printsummary="yes" fork="yes" haltonfailure="no">
> >       <jvmarg
> > value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties  "/>
> >       <classpath>
> >         <fileset dir="${java_deploy_dir}/lib">
> >           <include name="*.jar"/>
> >         </fileset>
> >         <fileset dir="${JLIB}">
> >           <include name="*.jar"/>
> >         </fileset>
> >       </classpath>
> >       <formatter type="xml" />
> >       <test name="cp_test.system.TestSubmitQueryMThread" />
> >     </junit>
> >
> > but i want not only to pass a property file but the code needs
additional
> > parameters pass to it, that meaning our code.
> >
> >
>
cp_test.system.TestSubmitQueryMThread -Dmdb.properties.file=mdb.testsubmitqu
> > eryMthread.properties minitest questionsfile answerfile 1
> >
> > Question: how doe sone pass more args in using junit?
> >
> > Thanks
> > -mez
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: junit specify system properties

Posted by Marcus <ma...@criticalpointsoftware.com>.
Is this what you mean?

   <junit printsummary="yes" fork="yes" haltonfailure="no">
      <!-- <jvmarg
value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties"/> -->
      <sysproperty key="mdb.properties.file"
value="mdb.testsubmitqueryMthread.properties"/>
      <sysproperty key="mdb.properties.file1" value="minitest"/>

where minitest is a file with:
minitest questionsfile answerfile 1?


----- Original Message -----
From: "Erik Hatcher" <ja...@ehatchersolutions.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 4:59 PM
Subject: Re: junit specify system properties


> Use <sysproperty> rather than <jvmarg>.
>
> <junit...>
> ...
>     <sysproperty key="mdb.properties.file" value="...."/>
> ...
> </junit>
>
> You can specify as many <sysproperty>'s as you need.
>
>     Erik
>
> ----- Original Message -----
> From: "Marcus" <ma...@criticalpointsoftware.com>
> To: "Ant Users List" <an...@jakarta.apache.org>
> Sent: Wednesday, December 26, 2001 7:37 PM
> Subject: junit specify system properties
>
>
> HI,
>
> I have the following in my code:
>     <junit printsummary="yes" fork="yes" haltonfailure="no">
>       <jvmarg
> value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties  "/>
>       <classpath>
>         <fileset dir="${java_deploy_dir}/lib">
>           <include name="*.jar"/>
>         </fileset>
>         <fileset dir="${JLIB}">
>           <include name="*.jar"/>
>         </fileset>
>       </classpath>
>       <formatter type="xml" />
>       <test name="cp_test.system.TestSubmitQueryMThread" />
>     </junit>
>
> but i want not only to pass a property file but the code needs additional
> parameters pass to it, that meaning our code.
>
>
cp_test.system.TestSubmitQueryMThread -Dmdb.properties.file=mdb.testsubmitqu
> eryMthread.properties minitest questionsfile answerfile 1
>
> Question: how doe sone pass more args in using junit?
>
> Thanks
> -mez
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: junit specify system properties

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Use <sysproperty> rather than <jvmarg>.

<junit...>
...
    <sysproperty key="mdb.properties.file" value="...."/>
...
</junit>

You can specify as many <sysproperty>'s as you need.

    Erik

----- Original Message -----
From: "Marcus" <ma...@criticalpointsoftware.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 7:37 PM
Subject: junit specify system properties


HI,

I have the following in my code:
    <junit printsummary="yes" fork="yes" haltonfailure="no">
      <jvmarg
value="-Dmdb.properties.file=mdb.testsubmitqueryMthread.properties  "/>
      <classpath>
        <fileset dir="${java_deploy_dir}/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${JLIB}">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <formatter type="xml" />
      <test name="cp_test.system.TestSubmitQueryMThread" />
    </junit>

but i want not only to pass a property file but the code needs additional
parameters pass to it, that meaning our code.

cp_test.system.TestSubmitQueryMThread -Dmdb.properties.file=mdb.testsubmitqu
eryMthread.properties minitest questionsfile answerfile 1

Question: how doe sone pass more args in using junit?

Thanks
-mez



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>