I'm currently trying to integrate my testng reports to a Cruise
Control build results page.
I use a Ant task to run tests and convert to junit report. Conversion
fails on some xml files, due to prolog : character encoding is set to
UTF-8 but files actually require ISO-8859-1. Displayed error is :
"The file (file).xml is not a valid XML document. It is possibly
corrupted."
How can I change character encoding from ant task?
Some other files seem to be corrupted too : the file resuming failed
tests does not contain any prolog at all, only Doctype declaration.
What TestNG output are you using?
In terms of changing the file enconding in Ant is probably not a
question for this group, but here's a hint:
http://ant.apache.org/manual/CoreTasks/copy.html (property outputencoding)
Cosmin
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
<target name="tests.run">
<testng
outputDir="${testng.html.report}"
sourceDir="${project.work.dir}/build"
haltOnFailure="false">
<xmlfileset dir="${project.work.dir}/build" includes="testng.xml"/>
<classpath>
<path refid="tests.classpath"/>
</classpath>
</testng>
</target>
<target name="tests.junitreport">
<junitreport todir="${testng.xml.report}">
<fileset dir="${testng.html.report}">
<include name="*/*.xml"/>
<exclude name="*/testng-failed.xml"/>
</fileset>
<report format="noframes" todir="${testng.xml.report}"/>
</junitreport>
</target>
Since I still have not found a convenient solution, I have made a
little java class that parses the xml files generated by testng and
makes the necessary changes (encoding, message formatting...). So now,
the JUnit conversion works well but I still not see the tests results
in Cruise control status page (under "Test results" tab)...
But at this point I don't know if it's a Cruise control or TestNG
issue...
On Mar 17, 2:11 pm, Cédric Beust ♔ <cbe...@google.com> wrote:
> Hi Pef,
>
> Which files are you referring to, testng-results.xml?
>
> --
> Cedric
>
>
>
> On Wed, Mar 17, 2010 at 1:50 AM, Pef <src...@wanadoo.fr> wrote:
> > Hi all,
>
> > I'm currently trying to integrate my testng reports to a Cruise
> > Control build results page.
>
> > I use a Ant task to run tests and convert to junit report. Conversion
> > fails on some xml files, due to prolog : character encoding is set to
> > UTF-8 but files actually require ISO-8859-1. Displayed error is :
> > "The file (file).xml is not a valid XML document. It is possibly
> > corrupted."
>
> > How can I change character encoding from ant task?
>
> > Some other files seem to be corrupted too : the file resuming failed
> > tests does not contain any prolog at all, only Doctype declaration.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "testng-users" group.
> > To post to this group, send email to testng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
I'm not opposed to changing the encoding of these files from utf-8 to iso-8859-1 but I'm concerned about the consequences (I'm not exactly an expert in this area).
On Mar 17, 2:37 pm, Cédric Beust ♔ <cbe...@google.com> wrote:
> Fair enough.
>
> On a related issue: Pef, can you tell us exactly what fails and how?
>
> --
> Cedric
>
> On Wed, Mar 17, 2010 at 6:33 AM, Cosmin Marginean <cosmin...@gmail.com>wrote:
>
>
>
> > I am not 100% about the impact, but I am no encoding ninja either. I am
> > mostly worried about impact on existing code and I'm not even sure how are
> > we supposed to validate this.
> > I suggest the Ant copy stuff which *should* solve the encoding issue.
> >> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
If this helps the discussion, most of my test names are in Brazilian
Portuguese and I had remove all special characters (áéíçãõ etc)
because the HTML report was not using html entities too.
All of our projects use ISO-8859-1.
FK
2010/3/17 Cédric Beust ♔ <cbe...@google.com>:
On Mar 17, 2:47 pm, Cédric Beust ♔ <cbe...@google.com> wrote:
> Thanks for the precisions, Bill.
>
> I'm pretty sure the XML generated is well formed but I'm suspecting the
> original poster is using strings (test names maybe?) that contain characters
> that are not in the utf-8 range, hence my asking him exactly what was
> failing.
>
> It feels like iso-8859-1 would be a better default encoding but I'd like to
> make sure I won't be breaking any existing code before making this change.
>
> --
> Cedric
>
> On Wed, Mar 17, 2010 at 6:39 AM, Bill Michell
> <bill.mich...@googlemail.com>wrote:
> >> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
> > Bill Michell
> > billmich...@gmail.com
Sorry if I'm not clear enough.
What fails :
1/ JUnit-compliant conversion of TestNG reports : due to wrong UTF-8
encoding and some invalid characters in "messages" attributes (like
"<" or ">" in assertions results : "Expected <true> but was <false>")
2/ Reports integration in Cruise control status page (under "Test
results" tab)
Thanks for the precisions, Bill.I'm pretty sure the XML generated is well formed but I'm suspecting the original poster is using strings (test names maybe?) that contain characters that are not in the utf-8 range, hence my asking him exactly what was failing.
It feels like iso-8859-1 would be a better default encoding but I'd like to make sure I won't be breaking any existing code before making this change.
On 17 Mar 2010, at 13:47, Cédric Beust ♔ wrote:
Thanks for the precisions, Bill.I'm pretty sure the XML generated is well formed but I'm suspecting the original poster is using strings (test names maybe?) that contain characters that are not in the utf-8 range, hence my asking him exactly what was failing.Um - utf-8 includes representations for all the unicode character set, including characters that can't be expressed in 16 bits...
It feels like iso-8859-1 would be a better default encoding but I'd like to make sure I won't be breaking any existing code before making this change.I'd avoid this. If you aren't going to use standard XML writing routines, I'd go to US-ASCII and explicitly escape all characters above #x7F using a suitable escape sequence, plus < and "
tests.junitreport:
[junitreport] [Fatal Error] Test%20version-issue.xml:1:387: Invalid
byte 2 of 3-byte UTF-8 sequence.
[junitreport] The file C:\logiciels\CruiseControlTestProjects
\FORGES_SERVER\report\html\testng\FORGES_TESTS\Test version-issue.xml
is not a valid XML document. It is possibly corrupted.
[junitreport] Processing C:\logiciels\CruiseControlTestProjects
\FORGES_SERVER\report\xml\testng\TESTS-TestSuites.xml to C:\logiciels
\CruiseControlTestProjects\FORGES_SERVER\report\xml\testng\junit-
noframes.html
[junitreport] Loading stylesheet jar:file:/C:/logiciels/apache-
ant-1.7.0/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/
junit/xsl/junit-noframes.xsl
[junitreport] Transform time: 563ms
The fault file content (Test%20version-issue.xml) :
<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0"
failures="1" name="Test version-issue" tests="1"
time="0.266"><properties/><testcase
classname="test.web.TestVersionIssue" name="testGetNextVersionIssue"
time="0.109"><failure message="[file].properties (Le chemin d'accès
spécifié est introuvable)" type="java.io.FileNotFoundException"><!
[CDATA[java.io.FileNotFoundException: [file].properties (Le chemin
d'accès spécifié est introuvable)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
... Removed 21 stack frames]]></failure></testcase></testsuite>
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
> > testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
--Cédric--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
<?xml version="1.0" encoding="ISO-8859-1"?><testsuite name="Test
version-issue" failures="12" tests="1" time="0.281" errors="0">
<properties/>
<testcase name="testGetNextVersionIssue" time="0.141"
classname="test.web.TestVersionIssue">
<failure type="java.io.FileNotFoundException"
message="[file].properties (Le chemin d'accès spécifié est
introuvable)">
<![CDATA[java.io.FileNotFoundException: [file].properties (Le
chemin d'accès spécifié est introuvable)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
... Removed 21 stack frames]]>
</failure>
</testcase>
</testsuite>
Then, the junit conversion log succeed with trace :
tests.junitreport:
[junitreport] Processing C:\logiciels\CruiseControlTestProjects
\FORGES_SERVER\report\xml\testng\TESTS-TestSuites.xml to C:\logiciels
\CruiseControlTestProjects\FORGES_SERVER\report\xml\testng\junit-
noframes.html
[junitreport] Loading stylesheet jar:file:/C:/logiciels/apache-
ant-1.7.0/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/
junit/xsl/junit-noframes.xsl
[junitreport] Transform time: 422ms
But still no result summary in Cruise control web page... (I start
thinking that it's in fact a Cruise control configuration issue, but
it's even more obscure to me than the testng one....)
> > <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
On Mar 17, 4:57 pm, Cédric Beust ♔ <cbe...@google.com> wrote:
> Bill, thank you very much for taking the time to investigate this.
>
> Pef, I applied Bill's patch and I uploaded the new version tohttp://testng.org/beta. Can you try it and let us know if this fixes your
> problem?
>
> [Just read Bill's update... ok. Let's proceed with the initial fix and take
> it from there]
>
> --
> Cédric
>
> On Wed, Mar 17, 2010 at 8:35 AM, Bill Michell
> <bill.mich...@googlemail.com>wrote:
> > On Wed, Mar 17, 2010 at 7:03 AM, Bill Michell <bill.mich...@googlemail.com
> > billmich...@gmail.com
>
> > --
> > Bill Michell
> > billmich...@gmail.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "testng-users" group.
> > To post to this group, send email to testng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
On Mar 17, 5:01 pm, Bill Michell <bill.mich...@googlemail.com> wrote:
> The file pef is complaining about is named C:\logiciels\CruiseControlTestProjects
> \FORGES_SERVER\report\html\testng\FORGES_TESTS\Test version-issue.xml
>
> Any idea which method would be writing that one out?
>
> On 17 Mar 2010, at 15:57, Cédric Beust ♔ wrote:
>
>
>
> > Bill, thank you very much for taking the time to investigate this.
>
> > Pef, I applied Bill's patch and I uploaded the new version tohttp://testng.org/beta. Can you try it and let us know if this fixes your problem?
>
> > [Just read Bill's update... ok. Let's proceed with the initial fix and take it from there]
>
> > --
> > Cédric
>
> >>> On Wed, Mar 17, 2010 at 7:03 AM, Bill Michell <bill.mich...@googlemail.com> wrote:
>
> >>> On 17 Mar 2010, at 13:47, Cédric Beust ♔ wrote:
>
> >>>> Thanks for the precisions, Bill.
>
> >>>> I'm pretty sure the XML generated is well formed but I'm suspecting the original poster is using strings (test names maybe?) that contain characters that are not in the utf-8 range, hence my asking him exactly what was failing.
>
> >>> Um - utf-8 includes representations for all the unicode character set, including characters that can't be expressed in 16 bits...
>
> >>> Mmmh, true.
>
> >>> In this case, I'd still like to see that stack trace from Pef to find out exactly what's going on.
>
> >>>> It feels like iso-8859-1 would be a better default encoding but I'd like to make sure I won't be breaking any existing code before making this change.
>
> >>> I'd avoid this. If you aren't going to use standard XML writing routines, I'd go to US-ASCII and explicitly escape all characters above #x7F using a suitable escape sequence, plus < and "
>
> >>> Really? This sounds like a lot of work (regardless of the fact that it's probably just one method call away). What's wrong with just switching the encoding of the generated files from UTF-8 to ISO-8859-1? Are there downsides?
>
> >> Well, not all the world uses ISO-8859-1 so you still have to find a way to solve the issue for people whose system exceptions include characters not in ISO-8859-1.
>
> >> Looking at the stack trace, I'd say the issue was with the way the file is being spooled to disk. I'd guess you're using the default system character encoding, but claiming UTF-8.
>
> >> The fix would be either to claim the default system encoding as the encoding in the xml declaration, or else to explicitly use some other encoding mechanism when opening your output file writer.
>
> >> Give me a minute and I'll try and find the appropriate line of code.
>
> >>> --
> >>> Cédric
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups "testng-users" group.
> >>> To post to this group, send email to testng...@googlegroups.com.
> >>> To unsubscribe from this group, send email to testng-users...@googlegroups.com.
> >>> For more options, visit this group athttp://groups.google.com/group/testng-users?hl=en.
>
> >> --
> >> Bill Michell
> >> billmich...@gmail.com
>
> > --
> > Bill Michell
> > billmich...@gmail.com
>
> > --
> > You received this message because you are subscribed to the Google Groups "testng-users" group.
> > To post to this group, send email to testng...@googlegroups.com.
> > To unsubscribe from this group, send email to testng-users...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/testng-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "testng-users" group.
> > To post to this group, send email to testng...@googlegroups.com.
> > To unsubscribe from this group, send email to testng-users...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/testng-users?hl=en.
>
> --
> Bill Michell
> billmich...@gmail.com
At present, all the reporters I have found just use the suite name to create the file name...
<log>
<merge dir="projects/prc4/testout/creation" />
<merge dir="projects/prc4/testout/sample" />
<merge dir="projects/prc4/testout/more" />
</log>
to merge the test logs for each suite I run (creation, sample and more
tests) into the main logs and they are then all reported on.
On Mar 17, 8:50 am, Pef <src...@wanadoo.fr> wrote:
> Hi all,
>
> I'm currently trying to integrate my testng reports to a Cruise
> Control build results page.
>
> I use a Ant task to run tests and convert to junit report. Conversion
> fails on some xml files, due to prolog : character encoding is set to
> UTF-8 but files actually require ISO-8859-1. Displayed error is :
> "The file (file).xml is not a valid XML document. It is possibly
> corrupted."
>
tests.junitreport:
[junitreport] [Fatal Error] Test%20version-issue.xml:1:387: Invalid
byte 2 of 3-byte UTF-8 sequence.
[junitreport] The file C:\logiciels\CruiseControlTestProjects
\FORGES_SERVER\report\html\testng\FORGES_TESTS\Test version-issue.xml
is not a valid XML document. It is possibly corrupted.
[junitreport] Processing C:\logiciels\CruiseControlTestProjects
\FORGES_SERVER\report\xml\testng\TESTS-TestSuites.xml to C:\logiciels
\CruiseControlTestProjects\FORGES_SERVER\report\xml\testng\junit-
noframes.html
[junitreport] Loading stylesheet jar:file:/C:/logiciels/apache-
ant-1.7.0/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/
junit/xsl/junit-noframes.xsl
[junitreport] Transform time: 187ms
I have to go now, but I'll continue my tests tomorrow...
Thank you very much all for your help, and see you tomorrow for the
next!!
On Mar 17, 4:57 pm, Cédric Beust ♔ <cbe...@google.com> wrote:
> Bill, thank you very much for taking the time to investigate this.
>
> Pef, I applied Bill's patch and I uploaded the new version tohttp://testng.org/beta. Can you try it and let us know if this fixes your
> problem?
>
> [Just read Bill's update... ok. Let's proceed with the initial fix and take
> it from there]
>
> --
> Cédric
>
> On Wed, Mar 17, 2010 at 8:35 AM, Bill Michell
> <bill.mich...@googlemail.com>wrote:
> > On Wed, Mar 17, 2010 at 7:03 AM, Bill Michell <bill.mich...@googlemail.com
> > billmich...@gmail.com
>
> > --
> > Bill Michell
> > billmich...@gmail.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "testng-users" group.
> > To post to this group, send email to testng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
Your code snippet solved my problem! I now have my test results in CC
web page! Sooooo Thanksful JohnBurgess!!
In other hand, after my morning tests, I still have a problem with xml
files like yesterday... Hope a solution will be found today, with the
good work done yesterday!
I'm still facing this XML encoding issue, since my firstly created
class converting files can not be run systematically.
So, some tests results do not appear in Cruise Control summary.
Any solutions for that?
Thanks