diff --git a/php/php.codeception/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParser.java b/php/php.codeception/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParser.java
index acbf35cb8084..5aa345990fc4 100644
--- a/php/php.codeception/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParser.java
+++ b/php/php.codeception/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParser.java
@@ -40,7 +40,8 @@ public final class CodeceptionLogParser extends DefaultHandler {
private enum Content {
NONE,
ERROR,
- FAILURE
+ FAILURE,
+ SKIPPED
};
final XMLReader xmlReader;
@@ -101,6 +102,9 @@ public void startElement(String uri, String localName, String qName, Attributes
case "error": // NOI18N
startTestError(attributes);
break;
+ case "skipped": // NOI18N
+ startTestSkipped(attributes);
+ break;
default:
// noop
}
@@ -132,6 +136,7 @@ public void characters(char[] ch, int start, int length) throws SAXException {
switch (content) {
case FAILURE:
case ERROR:
+ case SKIPPED:
buffer.append(new String(ch, start, length));
break;
case NONE:
@@ -189,6 +194,11 @@ private void startTestFailure(Attributes attributes) {
content = Content.FAILURE;
}
+ private void startTestSkipped(Attributes attributes) {
+ content = Content.SKIPPED;
+ testCase.setSkippedStatus();
+ }
+
private void endTestContent() {
assert testCase != null;
assert buffer.length() > 0;
diff --git a/php/php.codeception/src/org/netbeans/modules/php/codeception/run/TestCaseVo.java b/php/php.codeception/src/org/netbeans/modules/php/codeception/run/TestCaseVo.java
index c2f7af717dd4..d391af0d4647 100644
--- a/php/php.codeception/src/org/netbeans/modules/php/codeception/run/TestCaseVo.java
+++ b/php/php.codeception/src/org/netbeans/modules/php/codeception/run/TestCaseVo.java
@@ -159,6 +159,11 @@ public void setFailureStatus() {
status = TestCase.Status.FAILED;
}
+ public void setSkippedStatus() {
+ assert status == TestCase.Status.PASSED : "Expected PASSED status but was: " + status; // NOI18N;
+ status = TestCase.Status.SKIPPED;
+ }
+
public TestCase.Status getStatus() {
return status;
}
@@ -171,6 +176,10 @@ public boolean isFailure() {
return status.equals(TestCase.Status.FAILED);
}
+ public boolean isSkipped() {
+ return status.equals(TestCase.Status.SKIPPED);
+ }
+
@Override
public String toString() {
return String.format("TestCaseVo{name: %s, file: %s, line: %d, time: %d, status: %s, stacktrace: %s}", // NOI18N
diff --git a/php/php.codeception/test/unit/data/codeception-log-skipped-functional-tests.xml b/php/php.codeception/test/unit/data/codeception-log-skipped-functional-tests.xml
new file mode 100644
index 000000000000..0959da9232a6
--- /dev/null
+++ b/php/php.codeception/test/unit/data/codeception-log-skipped-functional-tests.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/php/php.codeception/test/unit/data/codeception-log-skipped-unit-tests.xml b/php/php.codeception/test/unit/data/codeception-log-skipped-unit-tests.xml
new file mode 100644
index 000000000000..af0ce86a67e7
--- /dev/null
+++ b/php/php.codeception/test/unit/data/codeception-log-skipped-unit-tests.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/php/php.codeception/test/unit/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParserTest.java b/php/php.codeception/test/unit/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParserTest.java
index 9db8f21660ef..8be9ae99b296 100644
--- a/php/php.codeception/test/unit/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParserTest.java
+++ b/php/php.codeception/test/unit/src/org/netbeans/modules/php/codeception/run/CodeceptionLogParserTest.java
@@ -23,6 +23,7 @@
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
+import java.util.Arrays;
import org.netbeans.junit.NbTestCase;
import org.netbeans.modules.php.spi.testing.run.TestCase;
@@ -216,6 +217,48 @@ public void testParseLogWithWarningPhpUnitSuite() throws Exception {
assertEquals("Trying to configure method \"getBarAAA\" which cannot be configured because it does not exist, has not been specified, is final, or is static", testCase.getStackTrace()[0]);
}
+ public void testParseLogSkippedUnitTests() throws Exception {
+ Reader reader = createReader("codeception-log-skipped-unit-tests.xml");
+ TestSessionVo testSession = new TestSessionVo();
+
+ CodeceptionLogParser.parse(reader, testSession);
+ assertEquals(43, testSession.getTime());
+ assertEquals(13, testSession.getTests());
+
+ assertEquals(1, testSession.getTestSuites().size());
+
+ TestSuiteVo testSuite = testSession.getTestSuites().get(0);
+ assertEquals("unit", testSuite.getName());
+ assertEquals(null, testSuite.getLocation());
+ assertEquals(43, testSuite.getTime());
+ assertEquals(13, testSuite.getTestCases().size());
+
+ TestCaseVo testCase = testSuite.getTestCases().get(1);
+ assertTrue(testCase.isSkipped());
+ assertTrue(Arrays.asList(testCase.getStackTrace()).isEmpty());
+ }
+
+ public void testParseLogSkippedFunctionalTests() throws Exception {
+ Reader reader = createReader("codeception-log-skipped-functional-tests.xml");
+ TestSessionVo testSession = new TestSessionVo();
+
+ CodeceptionLogParser.parse(reader, testSession);
+ assertEquals(191, testSession.getTime());
+ assertEquals(6, testSession.getTests());
+
+ assertEquals(1, testSession.getTestSuites().size());
+
+ TestSuiteVo testSuite = testSession.getTestSuites().get(0);
+ assertEquals("functional", testSuite.getName());
+ assertEquals(null, testSuite.getLocation());
+ assertEquals(191, testSuite.getTime());
+ assertEquals(6, testSuite.getTestCases().size());
+
+ TestCaseVo testCase = testSuite.getTestCases().get(0);
+ assertTrue(testCase.isSkipped());
+ assertTrue(Arrays.asList(testCase.getStackTrace()).isEmpty());
+ }
+
private Reader createReader(String filename) throws FileNotFoundException {
return new BufferedReader(new FileReader(new File(getDataDir(), filename)));
}