Skip to content

Commit

Permalink
Fixed JENKINS-24578
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNielsen committed Sep 4, 2014
1 parent 0ea95f4 commit 80809e1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Expand Up @@ -95,7 +95,10 @@ public boolean execute(AbstractBuild<?, ?> build, BuildListener listener, Launch
List<TestSuiteExecutionRecord> records = (List<TestSuiteExecutionRecord>)results;

for(TestSuiteExecutionRecord tser : records) {
totalNumberOfScripts += tser.getAllTestCases().size();

for(TestCase tc : tser.getAllTestCases()) {
totalNumberOfScripts += tc.getScripts().size();
}
}

if(preBuildSteps != null) {
Expand All @@ -117,7 +120,7 @@ public boolean execute(AbstractBuild<?, ?> build, BuildListener listener, Launch
}

for(final TestScript ts : tc.getScripts()) {
listener.getLogger().println(String.format( " * Test Script %s [%s]",ts.getScriptTitle(), ts.getRqmObjectResourceUrl()) );
listener.getLogger().println(String.format( " * Test Script %s [%s]", ts.getScriptTitle(), ts.getRqmObjectResourceUrl()) );
for(BuildStep bstep : iterativeTestCaseBuilders) {

final EnvironmentContributingAction envAction = new EnvironmentContributingAction() {
Expand Down Expand Up @@ -169,18 +172,18 @@ public String getUrlName() {
}

listener.getLogger().println( String.format("Successfully executed %s out of %s test scripts", executionCounter, totalNumberOfScripts) );
listener.getLogger().println( "Listing test cases which failed executing. Have you remembered to add the proper fields to your test scripts?" );

for(TestSuiteExecutionRecord tser : records) {
for(TestCase tc : tser.getAllTestCases()) {
for(TestScript tscript : tc.getScripts()) {
if(!tscript.isExecutionSuccess()) {
listener.getLogger().println(tscript);
if(executionCounter != totalNumberOfScripts) {
listener.getLogger().println( "Listing test cases which failed executing. Have you remembered to add the proper fields to your test scripts?" );
for(TestSuiteExecutionRecord tser : records) {
for(TestCase tc : tser.getAllTestCases()) {
for(TestScript tscript : tc.getScripts()) {
if(!tscript.isExecutionSuccess()) {
listener.getLogger().println(tscript);
}
}
}
}
}

return success;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/praqma/jenkins/rqm/model/TestCase.java
Expand Up @@ -136,14 +136,14 @@ public TestCase initializeSingleResource(String xml) throws RQMObjectParseExcept
for(int i=0; i<list.getLength(); i++) {
Node elem = list.item(i);
if(elem.getNodeType() == Node.ELEMENT_NODE) {
log.fine("Title for test case: "+title);
title = ((Element)elem).getTextContent();
}
}

this.setTestCaseTitle(title);
/*
NodeList nlistForTestSuites = doc.getElementsByTagName("ns4:remotescript");

for(int i=0; i<nlistForTestSuites.getLength(); i++) {
Node elem = nlistForTestSuites.item(i);
if(elem.getNodeType() == Node.ELEMENT_NODE) {
Expand All @@ -152,6 +152,7 @@ public TestCase initializeSingleResource(String xml) throws RQMObjectParseExcept
getScripts().add(ts);
}
}
*/
return this;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/praqma/jenkins/rqm/model/TestSuite.java
Expand Up @@ -77,7 +77,11 @@ public TestSuite initializeSingleResource(String xml) throws RQMObjectParseExcep
if(suiteElements.item(selement).getNodeType() == Node.ELEMENT_NODE) {
Element suteElem = (Element)suiteElements.item(selement);
String testCaseHref = ((Element)suteElem.getElementsByTagName("ns4:testcase").item(0)).getAttribute("href");
String testScriptHref = ((Element)suteElem.getElementsByTagName("ns4:remotescript").item(0)).getAttribute("href");

TestCase tc = new TestCase(testCaseHref);
TestScript ts = new TestScript(testScriptHref);
tc.getScripts().add(ts);
tc.setExecutionOrder(executionOrder);
getTestcases().add(tc);
}
Expand Down

0 comments on commit 80809e1

Please sign in to comment.