package uk.co.automatictester.lightning;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.co.automatictester.lightning.enums.TestResult;
import uk.co.automatictester.lightning.structures.LightningTests;
import uk.co.automatictester.lightning.tests.base.LightningTest;

import java.util.List;

public class TestSet {

    private int passCount = 0;
    private int failCount = 0;
    private int ignoreCount = 0;
    private String testExecutionReport = "";
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public void executeTests() {
        StringBuilder output = new StringBuilder();
        for (LightningTest test : getTests()) {
            test.execute();
            setCounts(test);
            String testExecutionReport = test.getTestExecutionReport();
            output.append(testExecutionReport).append(System.lineSeparator());
        }
        testExecutionReport += output;
    }

    private void setCounts(LightningTest test) {
        TestResult testResult = test.getResult();
        switch (testResult) {
            case PASS:
                passCount++;
                break;
            case FAIL:
                failCount++;
                break;
            case ERROR:
                ignoreCount++;
                break;
        }
    }

    public void printTestExecutionReport() {
        String[] testExecutionReport = getTestExecutionReport().split(System.lineSeparator());
        for (String line : testExecutionReport) {
            logger.info(line);
        }
    }

    public String getTestExecutionReport() {
        return testExecutionReport;
    }

    public int getTestCount() {
        return passCount + failCount + ignoreCount;
    }

    public int getPassCount() {
        return passCount;
    }

    public int getFailCount() {
        return failCount;
    }

    public int getErrorCount() {
        return ignoreCount;
    }

    public List<LightningTest> getTests() {
        return LightningTests.getTests();
    }
}

@@ -571,32 +571,59 @@
 xecuteTests() %7B%0A
+        resetTestCounts();%0A
         StringBu
@@ -956,17 +956,16 @@
 ort 
-+
 = output
 ;%0A  
@@ -960,16 +960,27 @@
 = output
+.toString()
 ;%0A    %7D%0A
@@ -2060,11 +2060,126 @@
 );%0A    %7D
+%0A%0A    private void resetTestCounts() %7B%0A        passCount = 0;%0A        failCount = 0;%0A        ignoreCount = 0;%0A    %7D
 %0A%7D%0A

Fix problems with core module.