嗨,我是这个框架的新手-protractor-cucumber framewor [custom] 我触犯了代码中间。 版本详细信息: 量角器:5.4.0 黄瓜:4.2.1 量角器-黄瓜框架:6.0.0 npm:5.6.0 在eclipes中执行代码: 无法得到真正的问题是什么...任何帮助将不胜感激。 谢谢..
My feature file:-----
Feature: Testing Calculator application
Scenario: Addition
Given I browse to homepage
When I enter first number and second number
And I click on go button
Then I should see the result
Config file:------------------
exports.config = {
seleniumAddress : 'http://localhost:4444/wd/hub',
framework : 'custom',
baseURI: "http://juliemr.github.io/protractor-demo/",
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs : [ '../features/test.feature'
],
/*allScriptsTimeout: 380000,
getPageTimeout: 20000,*/
cucumberOpts : {
require: ['../features/step_definitions/stepDefinitions.js'
]
},
onPrepare : function() {
browser.manage().window().maximize();
}
};
stepdefination file-------------
var { Before, Given, When, Then } = require('cucumber');
module.exports=function(){
var url="http://juliemr.github.io/protractor-demo/";
browser.get(url);
Given('I browse to homepage', function () {
// Write code here that turns the phrase above into concrete actions
browser.get(url);
return 'pending';
});
When('I enter first number and second number', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
Then('I should see the result', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
};
Error recieved----------------------------------------------
[16:23:08] I/launcher - Running 1 instances of WebDriver
[16:23:08] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[33mU[39m[33mU[39m[33mU[39m[33mU[39m[32m.[39m
Warnings:
1) Scenario: Addition # [90mfeatures\test.feature:2[39m
[33m? Given I browse to homepage[39m
[33mUndefined. Implement with the following snippet:[39m
[33m Given('I browse to homepage', function () {[39m
[33m // Write code here that turns the phrase above into concrete actions[39m
[33m return 'pending';[39m
[33m });[39m
[33m[39m
[33m? When I enter first number and second number[39m
[33mUndefined. Implement with the following snippet:[39m
[33m When('I enter first number and second number', function () {[39m
[33m // Write code here that turns the phrase above into concrete actions[39m
[33m return 'pending';[39m
[33m });[39m
[33m[39m
[33m? And I click on go button[39m
[33mUndefined. Implement with the following snippet:[39m
[33m When('I click on go button', function () {[39m
[33m // Write code here that turns the phrase above into concrete actions[39m
[33m return 'pending';[39m
[33m });[39m
[33m[39m
[33m? Then I should see the result[39m
[33mUndefined. Implement with the following snippet:[39m
[33m Then('I should see the result', function () {[39m
[33m // Write code here that turns the phrase above into concrete actions[39m
[33m return 'pending';[39m
[33m });[39m
[33m[39m
[32m√ After[39m # [90mnode_modules\protractor-cucumber-framework\lib\resultsCapturer.js:25[39m
1 scenario ([33m1 undefined[39m)
4 steps ([33m4 undefined[39m)
0m00.000s
[16:23:13] I/launcher - 0 instance(s) of WebDriver still running
[16:23:13] I/launcher - chrome #01 passed
答案 0 :(得分:0)
它是文件和文件夹名称的问题。请分别将步骤定义文件夹和文件名分别重命名为“ step_definitions”和“ stepDefinitions.js”。