Skip to content
This repository has been archived by the owner on Jan 14, 2019. It is now read-only.

Commit

Permalink
Support multi testId for one test like issue (#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhuizuo authored and baev committed Dec 19, 2016
1 parent 5ec4ee6 commit 36c8f23
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ Expected: "{\n\"name\": \"test\",\n\"value\": \"ok value\"\n}"
<label name="testId" value="TMS-1"/>
</labels>
</test-case>
<test-case start="1412949539804" stop="1412949539830" status="passed">
<name>mapToMultiTestIds</name>
<description type="text">one test implement for several Tests in TMS</description>
<steps/>
<attachments/>
<labels>
<label name="severity" value="blocker"/>
<label name="host" value="my.cool.host.com"/>
<label name="thread" value="pool-1-thread-7"/>
<label name="testId" value="TMS-1a"/>
<label name="testId" value="TMS-1b"/>
</labels>
</test-case>
</test-cases>
<labels>
<label name="framework" value="JUnit"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DefaultTestCaseConverter implements TestCaseConverter {
result.summary.attachments += result.attachments.size();

result.severity = source.severity;
result.testId = source.testId
result.testIds = source.testIds;
result.issues = source.issues;

def suiteName = source.suiteName ?: UNKNOWN_TEST_SUITE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ final class PluginUtils {
new Time(start: testCase.start, stop: testCase.stop, duration: testCase.stop - testCase.start);
}

static def getTestId(TestCaseResult testCase) {
def name = getLabelValue(testCase, LabelName.TEST_ID);
name ? new TestId(name: name, url: TextUtils.getTestUrl(name)) : null;
static def getTestIds(TestCaseResult testCase) {
def values = getLabelValues(testCase, LabelName.TEST_ID);
values?.collect { new TestId(name: it, url: TextUtils.getTestUrl(it)) }
}

static def getIssues(TestCaseResult testCase) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void shouldGenerateWithoutFailures() throws Exception {
assertThat(dataDirectory, contains(ReportWriter.REPORT_JSON));

assertThat(dataDirectory, hasFilesCount(14, "*-attachment*"));
assertThat(dataDirectory, hasFilesCount(319, "*-testcase.json"));
assertThat(dataDirectory, hasFilesCount(320, "*-testcase.json"));
}

@Test(expected = ReportGenerationException.class)
Expand Down
8 changes: 4 additions & 4 deletions allure-report-face/src/plugins/testcase-links/LinksView.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{#if hasLinks}}
<h3 class="pane__section-title">Links</h3>
{{#if testId}}
{{#each testIds}}
<span class="testcase-link">
<span class="fa fa-database"></span>
<a class="link" href="{{testId.url}}" target="_blank">{{testId.name}}</a></span>
{{/if}}
<a class="link" href="{{this.url}}" target="_blank">{{this.name}}</a></span>
{{/each}}
{{#each issues}}
<span class="testcase-link">
<span class="fa fa-bug"></span>
<a class="link" href="{{this.url}}" target="_blank">{{name}}</a></span>
<a class="link" href="{{this.url}}" target="_blank">{{this.name}}</a></span>
{{/each}}

{{/if}}
6 changes: 3 additions & 3 deletions allure-report-face/src/plugins/testcase-links/LinksView.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class IssuesView extends ItemView {
template = template;

serializeData() {
const {testId, issues} = this.model.attributes;
const {testIds, issues} = this.model.attributes;
return {
hasLinks: testId || issues.length > 0,
testId, issues
hasLinks: testIds.length > 0 || issues.length > 0,
testIds, issues
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<xsd:element name="severity" type="alr:severity-level"/>
<xsd:element name="status" type="alr:status"/>
<xsd:element name="issues" type="alr:issues"/>
<xsd:element name="testId" type="alr:testId" minOccurs="0"/>
<xsd:element name="testIds" type="alr:testIds"/>
<xsd:element name="labels" type="alr:labels" minOccurs="0"/>
<xsd:element name="parameters" type="alr:parameters" minOccurs="0"/>
<xsd:element name="suite" type="alr:allure-test-suite-info"/>
Expand Down Expand Up @@ -133,6 +133,12 @@
<xsd:attribute name="url" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="testIds">
<xsd:sequence>
<xsd:element name="testId" type="alr:testId" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="testId">
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="url" type="xsd:string"/>
Expand Down

0 comments on commit 36c8f23

Please sign in to comment.