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

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

问题描述

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

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天全站免登陆