[Webtest] Change to display test file name and line in reports

Marc Guillemot webtest@lists.canoo.com
Fri, 26 Sep 2003 08:52:20 +0200

This is a multi-part message in MIME format.
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit


attached is a patch to generate the exact location of the <testSpec> tag in the 
xml report. The small change I proposed previously required less changes but was 
not precise enough, particularly in the case where the first step is included 
using an entity.

   endtime="Thu Sep 25 15:59:45 CEST 2003"
   starttime="Thu Sep 25 15:58:50 CEST 2003"
   successful="yes" testspecname="front mainpage links">

This additional attribute in the testResults.xml needs to be transformed by the 
xslt. Perhaps would it be interesting to provide more than one xslt. The user 
could choose which one they want to adapt for their own reports. For instance 
mine (still evolving), adapted from the Canoo original version that existed a 
few months ago, now generates a global report summary and a separated report 
page for each test. This was necessary, as the size of the file growed too fast 
with the number of webtests.

Mittie, is it possible to have a commiter access?


Dierk Koenig wrote:
> Hi Marc,
> thanx for the contribution.
> The file reference is currently only reported in the error case.
> I agree that it is also usefull for the general case.
> cheers
> Mittie
>>-----Original Message-----
>>From: webtest-admin@lists.canoo.com
>>[mailto:webtest-admin@lists.canoo.com]On Behalf Of Marc Guillemot
>>Sent: Mittwoch, 24. September 2003 17:35
>>To: webtest@gate.canoo.com
>>Subject: [Webtest] Change to display test file name and line in reports
>>I'm missing in the test reports an indication of the location of 
>>the test script 
>>(which file at which line). I think this is really usefull when 
>>the number of 
>>tests increases.
>>I've performed a small change in
>>com.canoo.webtest.reporting.addResultAttributes(Element resultElement)
>>(line 179 in build 365)
>>List steps = 
>>addNewAttribute(resultElement, "starttime", ((Step) 
>>List steps = 
>>Step firstStep = (Step) steps.get(0);
>>addNewAttribute(resultElement, "location", 
>>addNewAttribute(resultElement, "starttime", 
>>this allows to have in the xml file something like:
>>   endtime="Wed Sep 24 16:51:57 CEST 2003"
>>         starttime="Wed Sep 24 16:51:51 CEST 2003"
>>         successful="yes" testspecname="add contact to institution">
>>This is not exactly the location of the <testSpec> opening tag as 
>>it seems it 
>>would need more changes to the current code, but it allows 
>>already to get an 
>>information on the location that can be formatted by the xslt.
>>WebTest mailing list
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest

Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;

Index: canoo/webtest/ant/TestSpecificationTask.java
RCS file: /repositories/cvs/public/webtest/src/com/canoo/webtest/ant/TestSpecificationTask.java,v
retrieving revision 1.27
diff -r1.27 TestSpecificationTask.java
> 		webTestResult.setSourceLocation(getLocation());
Index: canoo/webtest/engine/ResultInfo.java
RCS file: /repositories/cvs/public/webtest/src/com/canoo/webtest/engine/ResultInfo.java,v
retrieving revision 1.2
diff -r1.2 ResultInfo.java
> import org.apache.tools.ant.Location;
> 	private Location sourceLocation_ = Location.UNKNOWN_LOCATION;
> 	/**
> 	 * Gets the location of the source of the test script 
> 	 */
> 	public Location getSourceLocation()
> 	{
> 		return sourceLocation_;
> 	}
> 	/**
> 	 * Sets the location of the source of the test script 
> 	 */
> 	public void setSourceLocation(Location _location)
> 	{
> 		sourceLocation_ = _location;
> 	}
Index: canoo/webtest/reporting/XmlResultConverter.java
RCS file: /repositories/cvs/public/webtest/src/com/canoo/webtest/reporting/XmlResultConverter.java,v
retrieving revision 1.14
diff -r1.14 XmlResultConverter.java
> 		addNewAttribute(resultElement, "location", fResult.getSourceLocation().toString());