Skip to content

Commit

Permalink
JENKINS-11894 Updating tests and planning seek and update strategy to…
Browse files Browse the repository at this point in the history
… reduce memory consumption
  • Loading branch information
kinow committed Feb 14, 2012
1 parent 4163a9b commit 90cbcc2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 33 deletions.
Expand Up @@ -100,6 +100,20 @@ public void seek(TestCaseWrapper[] automatedTestCases,
if(caseResult.getName().equals(value)) {
ExecutionStatus status = this.getExecutionStatus(caseResult);
automatedTestCase.addCustomFieldAndStatus(value, status);
if(automatedTestCase.getExecutionStatus() != ExecutionStatus.NOT_RUN) {
testlink.updateTestCase(automatedTestCase);
switch(automatedTestCase.getExecutionStatus()) {
case PASSED:
report.setPassed(report.getPassed()+1);
break;
case FAILED:
report.setFailed(report.getFailed()+1);
break;
case BLOCKED:
report.setBlocked(report.getBlocked()+1);
break;
}
}
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/hudson/plugins/testlink/result/Report.java
Expand Up @@ -35,12 +35,12 @@ public class Report implements Serializable {

private static final long serialVersionUID = -6536222071547639906L;

private int passed;
private int failed;
private int blocked;
private int notRun;
private int passed = 0;
private int failed = 0;
private int blocked = 0;
private int notRun = 0;

private int buildId;
private int buildId = 0;
private String buildName;

/**
Expand Down
Expand Up @@ -57,6 +57,7 @@ public TestLinkSiteFake(TestLinkAPI api, TestProject testProject,
@Override
public void updateTestCase(TestCaseWrapper testCase) {
// OK, do nothing
System.out.println("Updating test case " + testCase.getName() + " execution status " + testCase.getExecutionStatus());
testCases.add(testCase);
}

Expand Down
Expand Up @@ -56,7 +56,7 @@ public class TestJUnitCaseNameResultSeeker
extends HudsonTestCase
{
private static FreeStyleProject project;
private final static TestCaseWrapper[] tcs = new TestCaseWrapper[4];
private final static TestCaseWrapper[] tcs = new TestCaseWrapper[2];
private static Report report = new Report();
private static TestLinkSiteFake testlink = new TestLinkSiteFake(null, null, null, null);

Expand Down Expand Up @@ -119,39 +119,24 @@ protected void setUp() throws Exception {

TestCaseWrapper tc = new TestCaseWrapper(new String[]{KEY_CUSTOM_FIELD});
CustomField cf = new CustomField();
cf.setName( KEY_CUSTOM_FIELD );
cf.setValue("br.eti.kinoshita.Test");
tc.getCustomFields().add( cf );
tc.setId(1);
tc.setKeyCustomFieldValue(cf.getValue());
tcs[0] = tc;

tc = new TestCaseWrapper(new String[]{KEY_CUSTOM_FIELD});
cf = new CustomField();
cf.setName( KEY_CUSTOM_FIELD );
cf.setValue("br.eti.kinoshita.Test");
tc.getCustomFields().add(cf);
tc.setId(2);
tc.setKeyCustomFieldValue(cf.getValue());
tcs[1] = tc;

tc = new TestCaseWrapper(new String[]{KEY_CUSTOM_FIELD});
cf = new CustomField();
cf.setName( KEY_CUSTOM_FIELD );
cf.setValue("br.eti.kinoshita.TestImmo");
cf.setValue("testVoid");
tc.getCustomFields().add(cf);
tc.setId(3);
tc.setId(1);
tc.setKeyCustomFieldValue(cf.getValue());
tcs[2] = tc;
tcs[0] = tc;

tc = new TestCaseWrapper(new String[]{KEY_CUSTOM_FIELD});
cf = new CustomField();
cf.setName( KEY_CUSTOM_FIELD );
cf.setValue("Consultation");
tc.getCustomFields().add(cf);
tc.setId(4);
tc.setId(2);
tc.setKeyCustomFieldValue(cf.getValue());
tcs[3] = tc;
tcs[1] = tc;
}

//@LocalData
Expand All @@ -164,13 +149,8 @@ public void testJUnitCaseNameResultSeeker() throws IOException, InterruptedExcep

assertNotNull(report);

assertEquals( 4, report.getTestsTotal() );
assertTrue( testlink.getTestCases().get(1).getExecutionStatus() == ExecutionStatus.FAILED );

assertTrue( testlink.getTestCases().get(1).getExecutionStatus() == ExecutionStatus.FAILED );
assertTrue( testlink.getTestCases().get(1).getExecutionStatus() == ExecutionStatus.PASSED );

assertTrue( testlink.getTestCases().get(1).getExecutionStatus() == ExecutionStatus.PASSED );
assertEquals( 3, report.getTestsTotal() );
// TODO organize directories, XMLs and rewrite this test
}


Expand Down

0 comments on commit 90cbcc2

Please sign in to comment.