1 /** 2 * Copyright 2005-2015 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.testtools.selenium; 17 18 import org.junit.runners.BlockJUnit4ClassRunner; 19 import org.junit.runners.model.FrameworkMethod; 20 import org.junit.runners.model.InitializationError; 21 import org.junit.runners.model.Statement; 22 23 import java.lang.reflect.Method; 24 25 /** 26 * JUnit Test Runner to run test Automated Functional Tests. Enables bookmark mode for test methods 27 * ending in Bookmark and navigation mode for test methods ending in Nav. {@see AutomatedFunctionalTestBase}. 28 * @author Kuali Rice Team (rice.collab@kuali.org) 29 */ 30 public class AutomatedFunctionalTestRunner extends BlockJUnit4ClassRunner { 31 32 /** 33 * AutomatedFunctionalTestRunner constructor. 34 * 35 * @param type 36 * @throws InitializationError 37 */ 38 public AutomatedFunctionalTestRunner(Class<?> type) throws InitializationError { 39 super(type); 40 } 41 42 /** 43 * Test methods ending with Bookmark will have {@see AutomatedFunctionalTestBase#enableBookmarkMode} called, 44 * test methods ending with Nav will have {@see AutomatedFunctionalTestBase#enableNavigationMode} called. 45 * 46 * @param method test method to check for ending in Bookmark or Nav 47 * @param test which extends AutomatedFunctionalTestBase 48 * @return {@see BlockJUnit4ClassRunner#methodInvoker} 49 */ 50 @Override 51 protected Statement methodInvoker(FrameworkMethod method, Object test) { 52 Method testMethod = method.getMethod(); 53 if (testMethod.getName().endsWith("Bookmark")) { 54 ((AutomatedFunctionalTestBase) test).enableBookmarkMode(); 55 } else if (testMethod.getName().endsWith("Nav")) { 56 ((AutomatedFunctionalTestBase) test).enableNavigationMode(); 57 } 58 return super.methodInvoker(method, test); 59 } 60 }