View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.surefire.its;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  import org.apache.maven.surefire.its.fixture.OutputValidator;
25  import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
26  import org.junit.Test;
27  import org.junit.runner.RunWith;
28  import org.junit.runners.Parameterized;
29  import org.junit.runners.Parameterized.Parameter;
30  import org.junit.runners.Parameterized.Parameters;
31  
32  import static java.nio.charset.StandardCharsets.UTF_8;
33  
34  /**
35   *
36   */
37  @RunWith(Parameterized.class)
38  @SuppressWarnings("checkstyle:magicnumber")
39  public class JUnitPlatformIT extends SurefireJUnit4IntegrationTestCase {
40      @Parameter
41      @SuppressWarnings("checkstyle:visibilitymodifier")
42      public String junit5Version;
43  
44      @Parameter(1)
45      @SuppressWarnings("checkstyle:visibilitymodifier")
46      public String jqwikVersion;
47  
48      @Parameters(name = "{0}")
49      public static Iterable<Object[]> artifactVersions() {
50          List<Object[]> args = new ArrayList<>();
51          args.add(new Object[] {"5.2.0", "0.8.0"});
52          args.add(new Object[] {"5.3.2", "0.9.0"});
53          args.add(new Object[] {"5.4.2", "1.0.0"});
54          args.add(new Object[] {"5.5.2", "0.8.15"});
55          args.add(new Object[] {"5.6.2", "1.3.5"});
56          args.add(new Object[] {"5.7.2", "1.5.5"});
57          args.add(new Object[] {"5.8.2", "1.6.5"});
58          args.add(new Object[] {"5.9.1", "1.7.1"});
59          args.add(new Object[] {"5.10.2", "1.8.5"});
60          args.add(new Object[] {"5.11.0-M2", "1.8.5"});
61          return args;
62      }
63  
64      @Test
65      public void testVintageEngine() {
66          unpack("junit-platform-engine-vintage", "-" + junit5Version + "-" + jqwikVersion)
67                  .sysProp("junit5.version", junit5Version)
68                  .sysProp("jqwik.version", jqwikVersion)
69                  .executeTest()
70                  .assertTestSuiteResults(1, 0, 0, 0);
71      }
72  
73      @Test
74      public void testJQwikEngine() {
75          unpack("junit-platform-engine-jqwik", "-" + junit5Version + "-" + jqwikVersion)
76                  .sysProp("junit5.version", junit5Version)
77                  .sysProp("jqwik.version", jqwikVersion)
78                  .executeTest()
79                  .assertTestSuiteResults(1, 0, 0, 0);
80      }
81  
82      @Test
83      public void testMultipleEngines() {
84          OutputValidator validator = unpack("junit-platform-multiple-engines", "-" + junit5Version + "-" + jqwikVersion)
85                  .sysProp("junit5.version", junit5Version)
86                  .sysProp("jqwik.version", jqwikVersion)
87                  .executeTest()
88                  .assertTestSuiteResults(7, 0, 0, 0);
89  
90          validator
91                  .getSurefireReportsFile("TEST-junitplatformenginejupiter.BasicJupiterTest.xml", UTF_8)
92                  .assertContainsText("<testcase name=\"test(TestInfo)\" "
93                          + "classname=\"junitplatformenginejupiter.BasicJupiterTest\"")
94                  .assertContainsText("<testcase name=\"add(int, int, int)[1]\" "
95                          + "classname=\"junitplatformenginejupiter.BasicJupiterTest\"")
96                  .assertContainsText("<testcase name=\"add(int, int, int)[2]\" "
97                          + "classname=\"junitplatformenginejupiter.BasicJupiterTest\"")
98                  .assertContainsText("<testcase name=\"add(int, int, int)[3]\" "
99                          + "classname=\"junitplatformenginejupiter.BasicJupiterTest\"")
100                 .assertContainsText("<testcase name=\"add(int, int, int)[4]\" "
101                         + "classname=\"junitplatformenginejupiter.BasicJupiterTest\"");
102     }
103 }