This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Succeeding with AI and have Veljko Krunic on-line!
See this thread for details.
Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Micky Morgan

Greenhorn
+ Follow
since Sep 20, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Micky Morgan

I have deployed a web application on WebSphere 6.0.2.
There is a jar file in our webapp which conflicts with WebSphere's jar file of _same_ name. Meaning, if we replace WebSphere's jar file with our jar file, the application works OK.

If I do that, it affects every other web application which I want to avoid by any means.

Is there anyway to set it using WebSphere' Admin Console or whereever...so that my webapp uses my jar file for my web application?

Any help is appreciated...
13 years ago
Thanks to Purushothaman and Paul for prompt responses...

The reason why the above expresions ( //table/input[1] ) did not work because ... table is not immediate parent of input tag as can be seen above...

So the correct XPtah expression that worked for me is..//table/th[2]/input[@title='Expand Folder']

or

//th[2]/input[@title='Expand Folder']


Thanks again for the help...
Thanks for the prompt response..but unfortunately none of the optios working..

I am actually clicking (thru automation) the image whether it opens or not..
for that I am using syntax like this...

obj.click("//input[@title='Expand Folder']; --> Always clicks Folder_A..

I tried the above options, it returns null (meaning not found)

I think the best option is to try with text since the text is unique..but that also does not work for me..

click("//input[@title='Expand Folder']/text()='Folder_B") ???

Please suggest the XPath expression that matches Folder_B...

Thanks
Hi,

Could anyone help me in locating the title of the second input tag in the below sample xml document...

I was trying to use //input[@title='Expand Folder'] and it always points to the first input tag...I want to get the second input tag..

I was also trying this which did not work //table/input[1][@title='Expand Folder']

Please note that I can't use names (eg: @name='wcf3ecfcf5c') since they are dynamically generated...

Could any one help me writing the Xpath expression that gets the second input tag...


<html>
.
.


<table

<th><input title="Expand Folder" name="wcf407a583c" src="/testapp/table/expand.gif" type="image">
<input disabled="true" name="wcf3ecfcf5c" type="hidden"><span class="zoom">Folder_A</span>
</th>

<th><input title="Expand Folder" name="wcf947a9541" src="/testapp/table/expand.gif" type="image">
<input disabled="true" name="wcf2f7dc902" type="hidden"><span class="zoom">Folder_B</span>
</th>

</table>

.
.
</html>

Thanks in advance...
Thanks to Ulf Dittmer and others for your help. After changing <arg> tag with <test> tag, it started working...

Thanks again...
13 years ago
Here is my junit task...

<target name="run" description="Run the jar file">
<junit fork="yes" printsummary="yes" haltonfailure="yes" >

<arg value="com.acme.MyTester"/>
<sysproperty key="loginname" value="admin" />
<sysproperty key="password" value="admin" />

<formatter type="xml" />
<classpath refid="ccp" />
</junit>

</target>
13 years ago
Thanks fpr your responses...Could you please elaborate with detailed responses....I am finding hard time to get it work using junit ant task...an example would be of very helpful...

Thanks in advance...
13 years ago
Could any one please help me how to run jar file using junit task. To be more precise, how could I convert (the below java ant task runs OK) to JUnit ant task.

I am currently using Ant 1.6.5 and JUnit 4.1. The reason, I want to run this as Junit because, I want to create HTML reports which is possible only if I use JUnit Task...

Note that com.acme.MyTester.class is inside of MyTester.jar file. My Classpath included this jar file...

<target name="run" description="Run the jar file">
<java classname="org.junit.runner.JUnitCore" fork="yes" >

<arg value="com.acme.MyTester"/>

<sysproperty key="loginname" value="admin" />
<sysproperty key="password" value="admin" />

<classpath refid="ccp" />
</java>

</target>
13 years ago
Hi,

I am having trouble creating JUnit Report using Ant

My Env: Java 1.5/Ant 1.6.5/Junit 4.1

The below summary shows that 2 Tests Passed...but the actual JUnit report says that both tetss Failed. Looks very wierd. Could anyone please help me to figureout the issue. I have noticed that I saw com.acme.MyTester has no methods to run ??? But it does have 2 tests and hence OK (2 tests)

*************
JUNIT summary
*************

init:

compile:
[javac] Compiling 1 source file to C:\UnitTests

Create_Jar:
[jar] Building jar: C:\UnitTests\JUnitTester.jar
Run:
[java] JUnit version 4.1
[java] ..
[java] Time: 6.406

[java] OK (2 tests)


Create_Report:
[echo] Running unit tests...
[junit] Running com.acme.MyTester
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.031 sec
[junit] Test com.acme.MyTester FAILED
[junit] Running com.acme.MyTester
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.031 sec
[junit] Test com.acme.MyTester FAILED
[junitreport] Transform time: 734ms

Here is the skeleton of my JUnit Tester...

*************
JUNIT Tester
*************


package com.acme;
import org.junit.*;

public class MyTester{


public void setUp() {
}

public void tearDown() {
}


public void testA() throws Throwable {

System.out.println("from testA");

}

public void testB() throws Throwable {

System.out.println("from testB");

}

}



*************
Ant Script
*************


Here is the skeleton of Ant build.xml to run and create JUnit Report for the above Tester


<project default="usage">

<target name="init">

<property name="Base.Dir" value="."/>
<property name="test.reports" value="./reports" />

<path id="ccp" description="The CLASSPATH for compiling and running">
<pathelement location="${Base.Dir}\JUnitTester.jar" />
<pathelement location="${Base.Dir}\junit-4.1.jar" />
<pathelement location="." />
</path>

</target>

<target name="compile" depends="init">
<javac srcdir="${Base.Dir}\source" includes="*.java" destdir="${Base.Dir}\source\" includeAntRuntime="no" fork="yes" debug="on">
<classpath refid="ccp" />
</javac>
</target>

<target name="Create_Jar" depends="compile">
<jar destfile="${Base.Dir}\source\JUnitTest.jar"
basedir="${Base.Dir}\source"
includes="**/*.class"
/>
</target>

<target name="Run" depends="Create_Jar" description="Run the jar file">
<java classname="org.junit.runner.JUnitCore" fork="yes" >
<arg value="com.acme.MyTester"/>
<classpath refid="ccp" />
</java>
</target>

<target name="Create_Report" depends="Run">

<echo message="Running unit tests... "/>

<junit printsummary="yes" haltonfailure="no">
<batchtest fork="yes">
<fileset dir="${Base.Dir}\source">
<include name="**/*.class" />
</fileset>
</batchtest>
<formatter type="xml" />
<classpath refid="ccp" />
</junit>


<!-- generate test report -->

<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}"/>
</junitreport>

</target>
</project>
[ November 20, 2006: Message edited by: Micky Morgan ]
13 years ago
Sure, My reports folder do contain TESTS-TestSuites.xml file created by JUNIT. The contenst of this file is:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuites></testsuites>

13 years ago
Jeanne,

I have chnaged back to Ant 1.6.5, Still unsuccessful. Do you think that JUNIT tester has some suites and some tetsts are added to the suite? Note that I have don't have any suite ..All my tests are individual and run as

<target name="run" depends="prev_target">
<java classname="org.junit.runner.JUnitCore" fork="yes" >
<arg value="com.thoughtworks.selenium.QATester"/>
13 years ago
Can anyone help please?
13 years ago
For some reason, My ant task is not creating JUNIT's HTML reports? Here are the details..

1) It creates C:\reports directory. It contains some html files including index.html. if I open this HTML file,. it shows zero tests as below. But actually it runs 2 tests successfully. Could you see any problem?

