2015-03-19 49 views
0

我使用Selenium IDE记录了一个测试套件。我正在测试一个简单的登录页面及其测试用例。我将测试套件导出为Java/TestNG/Remote Control.Now我使用Eclipse来打开我的转换测试suite.One更多的怀疑是有我在的Java/TestNG中/远程控制转换测试套件,但为什么它的导入JUnit的包如何使用eclipse将导出的selenium IDE测试套件运行到TestNG

login.java

package com.datadriven; 

import junit.framework.Test; 
import junit.framework.TestSuite; 

public class LoginTestsuit { 

    public static Test suite() { 
     TestSuite suite = new TestSuite(); 
     suite.addTestSuite(TC-1.1.1.class); 
     suite.addTestSuite(TC-1.1.2.class); 
     suite.addTestSuite(TC-1.1.3.class); 
     suite.addTestSuite(TC-1.1.4.class); 
     suite.addTestSuite(TC-1.1.5.class); 
     suite.addTestSuite(TC-1.1.6.class); 
     return suite; 
    } 

    public static void main(String[] args) { 
     junit.textui.TestRunner.run(suite()); 
    } 
} 

TC .1.1.1到TC1.1.6是测试套件中的测试用例。我不知道如何使用converte中的所有测试用例d测试suite.I我收到以下错误,请参阅此链接查看错误截图 http://i.stack.imgur.com/QH7zJ.png

TC-1.1.1

<?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 profile="http://selenium-ide.openqa.org/profiles/test-case"> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <link rel="selenium.base" href="http://localhost:8080/Banking/" /> 
    <title>New Test</title> 
    </head> 
    <body> 
    <table cellpadding="1" cellspacing="1" border="1"> 
    <thead> 
    <tr><td rowspan="1" colspan="3">New Test</td></tr> 
    </thead><tbody> 
    <tr> 
     <td>open</td> 
     <td>/Banking/</td> 
     <td></td> 
    </tr> 
    <tr> 
     <td>click</td> 
     <td>name=sub</td> 
     <td></td> 
    </tr> 
    <tr> 
     <td>pause</td> 
     <td></td> 
     <td>5000</td> 
    </tr> 
    <tr> 
     <td>verifyTextPresent</td> 
     <td>Enter username!</td> 
     <td></td> 
    </tr> 
    </tbody></table> 
    </body> 
    </html> 

TC-1.1.2

</thead><tbody> 
    tr> 
     <td>refresh</td> 
     <td></td> 
     <td></td> 
    </tr> 
    <tr> 
     <td>type</td> 
     <td>id=fname</td> 
     <td>Jackk</td> 
    </tr> 
    <tr> 
     <td>click</td> 
     <td>name=sub</td> 
     <td></td> 
    </tr> 
    <tr> 
     <td>verifyTextPresent</td> 
     <td>Enter password!</td> 
     <td></td> 
    </tr> 
    </tbody></table> 

TC-1.1.3

</thead><tbody> 
<tr> 
    <td>type</td> 
    <td>id=fname</td> 
    <td>Jackk</td> 
</tr> 
<tr> 
    <td>type</td> 
    <td>id=Lname</td> 
    <td>1234567</td> 
</tr> 
<tr> 
    <td>clickAndWait</td> 
    <td>name=sub</td> 
    <td></td> 
</tr> 
<tr> 
    <td>pause</td> 
    <td>5000</td> 
    <td></td> 
</tr> 
<tr> 
    <td>verifyTextPresent</td> 
    <td>Incorrect UserName or Password</td> 
    <td></td> 
</tr> 
</tbody></table> 

..和等

回答

1

试试这个:

 Check the version of Selenium IDE you are using, It should be 2.9.0, 
     Make it sure that you have TestNg integrated with eclipse, else follow these [steps][1], 

     If you still face the same issue then just remove the junit lib files from your script 
     and replace them with testng lib 
     and also do the same for the Junit annotations by replacing testng annotations 
+0

我使用硒IDE 2.9.0。我试着用替换的JUnit库到TestNG的图书馆。我是让这条线以下错误多个标记 \t - TestSuite的无法解析的类型 \t - TestSuite的无法解析的类型 \t - 行断点:LoginTestsuit [行: 12] \t - 套件() – vnnogile 2015-03-20 06:24:36

+0

你可以发送我的例子转换硒测试套件到testNG和eclipse.I测试一个简单的登录页面 – vnnogile 2015-03-20 06:29:09

相关问题