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.SurefireJUnit4IntegrationTestCase;
23  import org.junit.Test;
24  
25  /**
26   * SUREFIRE-621 Asserts proper test counts when running junit 3 tests in parallel<br>
27   * SUREFIRE-1264 Some tests can be lost when running in parallel with parameterized tests<br>
28   * <br>
29   * Removed decision making with JUnit3 in {@code TestSet} class during Jira activity of <tt>SUREFIRE-1264</tt>
30   * which results in one hot spot where the test class is determined (see JUnitCoreRunListener#fillTestCountMap()).
31   *
32   * @author Kristian Rosenvold
33   * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
34   */
35  public class Surefire621TestCountingJunit3InParallelIT
36      extends SurefireJUnit4IntegrationTestCase
37  {
38      /**
39       * SUREFIRE-1264
40       */
41      @Test
42      public void testJunit3AllParallelBuildResultCount()
43      {
44          unpack( "surefire-621-testCounting-junit3-in-parallel" )
45                  .activateProfile( "all-parallel-junit3-testcases" )
46                  .execute( "integration-test" )
47                  .assertTestSuiteResults( 6, 0, 0, 0 );
48      }
49  
50      /**
51       * SUREFIRE-621
52       */
53      @Test
54      public void testJunit3ParallelBuildResultCount()
55      {
56          unpack( "surefire-621-testCounting-junit3-in-parallel" )
57                  .failNever()
58                  .activateProfile( "parallel-junit3-testcases" )
59                  .execute( "install" )
60                  .assertTestSuiteResults( 6, 0, 0, 0 );
61      }
62  
63      /**
64       * SUREFIRE-1264
65       */
66      @Test
67      public void testJunit3BuildResultCount()
68      {
69          unpack( "surefire-621-testCounting-junit3-in-parallel" )
70                  .activateProfile( "junit3-testcases" )
71                  .execute( "integration-test" )
72                  .assertTestSuiteResults( 6, 0, 0, 0 );
73      }
74  
75      /**
76       * SUREFIRE-1264
77       */
78      @Test
79      public void testJunit3ParallelSuiteBuildResultCount()
80      {
81          unpack( "surefire-621-testCounting-junit3-in-parallel" )
82                  .activateProfile( "parallel-junit3-testsuite" )
83                  .execute( "integration-test" )
84                  .assertTestSuiteResults( 6, 0, 0, 0 );
85      }
86  
87      /**
88       * SUREFIRE-1264
89       */
90      @Test
91      public void testJunit3SuiteBuildResultCount()
92      {
93          unpack( "surefire-621-testCounting-junit3-in-parallel" )
94                  .activateProfile( "junit3-testsuite" )
95                  .execute( "integration-test" )
96                  .assertTestSuiteResults( 6, 0, 0, 0 );
97      }
98  }