问题描述
我开发一个应用程序AngularJS并希望做终端2终端的测试用量角器。我想从该套件在Browserstack可用的测试浏览器,而不是受益,并运行本地硒服务器上Browserstack自动化测试。
I'm developing an AngularJS app and want to do end-2-end testing with Protractor. I would like to benefit from the suite of test browsers available at Browserstack and run the tests on Browserstack Automate instead of a local Selenium server.
我如何建立一个系统来运行这些测试?
How do I set up a system to run these tests?
推荐答案
您需要有和安装。请与节点您的节点版本--version
,以确保它比v0.10.0更大。
Prerequisites
You will need to have node and npm installed. Check your node version with node --version
to ensure it is greater than v0.10.0.
准备好了吗?
使用NPM来在全球安装量角器:
Use npm to install Protractor globally with:
npm install -g protractor
如果你的错误,你可能需要运行上面的命令sudo的。
If you get errors, you might need to run the above command as sudo.
下面是安装和使用量角器更详细的的,安装seleniun网络驱动程序:
Following Browserstack's instructions for setting up node.js, install the seleniun web driver:
npm install -g browserstack-webdriver
3。设置量角器配置
创建的 protractor.conf.js 的文件(见 BrowserStack的支持能力)
exports.config = {
capabilities: {
'browserstack.user' : 'my_user_name',
'browserstack.key' : 'my_secret_key',
// Needed for testing localhost
'browserstack.local' : 'true',
// Settings for the browser you want to test
// (check docs for difference between `browser` and `browserName`
'browser' : 'Chrome',
'browser_version' : '36.0',
'os' : 'OS X',
'os_version' : 'Mavericks',
'resolution' : '1024x768'
},
// Browserstack's selenium server address
seleniumAddress: 'http://hub.browserstack.com/wd/hub',
// Pattern for finding test spec files
specs: ['test/**/*.spec.js']
}
更改用户名和密钥到Browserstack自动化页面上给出的那些。如果你到Browserstack记录,设立node.js的指示将你的用户和替代各例中键,你可以从那里复制粘贴的JavaScript。
Change your user name and secret key to the ones given on the Browserstack Automate page. If you're logged in to Browserstack, the instructions for setting up node.js will have you user and key substituted in the examples, and you can just copy-paste the javascript from there.
在同一页也有产生code不同的测试浏览器设置的工具。
The same page also has a tool for generating the code for different test browser settings.
从href=\"http://www.browserstack.com/automate/node#setting-local-tunnel\"> Node.js的说明页一的,甚至可以看到测试浏览器的更新直播截图。
You can watch the test run on Browserstack Automate and even see an updating live screenshot of the test browser.
这篇关于在Browserstack运行自动化测试量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!