View Javadoc
1   package org.apache.maven.surefire.its.jiras;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.surefire.its.fixture.OutputValidator;
23  import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
24  import org.apache.maven.surefire.its.fixture.SurefireLauncher;
25  import org.junit.Test;
26  
27  /**
28   * SUREFIRE-1152 Assert rerunFailingTestsCount works with test suites
29   *
30   * @author Sean Flanigan
31   */
32  public class Surefire1152RerunFailingTestsInSuiteIT
33      extends SurefireJUnit4IntegrationTestCase
34  {
35      private static final String RUNNING_WITH_PROVIDER47 =
36          "Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider";
37  
38      public OutputValidator runMethodPattern( String projectName, String... goals )
39      {
40          SurefireLauncher launcher = unpack( projectName );
41          for ( String goal : goals )
42          {
43              launcher.addGoal( goal );
44          }
45          OutputValidator outputValidator = launcher.showErrorStackTraces().debugLogging().executeVerify();
46          outputValidator.assertTestSuiteResults( 3, 0, 0, 0, 3 );
47          outputValidator.assertIntegrationTestSuiteResults( 1, 0, 0, 0 );
48          return outputValidator;
49      }
50  
51      @Test
52      public void testJUnit48Provider4()
53      {
54          runMethodPattern( "surefire-1152-rerunFailingTestsCount-suite", "-P surefire-junit4" );
55      }
56  
57      @Test
58      public void testJUnit48Provider47()
59      {
60          runMethodPattern( "surefire-1152-rerunFailingTestsCount-suite", "-P surefire-junit47" )
61              .verifyTextInLog( RUNNING_WITH_PROVIDER47 );
62      }
63  
64  }