Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-16640] Adding not run test cases to report
  • Loading branch information
kinow committed Apr 18, 2013
1 parent d5b2e65 commit 40f8ce3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
Expand Up @@ -50,32 +50,25 @@
* @author Bruno P. Kinoshita - http://www.kinoshita.eti.br
* @since 2.4
*/
public class AbstractTestLinkBuilder
extends Builder
{
public class AbstractTestLinkBuilder extends Builder {

/* --- Job properties --- */

/**
* Comma constant for custom fields separated with delimiter.
*/
private static final String COMMA = ",";

/**
* The name of the TestLink installation.
*/
protected final String testLinkName;

/**
* The name of the Test Project.
*/
protected final String testProjectName;

/**
* The name of the Test Plan.
*/
protected final String testPlanName;

/**
* The name of the Build.
*/
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/hudson/plugins/testlink/Report.java
Expand Up @@ -153,5 +153,30 @@ public void addTestCase(TestCaseWrapper testCase) {
public List<TestCaseWrapper> getTestCases() {
return testCases;
}

public void tally() {
this.blocked = 0;
this.failed = 0;
this.notRun = 0;
this.passed = 0;
for (TestCaseWrapper tcw : getTestCases()) {
switch (tcw.getExecutionStatus()) {
case BLOCKED:
this.blocked += 1;
break;
case FAILED:
this.failed += 1;
break;
case NOT_RUN:
this.notRun += 1;
break;
case PASSED:
this.passed += 1;
break;
default:
break;
}
}
}

}
12 changes: 7 additions & 5 deletions src/main/java/hudson/plugins/testlink/TestLinkBuilder.java
Expand Up @@ -162,12 +162,13 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
throw new AbortException(Messages.TestLinkBuilder_TestLinkCommunicationError());
}

if(LOGGER.isLoggable(Level.FINE)) {
for(TestCaseWrapper tcw : automatedTestCases) {
LOGGER.log(Level.FINE, "TestLink automated test case ID [" + tcw.getId() + "], name [" +tcw.getName()+ "]");
}
for(TestCaseWrapper tcw : automatedTestCases) {
testLinkSite.getReport().addTestCase(tcw);
if(LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "TestLink automated test case ID [" + tcw.getId() + "], name [" +tcw.getName()+ "]");
}
}

listener.getLogger().println(Messages.TestLinkBuilder_ExecutingSingleBuildSteps());
this.executeSingleBuildSteps(automatedTestCases.length, testLinkSite, build, launcher, listener);

Expand Down Expand Up @@ -197,6 +198,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
// This report is used to generate the graphs and to store the list of
// test cases with each found status.
final Report report = testLinkSite.getReport();
report.tally();

listener.getLogger().println(Messages.TestLinkBuilder_ShowFoundTestResults(report.getTestsTotal()));

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/hudson/plugins/testlink/TestLinkSite.java
Expand Up @@ -176,8 +176,7 @@ public TestCase[] getAutomatedTestCases( String[] customFieldsNames, Set<Executi
*
* @param testCases Test Cases
*/
public int updateTestCase( TestCaseWrapper testCase )
{
public int updateTestCase(TestCaseWrapper testCase) {
int executionId = 0;

if (testCase.getExecutionStatus() != null
Expand Down Expand Up @@ -214,7 +213,7 @@ public int updateTestCase( TestCaseWrapper testCase )
}

executionId = reportTCResultResponse.getExecutionId();
report.addTestCase(testCase);
//report.addTestCase(testCase);
}

return executionId;
Expand Down

0 comments on commit 40f8ce3

Please sign in to comment.