0

I have a system with Web-interface that has login/password authorization. I need to come up with an automated test which involves running 100 tests simultenously. Each test is going to use different username/userpassword pair. For example, user1/PaSsWord1, user2/PaSsWord2, ..., user100/PaSsWord100. After login, a user is supposed to do the same operation.

Due to some reasons, I can't use the system API and unit tests here. I really need to come up with UI-based tests. The type of browser (FF, IE, Chrome) doesn't matter.

So I want to use WebDriver. Say, with Groovy. I have no problems with automating login and executing an operation. And I can easily parametrize them to use different users/passwords. But I'm wondering how to organize running 100 tests simultaneously on the same machine?. Is it doable? Are there strategy/methodologies to do this kind of thing that proved to be successful? Any ideas?

Thanks, Racoon

4

1 回答 1

3

我没有在这里提供任何答案,而是让您思考可以做什么的想法。

首先,您将无法在本地运行此测试。想想如果你在 Chrome 中打开 100 个标签会发生什么。你的系统会崩溃。设置可以支持 100 个 RemoteWebDriver 实例的Selenium 集线器和节点系统(称为网格)。基本上,网格是您的控制器,它提供由它知道的节点持有的可用驱动程序。 酱实验室是这样做的一种方式。

现在困难的部分是创建将产生那么多线程的测试。这是一些伪代码来显示简单的方法。我不确定线程​​有什么样的限制。即使你说你想要那么多,它实际上可能一次只创建 10 个左右的线程,所以这可能行不通。

public void Test()
{
    threads (100) execute
    {
        try
        {
            spawn new remote web driver instance
            run test
        }
        finally
        { 
            quit driver instance 
            //in finally block since you want the driver to always close 
            //even on assert fails or exceptions
        }
    }
}

如果你的盒子可以处理它,这里是一种同时执行 100 个左右脚本的 linux/cygwin 方式。您可以像编写测试一样编写测试,然后并行执行 100 次。

于 2013-09-04T16:39:41.673 回答