1 package org.apache.maven.surefire.its; 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 * Tests the JUnit 47 provider with the cucumber runner. At the moment, they don't play along that perfectly (minor 27 * glitches in the reports with parallel=classes), but at least all tests are executed, the execution times are counted 28 * correctly and failing tests are reported. The main problem that the junit47 provider has with the cucumber runner is 29 * that the junit Description instance created by the runner has a null test class attribute. 30 * 31 * @author agudian 32 */ 33 public class JUnit47WithCucumberIT 34 extends SurefireJUnit4IntegrationTestCase 35 { 36 37 @Test 38 public void testWithoutParallel() 39 { 40 // 8 tests in total is what's probably correct 41 doTest( "none", 8 ); 42 } 43 44 @Test 45 public void testWithParallelClasses() 46 { 47 // with parallel=classes, we get 9 tests in total, 48 // as the dummy "scenario" test entry is reported twice: once as success, and once with the failure from the 49 // failing test step 50 doTest( "classes", 9 ); 51 } 52 53 private void doTest( String parallel, int total ) 54 { 55 unpack( "junit47-cucumber" ) 56 .sysProp( "parallel", parallel ) 57 .sysProp( "threadCount", "2" ) 58 .executeTest() 59 .assertTestSuiteResults( total, 0, 2, 0 ); 60 } 61 }