Tests Failures Errors Success rate Time

0 0 0 NaN 0.000


It also creates TESTS-TestSuites.xml. But this xml file is emty

I am using JUNIT 4.1, Ant 1.7 Beta and Java 1.5

Here is the snippet of my ant build script. Note that on my command window, I could see that "OK (2 tests)"...but why it is not writing this to HTML report. When I open the

My Ant Task:
============
------------------------------------
<target name="report" depends="run">
<junitreport todir="./reports">
<fileset dir="reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./reports"/>
</junitreport>
</target>
-----------------------------------------


Command promt details:
=====================

C:\>ant -f build.xml run
Buildfile: build.xml

init:

compile:
[javac] Compiling 1 source file to C:\java\source\test\java

update:
[jar] Building jar: C:\java\java-client-driver-tests.
jar

run:
[java] JUnit version 4.1
[java] ..
[java] Time: 12.86

[java] OK (2 tests)


report:
[junitreport] Processing C:\reports\TESTS-TestSuites.xml to C:\DOCUM
E~1\micky\LOCALS~1\Temp\null82112573
[junitreport] Loading stylesheet jar:file:/C:/ant1.7.0/lib/ant-junit.jar!/org/ap
ache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 1281ms
[junitreport] Deleting: C:\DOCUME~1\micky\LOCALS~1\Temp\null82112573


BUILD SUCCESSFUL
Total time: 23 seconds
13 years ago
Thanks Joy and Carol. Both of your suggestions works for me.
13 years ago
I would run my JUnit tester like

java -classpath %CLASSPATH% -Dhostname=jetty -Dport=8080 org.junit.runner.JUnitCore com.thoughtworks.selenium.QATester

How would I convert this as ant script? the below script is not working at all. It shows hostnae and port as null???
----------------------
<target name="run" depends="start">
<java classname="org.junit.runner.JUnitCore">
<arg value="com.thoughtworks.selenium.Jasper"/>
<jvmarg value="-Dhostname=jetty"/>
<jvmarg value="-Dport=8080"/>


<classpath>
<pathelement location="C:\Selenium-RC\java\junit-4.1.jar"/>
<pathelement location="C:\Selenium-RC\java\b.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
13 years ago