Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SUREFIRE-1272]:Create better report for AssumptionFailure
- Loading branch information
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...egration-tests/src/test/java/org/apache/maven/surefire/its/AssumptionFailureReportIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.apache.maven.surefire.its; | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import org.apache.maven.surefire.its.fixture.OutputValidator; | ||
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; | ||
import org.apache.maven.surefire.its.fixture.TestFile; | ||
import org.junit.Test; | ||
|
||
public class AssumptionFailureReportIT extends SurefireJUnit4IntegrationTestCase | ||
{ | ||
@Test | ||
public void testWriteSkippedMessageToReport() | ||
{ | ||
final OutputValidator outputValidator = unpack( "/assumpationFailureReport" ).executeTest(); | ||
TestFile xmlReportFile = outputValidator.getSurefireReportsXmlFile( "TEST-assumptionFailure.Test1.xml" ); | ||
xmlReportFile.assertContainsText( "The test is skipped if it is false" ); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
surefire-integration-tests/src/test/resources/assumpationFailureReport/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one | ||
~ or more contributor license agreements. See the NOTICE file | ||
~ distributed with this work for additional information | ||
~ regarding copyright ownership. The ASF licenses this file | ||
~ to you under the Apache License, Version 2.0 (the | ||
~ "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<parent> | ||
<groupId>org.apache.maven.surefire</groupId> | ||
<artifactId>it-parent</artifactId> | ||
<version>1.0</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.apache.maven.plugins.surefire</groupId> | ||
<artifactId>assumpationFailure</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>assumpationFailureReportTest</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<redirectTestOutputToFile>true</redirectTestOutputToFile> | ||
<includes> | ||
<include>**/Test*.java</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
...s/src/test/resources/assumpationFailureReport/src/test/java/assumpationFailure/Test1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package assumptionFailure; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import org.junit.Test; | ||
import org.junit.Assume; | ||
|
||
import static org.junit.Assert.fail; | ||
|
||
public class Test1 | ||
{ | ||
@Test | ||
public void testAssumptionFailureReport() | ||
{ | ||
Assume.assumeTrue( "The test is skipped if it is false" , false ); | ||
fail( "This is not expected to test" ); | ||
} | ||
|
||
} |