硒2的JUnit测试套件 [英] JUnit Test Suite for Selenium 2

查看:85
本文介绍了硒2的JUnit测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将Selenium Test Suite从Selenium IDE转换为JUnit,并尝试从eclipse执行.但是我的

I have converted a Selenium Test Suite into JUnit from Selenium IDE, and trying to execute from eclipse. But there is an error in my script in

suite.addTestSuite(Open_Google_IE.class);
suite.addTestSuite(Open_Google_FireFox.class);

错误消息:类型为TestSuite的方法addTestSuite(Class)不适用于参数(类).

Error message: The method addTestSuite(Class) in the type TestSuite is not applicable for the arguments (Class).

请告知可能是什么原因.我还验证了在Webdriver中创建测试套件,并更新了测试套件,但仍然抛出该错误.

Please advise what could be the reason. I have also verified Creating Test Suite in Webdriver and updated test suite but still throws that error.

JUnit TestSuite

JUnit TestSuite

import junit.framework.Test;
import junit.framework.TestSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses(value = {Open_Google_IE.class, Open_Google_FireFox.class})

public class OpenGoogle {

    public static Test suite() {
        TestSuite suite = new TestSuite();
        suite.addTestSuite(Open_Google_IE.class);
        suite.addTestSuite(Open_Google_FireFox.class);
        return suite;
    }

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

推荐答案

据我所知,代码还可以.

As far as I can see, the code is OK.

addTestSuite()只能采用扩展junit.framework.TestCase的类.请确保您的课程扩展了该课程,或者找到另一种方法...

addTestSuite() can only take classes that extend junit.framework.TestCase. Please make sure your classes extend that one, or find another way around...

这篇关于硒2的JUnit测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