vnnogile
vnnogile

Reputation: 33

How to run a exported selenium ide test suite intoTestNG using eclipse

I recorded a test suit using Selenium IDE .I am testing a simple login page with its test cases.I exported the test suite as Java/TestNG/Remote Control.Now I am using eclipse to open my converted test suite.One more doubt is there i converted test suite in Java/TestNG/Remote Control but why its importing junit packages

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 to TC1.1.6 are my test cases in test suite.I dont know how to use relate all this test cases in converted test suite.I am getting following error please refer this link to see error screenshot https://i.sstatic.net/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>

..and so on

Upvotes: 0

Views: 565

Answers (1)

karunakar sapogu
karunakar sapogu

Reputation: 117

Try this:

       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 

Upvotes: 1

Related Questions