用selenium进行集成测试

按照常规做法,集成测试应该由测试部的测试人员来做,然而大对于中小公司来说可能成本太高。所以这个工作就要有开发人员来做了 。做开发也不容易啊 :(
而thougtworks开发的selenium就是为开发人员度身定制的一个集成测试工具
闲话不多说 下面就开始我们的配置工作
1.下载selenium-core包: http://www.openqa.org/selenium-core/最近版本是0.8.3
2.解压后有几个目录:core tests jsunit等,拷贝core tests到应用根目录下,打开测试主页http://localhost:8080/showradio/core/TestRunner.html,这就是selenium的控制台,点击左侧的‘GO’按钮,运行测试用例 出现的是selenium自带的一些测试用例的结果
至此配置完成。
下一步开始定义测试用例,
myTest.html
    <table cellpadding="1" cellspacing="1" border="1">
    <tbody>
        <tr>
            <td rowspan="1" colspan="3">测试首页<br>
            </td>
        </tr>
        <tr>
            <td>open</td>
            <td>/showradio/index.jsp</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>verifyTextPresent</td>
            <td></td>
            <td>秀radio 中国第一网络电台</td>
        </tr>
        
    </tbody>
	</table>

open 是selenium的一条指令 打开页面/showradio/index.jsp
verifyTextPresent也是指令 检验页面是否存在指定文本
了解指令请参考 http://wiki.springside.org.cn/display/springside/Selenium+Reference
把myTest。html添加到 tests/TestSuit.html中
<tr><td><a href="./showradio/TestIndex.html">我的测试</a></td></tr>

点击http://localhost:8080/showradio/core/TestRunner.html页面的 GO 按钮
进入测试用例列表页, 点击右侧的execute tests 运行测试。
具体用法请参考官网 
http://www.openqa.org/selenium-core/usage.html

你可能感兴趣的:(html,jsp,工作,网络应用,Go)