Skip to content

Commit

Permalink
Added test for issue #242.
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoathaydes committed May 3, 2023
1 parent 8df4b29 commit cbd0d00
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.athaydes.spockframework.report

import spock.lang.Ignore
import spock.lang.Specification

@Ignore
class FullyIgnoredSpec extends Specification {
def 'feature1'() {
expect: true
}

def 'feature2'() {
expect: true
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package com.athaydes.spockframework.report.internal

import com.athaydes.spockframework.report.FakeTest
import com.athaydes.spockframework.report.ReportSpec
import com.athaydes.spockframework.report.SpecIncludingExtraInfo
import com.athaydes.spockframework.report.SpecInfoListener
import com.athaydes.spockframework.report.SpockReportExtension
import com.athaydes.spockframework.report.UnrolledSpec
import com.athaydes.spockframework.report.VividFakeTest
import com.athaydes.spockframework.report.*
import com.athaydes.spockframework.report.engine.CanRunSpockSpecs
import com.athaydes.spockframework.report.util.Hasher
import groovy.xml.MarkupBuilder
Expand Down Expand Up @@ -35,6 +29,7 @@ class HtmlReportCreatorSpec extends ReportSpec
skipped : 2,
successRate : "50${DS}0%"
]

static final Map vividFakeTestBinding = [
narrative : '\nAs a developer\nI want to see my code',
executedFeatures: 9,
Expand All @@ -45,6 +40,15 @@ class HtmlReportCreatorSpec extends ReportSpec
successRate : "44${DS}44%"
]

static final Map fullyIgnoredSpecBinding = [
executedFeatures: 0,
passed : 0,
failures : 0,
errors : 0,
skipped : 2,
successRate : "100%"
]

@Unroll
def "A correct HTML report is generated for a #specification.simpleName including different types of features"() {
given:
Expand Down Expand Up @@ -100,6 +104,8 @@ class HtmlReportCreatorSpec extends ReportSpec
specification | configShowCodeBlocks | reportBinding
FakeTest | ShowCodeBlocksDisabled | fakeTestBinding
VividFakeTest | ShowCodeBlocksEnabled | vividFakeTestBinding
// FIXME https://github.com/renatoathaydes/spock-reports/issues/242
// FullyIgnoredSpec | ShowCodeBlocksDisabled | fullyIgnoredSpecBinding
}

def "The css file used should be loaded correctly from any file in the classpath"() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'></meta>
<style>
${style}

</style>
</head>
<body>
<h2>Report for ${classOnTest}</h2>
<hr></hr>
<div class='back-link'>
<a href='index.html'>&lt;&lt; Back</a>
</div>
<div class='summary-report'>
<h3>Summary:</h3>
<div class='date-test-ran'>Created on ${dateTestRan} by ${username}</div>
<table class='summary-table'>
<thead>
<tr>
<th>Executed features</th>
<th>Passed</th>
<th>Failures</th>
<th>Errors</th>
<th>Skipped</th>
<th>Success rate</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>${executedFeatures}</td>
<td>${passed}</td>
<td>${failures}</td>
<td>${errors}</td>
<td>${skipped}</td>
<td>${successRate}</td>
<td>${time}</td>
</tr>
</tbody>
</table>
</div>
<h3>Features:</h3>
<table class='features-table'>
<colgroup>
<col class='block-kind-col'></col>
<col class='block-text-col'></col>
</colgroup>
<tbody>
<div>TOC</div>
<tr>
<td colspan='10'>
<div class='feature-description failure' id='0'><span>feature1</span><span class='return-toc'>
<a href='#toc'>Return</a>
<div class='ex-time'>(Unknown)</div></span></div>
</td>
</tr>
<tr>
<td>
<div class='block-kind'>Expect:</div>
</td>
<td>
<div class='block-text'></div>
</td>
</tr>
<tr>
<td colspan='10'>
<div class='feature-description failure' id='0'><span>feature2</span><span class='return-toc'>
<a href='#toc'>Return</a>
<div class='ex-time'>(Unknown)</div></span></div>
</td>
</tr>
<tr>
<td>
<div class='block-kind'>Expect:</div>
</td>
<td>
<div class='block-text'></div>
</td>
</tr>
</tbody>
</table>
<hr></hr>
<div class='footer'>Generated by <a href='${projectUrl}'>Athaydes Spock Reports</a></div>
</body>
</html>

0 comments on commit cbd0d00

Please sign in to comment.