Skip to content

Commit

Permalink
steps on TestSpec is array
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Miklosovic committed May 25, 2015
1 parent d01a847 commit 838889a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*
* @return detailed steps in order to consider this test to be successful
*/
String steps() default "";
String[] steps() default "";

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

Expand Down Expand Up @@ -111,7 +112,17 @@ private Collection<? extends String> reportTestSpec(TestSpec testSpec) {
report.add("|feature|" + testSpec.feature());
report.add("|test|" + testSpec.test());
report.add("|prerequisities|" + testSpec.prerequisites());
report.add("|steps|" + testSpec.steps());

List<String> stepsList = new ArrayList<String>(Arrays.asList(testSpec.steps()));

if (!stepsList.isEmpty() && !stepsList.get(0).isEmpty()) {
report.add("|steps|" + stepsList.get(0));
stepsList.remove(0);
for (String step : stepsList) {
report.add("||" + step);
}
}

report.add("|assertion|" + testSpec.assertion());
report.add("|issue|" + testSpec.issue());
report.add("|status|" + testSpec.status());
Expand All @@ -121,8 +132,6 @@ private Collection<? extends String> reportTestSpec(TestSpec testSpec) {
return report;
}



private int getCount(List<TestSpec> testSpecs, Status status) {
int count = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.arquillian.extension.governor.skipper.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.arquillian.extension.governor.skipper.api.Status;
Expand Down Expand Up @@ -100,8 +101,21 @@ private List<TableRowEntry> constructReportRows(TestSpec testSpec) {
TableRowEntry prerequisities = new TableRowEntry();
prerequisities.addCells(new TableCellEntry("prerequisities"), new TableCellEntry(testSpec.prerequisites()));

TableRowEntry steps = new TableRowEntry();
steps.addCells(new TableCellEntry("steps"), new TableCellEntry(testSpec.steps()));
List<TableRowEntry> stepRows = new ArrayList<TableRowEntry>();

List<String> stepsList = new ArrayList<String>(Arrays.asList(testSpec.steps()));

if (!stepsList.isEmpty() && !stepsList.get(0).isEmpty()) {
TableRowEntry stepRow = new TableRowEntry();
stepRow.addCells(new TableCellEntry("steps"), new TableCellEntry(stepsList.get(0)));
stepRows.add(stepRow);
stepsList.remove(0);
for (String step : stepsList) {
TableRowEntry stepRowEntry = new TableRowEntry();
stepRowEntry.addCells(new TableCellEntry(""), new TableCellEntry(step));
stepRows.add(stepRowEntry);
}
}

TableRowEntry assertion = new TableRowEntry();
assertion.addCells(new TableCellEntry("assertion"), new TableCellEntry(testSpec.assertion()));
Expand All @@ -118,7 +132,7 @@ private List<TableRowEntry> constructReportRows(TestSpec testSpec) {
rows.add(featureRow);
rows.add(testRow);
rows.add(prerequisities);
rows.add(steps);
rows.addAll(stepRows);
rows.add(assertion);
rows.add(issue);
rows.add(status);
Expand Down
2 changes: 1 addition & 1 deletion tests/skipper-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<version.arquillian.core>1.1.8.Final</version.arquillian.core>
<version.arquillian.decoder>1.0.0.Alpha2</version.arquillian.decoder>
<version.arquillian.decoder>1.0.0.Alpha2-SNAPSHOT</version.arquillian.decoder>
<version.recorder>1.0.0.Final</version.recorder>
<version.junit>4.12</version.junit>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class SkipperTestClass_1 extends AbstractArquillianClass {
issue = "ARQ-1",
prerequisites = "have java",
status = Status.AUTOMATED,
steps = "some steps",
test = "tests stuff"
)
public void someTest() {
Expand All @@ -53,7 +52,7 @@ public void someTest() {
issue = "ARQ-2",
prerequisites = "have java",
status = Status.MANUAL,
steps = "some steps",
steps = { "some step", "another step", "final step" },
test = "tests stuff"
)
public void someTest2() {
Expand All @@ -68,7 +67,7 @@ public void someTest2() {
issue = "ARQ-3",
prerequisites = "have java",
status = Status.AUTOMATED,
steps = "some steps",
steps = { "this issue", "have four", "execution", "steps" },
test = "tests stuff"
)
public void someTest3() {
Expand All @@ -83,7 +82,7 @@ public void someTest3() {
issue = "ARQ-4",
prerequisites = "have java",
status = Status.MANUAL,
steps = "some steps",
steps = { "long step 1 long step 1 long step 1 long step 1", "long step 2 long step 2 long step 2 long step 2", },
test = "tests stuff"
)
public void someTest4() {
Expand Down
2 changes: 1 addition & 1 deletion tests/skipper-test/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
</extension>

<extension qualifier="reporter">
<property name="report">adoc</property>
<property name="report">html</property>
</extension>
</arquillian>

0 comments on commit 838889a

Please sign in to comment.