View Javadoc

1   package org.apache.maven.surefire.its;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  
22  import org.apache.maven.it.Verifier;
23  import org.apache.maven.it.util.ResourceExtractor;
24  import org.apache.maven.surefire.its.misc.HelperAssertions;
25  
26  import java.io.File;
27  import java.util.List;
28  
29  /**
30   * Basic suite test using all known versions of TestNG. Used for regression testing Surefire against old versions.
31   * To check new versions of TestNG work with current versions of Surefire, instead run the full test suite with
32   * -Dtestng.version=5.14.2 (for example)
33   *
34   * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
35   */
36  public class CheckTestNgVersionsIT
37      extends AbstractSurefireIntegrationTestClass
38  {
39  
40      public void test47()
41          throws Exception
42      {
43          runTestNgTest( "4.7" );
44      }
45  
46      // DGF SUREFIRE-375 + MAVENUPLOAD-1024
47      // The 5.0 and 5.0.1 jars on central are malformed
48  
49      public void XXXtest50()
50          throws Exception
51      {
52          runTestNgTest( "5.0" );
53      }
54  
55      public void XXXtest501()
56          throws Exception
57      {
58          runTestNgTest( "5.0.1" );
59      }
60  
61      public void test502()
62          throws Exception
63      {
64          runTestNgTest( "5.0.2" );
65      }
66  
67      public void test51()
68          throws Exception
69      {
70          runTestNgTest( "5.1" );
71      }
72  
73      public void test55()
74          throws Exception
75      {
76          runTestNgTest( "5.5" );
77      }
78  
79      public void test56()
80          throws Exception
81      {
82          runTestNgTest( "5.6" );
83      }
84  
85      public void test57()
86          throws Exception
87      {
88          runTestNgTest( "5.7" );
89      }
90  
91      public void test58()
92          throws Exception
93      {
94          runTestNgTest( "5.8" );
95      }
96  
97      public void test59()
98          throws Exception
99      {
100         runTestNgTest( "5.9" );
101     }
102 
103     public void test510()
104         throws Exception
105     {
106         runTestNgTest( "5.10" );
107     }
108 
109     public void test511()
110         throws Exception
111     {
112         runTestNgTest( "5.11" );
113     }
114 
115     public void test512()
116         throws Exception
117     {
118         runTestNgTest( "5.12.1" );
119     }
120 
121     public void test513()
122         throws Exception
123     {
124         runTestNgTest( "5.13" );
125     }
126 
127     public void test5131()
128         throws Exception
129     {
130         runTestNgTest( "5.13.1" );
131     }
132 
133     public void test514()
134         throws Exception
135     {
136         runTestNgTest( "5.14" );
137     }
138 
139     public void test5141()
140         throws Exception
141     {
142         runTestNgTest( "5.14.1" );
143     }
144 
145     public void test5142()
146         throws Exception
147     {
148         runTestNgTest( "5.14.2" );
149     }
150 
151     public void test60()
152         throws Exception
153     {
154         runTestNgTest( "6.0" );
155     }
156 
157     public void runTestNgTest( String version )
158         throws Exception
159     {
160         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/testng-simple" );
161 
162         Verifier verifier = new Verifier( testDir.getAbsolutePath() );
163         List<String> arguments = this.getInitialGoals( version );
164         arguments.add( "test" );
165 
166         executeGoals( verifier, arguments );
167         verifier.verifyErrorFreeLog();
168         verifier.resetStreams();
169 
170         IntegrationTestSuiteResults suite = HelperAssertions.parseTestResults( testDir );
171         HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, suite );
172     }
173 }