Java 使用Web界面或任何可视化工具运行SeleniumWebDriver测试

Java 使用Web界面或任何可视化工具运行SeleniumWebDriver测试,java,testing,selenium,webdriver,automated-tests,Java,Testing,Selenium,Webdriver,Automated Tests,我有一套用Java编写的SeleniumWebDriver测试 有没有带web界面的框架可以运行它们 此web界面应显示所有测试的列表、运行一个或所有测试的能力以及显示其运行结果。Hm.不能确定web界面,但在我看来,您应该在@Category注释方向进行更深入的调查。 对于我的项目,我使用maven build manager。使用@Category符号,您可以向maven显示构建中应该包含哪些测试类别以及应该排除哪些类别 以下是我在项目中使用的结构示例: rms-web pom:

我有一套用Java编写的SeleniumWebDriver测试

有没有带web界面的框架可以运行它们


此web界面应显示所有测试的列表、运行一个或所有测试的能力以及显示其运行结果。

Hm.不能确定web界面,但在我看来,您应该在
@Category
注释方向进行更深入的调查。 对于我的项目,我使用maven build manager。使用@Category符号,您可以向maven显示构建中应该包含哪些测试类别以及应该排除哪些类别

以下是我在项目中使用的结构示例:

  rms-web pom:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.11</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.12</version>
                    </dependency>
                </dependencies>
                                <configuration>
                    <!--<includes>-->
                        <!--<include>**/*.class</include>-->
                    <!--</includes>-->
                    <excludedGroups>com.exadel.rms.selenium.SeleniumTests</excludedGroups>

                </configuration>

            </plugin>



PassTest.java
package com.exadel.rms.selenium;

import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertTrue;

/**
 * Created with IntelliJ IDEA.
 * User: ypolshchykau
 * Date: 8/28/12
 * Time: 8:38 PM
 * To change this template use File | Settings | File Templates.
 */
public class PassTest {


    @Test
    public void pass() throws IOException, InterruptedException {
        assertTrue(true);
    }
}


SeleniumTests.java

package com.exadel.rms.selenium;

/**
 * Created with IntelliJ IDEA.
 * User: ypolshchykau
 * Date: 8/27/12
 * Time: 6:49 PM
 * To change this template use File | Settings | File Templates.
 */
public class SeleniumTests {
}


LoginPageTestSuite.java
package com.exadel.rms.selenium;

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;

import java.io.IOException;

@Category(SeleniumTests.class)
public class LoginPageTestSuite extends BaseSeleniumTest {


    @Test
    public void pressLoginButton() throws IOException, InterruptedException {
        doLogout();
        fluentWait(By.cssSelector(propertyKeysLoader("login.loginbutton"))).click();

        Assert.assertTrue(fluentWait(By.cssSelector(propertyKeysLoader("login.validator.invalidautentication"))).getText().trim().equals("Invalid authentication"));
    }
…..........
}

假设你能得到更多的信息 关于maven呢
希望这对您有所帮助)

目前还没有现成的“web界面”,但CI(持续集成)服务器和软件在这方面做得很好


例如,TeamCity可以完全满足您的要求,但仅凭Selenium和您的测试框架(NUnit、Junit等)是无法实现的。

简化为:


您可以使用Jenkins(CI工具)ANT(BUILD.xml)一起运行TestNG Framework>并与您的WebDriver脚本相结合

您可以通过将Ant(build.xml)与TestNG框架结合使用来创建测试套件。build.xml由Ant以两种方式运行: 1.使用IDE(如Eclipse)
2.在命令提示符下

Maven代替ApacheAnt也可用于运行测试套件一组测试也可通过使用TestNgWeb界面通过Java编程运行考虑到Web界面,您可以使用Jenkins。Jenkins中的测试可以由Ant或Maven配置
mvn -Dmaven.buildNumber.docheck=false -Dmaven.buildNumber.doUpdate=false clean test