Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting of StdOut, StdErr and StackTrace #8

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion TrxerConsole/Trxer.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ td.slowest {
}

.SummaryDiv {
width: 90%;
width: 98%;
border-top: 1px solid #e5eff8;
border-right: 1px solid #e5eff8;
margin: 1em auto;
Expand Down Expand Up @@ -359,3 +359,12 @@ td.slowest {
.visibleRow {
visibility: visible;
}

.wordwrap {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break: break-all; /* Firefox */
}
149 changes: 114 additions & 35 deletions TrxerConsole/Trxer.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<!--<xsl:namespace-alias stylesheet-prefix="t" result-prefix="#default"/>-->

<msxsl:script language="C#" implements-prefix="trxreport">
<msxsl:using namespace="System.IO"/>
<![CDATA[
public string RemoveAssemblyName(string asm)
{
Expand Down Expand Up @@ -79,6 +80,38 @@
}
return string.Empty;
}

public bool IsLongText(string text)
{
var index = 0;
var found = 0;
do
{
index = text.IndexOf("\n", index);
if (index != -1)
{
++found;
++index;
}
}
while (found < 3 && index != -1);
return (found > 2);
}

public string ShortenText(string text)
{
var ret = new StringBuilder();
using (var reader = new StringReader(text))
{
var lines = 3;
for (var line = reader.ReadLine(); lines > 0 & line != null; --lines, line = reader.ReadLine())
{
ret.Append(line);
ret.Append("\n");
}
}
return ret.ToString();
}

]]>
</msxsl:script>
Expand Down Expand Up @@ -494,16 +527,64 @@
<xsl:value-of select="trxreport:ToExactTimeDefinition(@duration)" />
</td>
</tr>
<tr id="{generate-id($testId)}Stacktrace" class="hiddenRow">
<tr id="{generate-id($testId)}Message" class="hiddenRow">
<!--Outer-->
<td colspan="6">
<div id="exceptionArrow">↳</div>
<table>
<!--Inner-->
<tbody>
<tr class="visibleRow">
<td class="ex">
<xsl:value-of select="/t:TestRun/t:Results/t:UnitTestResult[@testId=$testId]/t:Output/t:ErrorInfo/t:StackTrace" />
<td class="ex wordwrap">
<xsl:value-of select="/t:TestRun/t:Results/t:UnitTestResult[@testId=$testId]/t:Output/t:ErrorInfo/t:Message"/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr id="{generate-id($testId)}StdOut" class="hiddenRow">
<!--Outer-->
<td colspan="6">
<div id="exceptionArrow">↳</div>
<table>
<!--Inner-->
<tbody>
<tr class="visibleRow">
<td class="ex wordwrap">
<xsl:value-of select="/t:TestRun/t:Results/t:UnitTestResult[@testId=$testId]/t:Output/t:StdOut"/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr id="{generate-id($testId)}StdErr" class="hiddenRow">
<!--Outer-->
<td colspan="6">
<div id="exceptionArrow">↳</div>
<table>
<!--Inner-->
<tbody>
<tr class="visibleRow">
<td class="ex wordwrap">
<xsl:value-of select="/t:TestRun/t:Results/t:UnitTestResult[@testId=$testId]/t:Output/t:StdErr"/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr id="{generate-id($testId)}StackTrace" class="hiddenRow">
<!--Outer-->
<td colspan="6">
<div id="exceptionArrow">↳</div>
<table>
<!--Inner-->
<tbody>
<tr class="visibleRow">
<td class="ex wordwrap">
<xsl:value-of select="/t:TestRun/t:Results/t:UnitTestResult[@testId=$testId]/t:Output/t:ErrorInfo/t:StackTrace"/>>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -535,47 +616,45 @@
<div class="atachmentImage" onclick="show('floatingImageBackground');updateFloatingImage('{$MessageErrorInfo}');"></div>
</xsl:when>
</xsl:choose>

</xsl:for-each>
</xsl:template>







<xsl:template name="debugInfo">
<xsl:param name="testId" />
<xsl:for-each select="/t:TestRun/t:Results/t:UnitTestResult[@testId=$testId]/t:Output">
<xsl:variable name="Message" select="t:ErrorInfo/t:Message" />
<xsl:choose>
<xsl:when test="trxreport:IsLongText($Message)">
<xsl:value-of select="trxreport:ShortenText($Message)"/>
<div class="OpenMoreButton" style="float:none" onclick="ShowHide('{generate-id($testId)}Message','{generate-id($testId)}MessageButton','Show Full Message','Hide Full Message');">
<div class="MoreButtonText" id="{generate-id($testId)}MessageButton">Show Full Message</div>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$Message"/>
</xsl:otherwise>
</xsl:choose>

<xsl:variable name="MessageErrorStacktrace" select="t:ErrorInfo/t:StackTrace"/>

<xsl:variable name="StdOut" select="t:StdOut"/>
<xsl:if test="$StdOut or $MessageErrorStacktrace">
<xsl:value-of select="$StdOut"/>
<xsl:if test="$MessageErrorStacktrace">
<a style="float:right;" id="{generate-id($testId)}StacktraceToggle" href="javascript:ShowHide('{generate-id($testId)}Stacktrace','{generate-id($testId)}StacktraceToggle','Show Stacktrace','Hide Stacktrace');">Show Stacktrace</a>
</xsl:if>
<div style="float:left;">
<xsl:variable name="StdOut" select="t:StdOut" />
<xsl:variable name="StdErr" select="t:StdErr" />
<xsl:variable name="StackTrace" select="t:ErrorInfo/t:StackTrace"/>
<xsl:if test="$StdOut">
<br/>
<div class="OpenMoreButton" onclick="ShowHide('{generate-id($testId)}StdOut','{generate-id($testId)}StdOutButton','Show StdOut','Hide StdOut');">
<div class="MoreButtonText" id="{generate-id($testId)}StdOutButton">Show StdOut</div>
</div>
</xsl:if>
</xsl:if>
<xsl:value-of select="t:StdErr" />
<xsl:variable name="StdErr" select="t:StdErr"/>
<xsl:if test="$StdErr">
<xsl:value-of select="$StdErr"/>
<br/>
</xsl:if>
<xsl:variable name="MessageErrorInfo" select="t:ErrorInfo/t:Message"/>
<xsl:if test="$MessageErrorInfo">
<xsl:value-of select="$MessageErrorInfo"/>
<br/>
</xsl:if>



<xsl:if test="$StdErr">
<div class="OpenMoreButton" onclick="ShowHide('{generate-id($testId)}StdErr','{generate-id($testId)}StdErrButton','Show StdErr','Hide StdErr');">
<div class="MoreButtonText" id="{generate-id($testId)}StdErrButton">Show StdErr</div>
</div>
</xsl:if>
<xsl:if test="$StackTrace">
<div class="OpenMoreButton" onclick="ShowHide('{generate-id($testId)}StackTrace','{generate-id($testId)}StackTraceButton','Show StackTrace','Hide StackTrace');">
<div class="MoreButtonText" id="{generate-id($testId)}StackTraceButton">Show StackTrace</div>
</div>
</xsl:if>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

2 changes: 1 addition & 1 deletion TrxerConsole/TrxerTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ img {
}

table {
width: 90%;
width: 98%;
margin: 1em auto;
border-collapse: collapse;
border: 1px solid #a2caf2;
Expand Down