有没有一种方法可以加快AngularJS量角器测试? [英] Is there a way to speed up AngularJS protractor tests?

查看:104
本文介绍了有没有一种方法可以加快AngularJS量角器测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的应用程序创建了测试.一切正常,但运行缓慢,即使仅对应用程序的1/3进行了测试,保护者仍然需要大约十分钟来创建测试数据,填写字段,单击提交按钮等.

I have created tests for my application. Everything works but it runs slow and even though only 1/3 of the application is tested it still takes around ten minutes for protrator to create the test data, fill out the fields, click the submit button etc.

我正在使用Google Crome进行测试.当我看着量角器一次又一次地填写字段时,这似乎很慢.

I am using Google Crome for the testing. It seems slow as I watch protractor fill out the fields one by one.

这是我的测试套件的示例:

Here's an example of my test suite:

suites: {
    login: ['Login/test.js'],            
    homePage: ['Home/test.js'],          
    adminPage: ['Admin/Home/test.js'],
    adminObjective: ['Admin/Objective/test.js'],
    adminObjDetail: ['Admin/ObjectiveDetail/test.js'],
    adminTopic: ['Admin/Topic/test.js'],
    adminTest: ['Admin/Test/test.js'],
    adminUser: ['Admin/User/test.js'],
    adminRole: ['Admin/Role/test.js']
},

这是一个测试组:

    login: ['Login/test.js'],            
    homePage: ['Home/test.js'],          
    adminUser: ['Admin/User/test.js'],
    adminRole: ['Admin/Role/test.js']

这是另一个测试组:

    adminPage: ['Admin/Home/test.js'],
    adminObjective: ['Admin/Objective/test.js'],
    adminObjDetail: ['Admin/ObjectiveDetail/test.js'],
    adminTopic: ['Admin/Topic/test.js'],
    adminTest: ['Admin/Test/test.js'],

这两个组可以独立运行,但是它们必须按照我上面的顺序运行.回答完之后,我确实阅读了有关共享的信息,但是由于需要按顺序运行测试,因此我不确定这是否对我有帮助.理想情况下,我希望一组测试在一个浏览器中运行,而另一组在另一浏览器中运行.

The two groups can run independently but they must run in the order I have above. After the answers I did read about sharing but I am not sure if this helps my situation as my tests need to be run in order. Ideally I would like to have one set of tests run in one browser and the other set in another browser.

我阅读了有关PhantomJS之类的无头浏览器的信息.有没有人有更快的经验? 任何有关如何执行此操作的建议将不胜感激.

I read about headless browsers such as PhantomJS. Does anyone have experience with these being faster? Any advice on how I could do this would be much appreciated.

推荐答案

我们当前使用的是"shardTestFiles :true"并行运行我们的测试,如果您有多个测试,这可能会有所帮助.

We currently use "shardTestFiles: true" which runs our tests in parallel, this could help if you have multiple tests.

我不确定您在这里测试什么,无论是数据创建还是最终结果.如果是后者,则可能要考虑模拟数据创建,或者以其他方式绕过UI.

I'm not sure what you are testing here, whether its the data creation or the end result. If the latter, you may want to consider mocking the data creation instead or bypassing the UI some other way.

这篇关于有没有一种方法可以加快AngularJS量角器测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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