Improvement #12 尝试在Jenkins上用HtmlUnitDriver运行带@Category(Daily.class)的最重要Cases.
另整理了JSTL-1.2.jar 和 taglib-1.1.2.jar, 前者改为provided, 后者取消,因为已包含在前者内。
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
echo [INFO] run daily functional test.
|
||||
|
||||
cd %~dp0
|
||||
cd ..
|
||||
|
||||
set MAVEN_OPTS=%MAVEN_OPTS% -XX:MaxPermSize=128m
|
||||
call mvn clean integration-test
|
||||
|
||||
cd bin
|
||||
pause
|
||||
@@ -113,10 +113,7 @@
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
@@ -260,6 +257,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<configuration>
|
||||
<groups>org.springside.examples.miniweb.functional.category.Daily</groups>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- cobertura插件, 设置不需要计算覆盖率的类 -->
|
||||
<plugin>
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
</bean>
|
||||
|
||||
<!-- 項目自定义的Realm -->
|
||||
<bean id="shiroDbRealm" class="org.springside.examples.miniweb.service.account.ShiroDbRealm" />
|
||||
<bean id="shiroDbRealm" class="org.springside.examples.miniweb.service.account.ShiroDbRealm">
|
||||
<property name="accountManager" ref="accountManager"/>
|
||||
</bean>
|
||||
|
||||
<!-- Shiro Filter -->
|
||||
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
|
||||
|
||||
+16
-1
@@ -1,5 +1,7 @@
|
||||
package org.springside.examples.miniweb.functional;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@@ -10,6 +12,9 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springside.examples.miniweb.Start;
|
||||
import org.springside.modules.test.data.H2Fixtures;
|
||||
import org.springside.modules.test.functional.JettyFactory;
|
||||
@@ -34,6 +39,8 @@ public class BaseFunctionalTestCase {
|
||||
|
||||
protected static Selenium2 s;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(BaseFunctionalTestCase.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void startAll() throws Exception {
|
||||
startJetty();
|
||||
@@ -70,9 +77,16 @@ public class BaseFunctionalTestCase {
|
||||
* 创建Selenium.
|
||||
*/
|
||||
protected static void createSelenium() throws Exception {
|
||||
WebDriver driver = null;
|
||||
Properties props = PropertiesLoader.loadProperties("classpath:/application.test.properties",
|
||||
"classpath:/application.test-local.properties");
|
||||
WebDriver driver = WebDriverFactory.createDriver(props.getProperty("selenium.driver"));
|
||||
String driverName = props.getProperty("selenium.driver");
|
||||
try {
|
||||
driver = WebDriverFactory.createDriver(driverName);
|
||||
} catch (Exception e) {
|
||||
logger.error(driverName + " create fail, use HtmlUnitDriver instead");
|
||||
driver = new HtmlUnitDriver();
|
||||
}
|
||||
|
||||
s = new Selenium2(driver, Start.BASE_URL);
|
||||
}
|
||||
@@ -95,6 +109,7 @@ public class BaseFunctionalTestCase {
|
||||
s.type(By.name("password"), "admin");
|
||||
s.check(By.name("rememberMe"));
|
||||
s.click(By.id("submit"));
|
||||
assertEquals("Mini-Web示例:帐号管理", s.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -5,6 +5,7 @@ import static org.junit.Assert.*;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.springside.examples.miniweb.data.AccountData;
|
||||
@@ -13,6 +14,7 @@ import org.springside.examples.miniweb.entity.account.User;
|
||||
import org.springside.examples.miniweb.functional.BaseFunctionalTestCase;
|
||||
import org.springside.examples.miniweb.functional.Gui;
|
||||
import org.springside.examples.miniweb.functional.Gui.UserColumn;
|
||||
import org.springside.examples.miniweb.functional.category.Daily;
|
||||
import org.springside.modules.utils.Collections3;
|
||||
import org.springside.modules.utils.Threads;
|
||||
|
||||
@@ -27,6 +29,7 @@ public class UserManagerIT extends BaseFunctionalTestCase {
|
||||
* 查看用户列表.
|
||||
*/
|
||||
@Test
|
||||
@Category(Daily.class)
|
||||
public void viewUserList() {
|
||||
s.click(By.linkText(Gui.MENU_USER));
|
||||
WebElement table = s.findElement(By.id("contentTable"));
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.springside.examples.miniweb.functional.category;
|
||||
|
||||
public class Daily {
|
||||
|
||||
}
|
||||
@@ -9,7 +9,5 @@ hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||
#jdbc.driver=net.sf.log4jdbc.DriverSpy
|
||||
#jdbc.url=jdbc:log4jdbc:h2:mem:mini-web4;DB_CLOSE_DELAY=-1
|
||||
|
||||
#selenium settings
|
||||
selenium.driver=firefox
|
||||
#selenium.driver=ie
|
||||
#selenium.driver=remote:localhost:3000:firefox
|
||||
#selenium settings, options include firefox,ie,chrome,remote:localhost:3000:firefox
|
||||
selenium.driver=firefox
|
||||
@@ -125,10 +125,6 @@
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
</bean>
|
||||
|
||||
<!-- 項目自定义的Realm -->
|
||||
<bean id="shiroDbRealm" class="org.springside.examples.showcase.security.ShiroDbRealm" />
|
||||
<bean id="shiroDbRealm" class="org.springside.examples.showcase.security.ShiroDbRealm">
|
||||
<property name="accountManager" ref="accountManager"/>
|
||||
</bean>
|
||||
|
||||
<!-- Shiro Filter -->
|
||||
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
|
||||
|
||||
@@ -12,10 +12,8 @@ quartz.jdbc.url=jdbc:h2:mem:showcase-quartz4;DB_CLOSE_DELAY=-1
|
||||
quartz.jdbc.username=sa
|
||||
quartz.jdbc.password=
|
||||
|
||||
#selenium settings
|
||||
#selenium settings, options include firefox,ie,chrome,remote:localhost:3000:firefox
|
||||
selenium.driver=firefox
|
||||
#selenium.driver=ie
|
||||
#selenium.driver=remote:localhost:3000:firefox
|
||||
|
||||
#memcached settings
|
||||
memcached.url=localhost:11311
|
||||
|
||||
-2
@@ -26,7 +26,6 @@ public class WebDriverFactoryTest {
|
||||
FirefoxDriver firefoxDriver;
|
||||
@Mock
|
||||
InternetExplorerDriver internetExplorerDriver;
|
||||
|
||||
@Mock
|
||||
ChromeDriver chromerDriver;
|
||||
@Mock
|
||||
@@ -53,6 +52,5 @@ public class WebDriverFactoryTest {
|
||||
.thenReturn(remoteWebDriver);
|
||||
driver = WebDriverFactory.createDriver("remote:localhost:3000:firefox");
|
||||
assertTrue(driver instanceof RemoteWebDriver);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+11
-12
@@ -22,7 +22,7 @@
|
||||
<jersey.version>1.12</jersey.version>
|
||||
<shiro.version>1.2.0</shiro.version>
|
||||
<activemq.version>5.5.1</activemq.version>
|
||||
<jetty.version>7.6.1.v20120215</jetty.version>
|
||||
<jetty.version>7.6.2.v20120308</jetty.version>
|
||||
<h2.version>1.3.164</h2.version>
|
||||
<jackson.version>1.9.5</jackson.version>
|
||||
<slf4j.version>1.6.4</slf4j.version>
|
||||
@@ -251,11 +251,7 @@
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- WEB end -->
|
||||
|
||||
@@ -736,10 +732,6 @@
|
||||
<version>${selenium.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-htmlunit-driver</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-android-driver</artifactId>
|
||||
@@ -812,14 +804,21 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>2.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration-test</id>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- cobertura插件 -->
|
||||
|
||||
Reference in New Issue
Block a user