Selenium-运行测试套件的测试套件?

Selenium-运行测试套件的测试套件?,selenium,jenkins,selenium-webdriver,selenium-ide,test-suite,Selenium,Jenkins,Selenium Webdriver,Selenium Ide,Test Suite,我正在运行一个HTML测试套件,如下所示: java-jar/var/lib/selenium/selenium-server.jar-browserSessionReuse-htmlSuite*firefox http://$HOST./test/selenium/html/TestSuite.html./target/selenium/html/TestSuiteResults.html 有没有一种方法可以在一个目录中运行所有测试套件,或者创建一个测试套件的测试套件?我对Selenium非常

我正在运行一个HTML测试套件,如下所示:

java-jar/var/lib/selenium/selenium-server.jar-browserSessionReuse-htmlSuite*firefox http://$HOST./test/selenium/html/TestSuite.html./target/selenium/html/TestSuiteResults.html


有没有一种方法可以在一个目录中运行所有测试套件,或者创建一个测试套件的测试套件?

我对Selenium非常陌生,实际上只有Selenium2。我使用TestNG作为我的测试框架,它确实支持使用xml文件的套件和套件套件,该文件指定哪些带有特定注释的测试是套件的一部分


如果您正在寻找运行suites of suites,并且您只使用Java,那么据我所知,TestNG不支持Java以外的任何东西,那么您可能会找到您想要的东西

我对硒非常陌生,而且实际上只有硒2。我使用TestNG作为我的测试框架,它确实支持使用xml文件的套件和套件套件,该文件指定哪些带有特定注释的测试是套件的一部分


如果您正在寻找运行suites of suites,并且您只使用Java,那么据我所知,TestNG不支持Java以外的任何东西,那么您可能会找到您想要的东西

我创建了一个grails脚本来自动创建一个超级测试套件。需要修改测试套件是添加测试的又一个步骤,每一级障碍都会增加开发人员拒绝编写测试的可能性

import groovy.io.FileType

includeTargets << grailsScript("Init")

target(main: "Auto-generates the TestSuite.html file needed for selenium based on selenium html tests in test/selenium/html/**") {
    File testSuiteOutputFile = new File("test/selenium/html/TestSuite.html")
    testSuiteOutputFile.delete()

    String testRows = buildTestRows()
    testSuiteOutputFile << 
"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
$testRows
</tbody></table>
</body>
</html>
"""


}

private def buildTestRows() {
    String testRows = ""
    List<File> testFiles = getAllTestFilesInSeleniumDirectory()
    testFiles.each { file ->
        def relativePath = buildFilePathRelativeToTestSuite(file)
        println "Adding $relativePath to TestSuite"
        testRows += "<tr><td><a href='${relativePath}'>${file.name}</a></td></tr>"
        testRows += "<tr><td><a href='clearCache.html'>Clear Cache</a></td></tr>"
    }
    testRows
}

private List<File> getAllTestFilesInSeleniumDirectory() {
    File testsDirectory = new File("test/selenium/html")
    def files = []
    testsDirectory.eachFileRecurse(FileType.FILES) { files << it }
    files
}

private String buildFilePathRelativeToTestSuite(File file){
    File parentDirectory = new File("test/selenium/html")

    String relativePath = file.name
    file = file.parentFile
    while( file != parentDirectory ){
        relativePath = file.name + "/" + relativePath;
        file = file.parentFile
    }
    relativePath
}

setDefaultTarget(main)

我创建了一个grails脚本来自动创建一个超级测试套件。需要修改测试套件是添加测试的又一个步骤,每一级障碍都会增加开发人员拒绝编写测试的可能性

import groovy.io.FileType

includeTargets << grailsScript("Init")

target(main: "Auto-generates the TestSuite.html file needed for selenium based on selenium html tests in test/selenium/html/**") {
    File testSuiteOutputFile = new File("test/selenium/html/TestSuite.html")
    testSuiteOutputFile.delete()

    String testRows = buildTestRows()
    testSuiteOutputFile << 
"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
$testRows
</tbody></table>
</body>
</html>
"""


}

private def buildTestRows() {
    String testRows = ""
    List<File> testFiles = getAllTestFilesInSeleniumDirectory()
    testFiles.each { file ->
        def relativePath = buildFilePathRelativeToTestSuite(file)
        println "Adding $relativePath to TestSuite"
        testRows += "<tr><td><a href='${relativePath}'>${file.name}</a></td></tr>"
        testRows += "<tr><td><a href='clearCache.html'>Clear Cache</a></td></tr>"
    }
    testRows
}

private List<File> getAllTestFilesInSeleniumDirectory() {
    File testsDirectory = new File("test/selenium/html")
    def files = []
    testsDirectory.eachFileRecurse(FileType.FILES) { files << it }
    files
}

private String buildFilePathRelativeToTestSuite(File file){
    File parentDirectory = new File("test/selenium/html")

    String relativePath = file.name
    file = file.parentFile
    while( file != parentDirectory ){
        relativePath = file.name + "/" + relativePath;
        file = file.parentFile
    }
    relativePath
}

setDefaultTarget(main)

看。它提供了一个Maven插件来批量执行Selenese套件,并将报告转换为Junit格式。最后一个对于将测试执行集成到像Jenkins这样的CI服务器非常有用,它可以生成漂亮的图表,并在出现测试错误时发出通知。

请看。它提供了一个Maven插件来批量执行Selenese套件,并将报告转换为Junit格式。最后一种方法对于将测试执行集成到像Jenkins这样的CI服务器中非常有用,它可以生成漂亮的图表,并在出现测试错误时发出通知。

不涉及任何语言。我直接运行HTML文件,不涉及语言。我正在直接运行HTML文件。我没有使用maven,也不会。我没有使用maven,也不会。我只是想澄清一下这里发生了什么,因为我面临着同样的情况。这只是创建一个带有嵌套套件的套件吗?是的。忽略clearCache.html,这将为每个单独的.html测试文件创建一行,该文件可以作为单个testSuite文件加载。在进一步进行硒测试之后,我发现ruby绑定与cucumber和rspec结合时非常好。HTML测试在某个时候崩溃了,cucumber+rspec对我来说工作得很好。使用chromedriver是一个救命稻草,而且它确实是UI测试移动web应用程序的唯一方法。我只是想澄清一下这里发生了什么,因为我面临着同样的情况。这只是创建一个带有嵌套套件的套件吗?是的。忽略clearCache.html,这将为每个单独的.html测试文件创建一行,该文件可以作为单个testSuite文件加载。在进一步进行硒测试之后,我发现ruby绑定与cucumber和rspec结合时非常好。HTML测试在某个时候崩溃了,cucumber+rspec对我来说工作得很好。使用chromedriver是一个救星,而且它确实是对移动web应用程序进行UI测试的唯一方法。