Tag: cucumberjs

cucumber-js不能使用节点命令

在我的Windows机器上,在一个cucumber.js项目上,我得到: >成功就'黄瓜-js'成功了 >'C:\ Users \\ AppData \ Roaming \ npm \ cucumber-js'成功 >'C:\ Users \\ AppData \ Roaming \ npm \ cucumber-js.cmd'错误: > C:\ Users \ mayank.arora \ Documents \ tutorials \ 112_NodeJS \ Cucumber \ proj06_npm_run_test>节点 > cucumber-js module.js:340 >抛出错误; > ^ > >错误:找不到模块 >'C:\ Users \ mayank.arora \ Documents \ tutorials \ 112_NodeJS […]

如何在用Typescript和ES6编写的NodeJS中运行黄瓜testing

运行在Typescript和ES6中编写的CucumberJS BDDtesting的正确方法是什么? 我想先打印字体代码到es6,然后用babel把它变成es5。 我可以从npmtesting像node_modules / .bin / babel-node node_modules / .bin / cucumber.js ./test/features那样运行它,但是如何添加打字稿和babel? 是否有像Karma这样可以很容易地与Webpack集成的后端testing运行器?

在使用CucumberJs进行场景失败后,截图并重新启动浏览器

我想用cucumberjs做一个相对简单的场景。 即在场景失败后,我想重新启动浏览器,以便它回到下一个场景的初始状态。 这是我的尝试 this.After({timeout: 30 * 1000}, function (scenario) { if(scenario.isFailed()) { return browser.takeScreenshot().then(function (buffer) { console.log("Restarting The Browser As We Got A Failure"); browser.restart(); console.log("Finished Restarting The Browser"); return scenario.attach(new Buffer(buffer, 'base64'), 'image/png'); }); } }); 它是在testing场景结束时运行的cucumberjs钩子中实现的。 但是,当框架在下一个testing场景中使用浏览器时,会引发如下exception [firefox #01] Step Definition: StepDefinitions\_Lpewf_Tc_04_steps.js:6 [firefox #01] Message: [firefox #01] UnsupportedOperationError: This driver instance does not […]

在cucumberjs,量angular器快速失败

我添加了失败的快速到我的cucumberOpts如下: cucumberOpts: { require: [ conf.paths.e2e + '/utilities/hooks.js', ], format: 'pretty', 'fail-fast': true }, 我有我所有的testing在这样的path:C:/testing/ *。function 我像这样运行我的testing: protractor protractor.conf.js 这工作正常,因为它会在出现错误时立即停止testing。 但是我正在使用像Bamboo这样的CI服务器运行这些testing,我希望能够提供快速的反馈,同时继续运行其余的testing。 所以,如果我4 tests in total有4 tests in total , if the first test fails , I want to fail-fast on that first test if the first test fails ,那么I want to continue running the other […]

Supertest在黄瓜延迟

我在黄瓜步骤文件中使用supertest向Docker中运行的API发出请求。 另外,我正在使用带有示例的场景大纲,以便请求被执行4次。 编辑:我发现,在黄瓜的第一个请求,我在我的docker日志中得到这个错误:“未能build立9P连接:抓住底层stream的EOF”。 但它只发生一次,从来没有从浏览器或邮递员。 given.js: const request = require('supertest'); module.exports = function givens() { this.Given(/^then system is active$/, function (callback) { this.request = request.agent('http://localhost:8787'); callback(); }); } 然后: module.exports = function whens() { this.When(/^the client requests a list of questions with the parameters of "([^"]*)" and "([^"]*)" and "([^"]*)" and "([^"]*)" and "([^"]*)" and "([^"]*)"$/, […]

如何判断哪个文件被Babel 6转发?

我有一个使用babel-register的项目,当在Node 6.6项目中需要该模块时,将ES6源代码dynamic地转换为ES5。 我已经阅读了babel-register钩子到Node的require函数中,以便在你尝试加载的时候传输一个文件,但是我并不总是清楚哪些文件会受到这个变化的影响。 当我编写testing的时候,这个问题对我来说有很大的帮助:只有我的生产代码能够被转译,或者testing代码是否被转译?这就引出了一个更一般的问题,这就是本文的主题: 我怎样才能知道何时Babel正在运行,哪些文件正在被转发? 示例代码 比方说,我有这样的生产类是用ES6语法编写的 //src/greeter.js export default class Greeter { sayHello() { return 'Hello World'; } } 而Babel被configuration为像这样( .babelrc ) { "presets": ["es2015"] } 然后有一些testing代码 //features/step_definitions/greeter_steps.js import Greeter from '../../src/greeter'; //Causes greeter.js to be transpiled import expect from 'expect'; var stepWrapper = function() { //Does Babel try to transpile this code too? […]

Webdriverio黄瓜不能使用承诺

我试图用webdriverIO学习更多的cucumberjs,并且在启动testing时遇到一些麻烦。 其实我想涵盖这个简单的function: Feature: Example Feature In order to become productive As a test automation engineer I want to understand the basics of cucumber Scenario: My First Test Scenario Given I have open "https://google.com" Then the title should be "Google". And the bar should be empty. 有了这个testing: const assert = require('assert'); module.exports = function() { this.Given(/^I […]

cucumberjs:发现一个步骤结果是失败的

任务 : 使用selenium,webdriver,cucumberjs执行自动验收testing。 find一个失败的验收testing场景并截取该页面 除此之外,作为一个人工制品在去pipe道。 那是我今天的任务。 我已经完成了所有这些工作,包括编写场景testing,selenium安装,pipe道和其他一切需要的东西。 唯一的问题是 – 我无法弄清楚如何find一个失败的scheme步骤,并采取页面的屏幕截图。 问题详细信息 :我将以下代码放置在我的步骤定义中,这是针对每个scheme步骤运行的 //file: features/setpdefinitions/common.step.js var commonWrapper = function commonWrapper() { this.World = require('../support/world').World; this.Before(function (next) { this.initBrowser(next); }); this.After(function (next) { this.browser.quit(next); }); this.StepResult(function (event, callback) { var stepResult = event.getPayloadItem('stepResult'); console.log(stepResult.isFailed()); callback(); }); }; module.exports = commonWrapper; World包含浏览器启动方法。 这是我正在testing的示例function场景 Feature: Forgot Password As a […]

我如何使用GruntJS运行一个特定的CucumberJSfunction?

我使用CucumberJS在我的NodeJSnetworking应用程序上运行testing。 目前,我可以使用grunt cucumberjs执行grunt ,或者只执行CucumberJS任务来运行所有的咕噜任务。 但是现在我只想执行特定的function。 例如,说我有以下function文件: Signin.feature Favourite.feature 我只想运行最喜欢的functiontesting,使用如下命令: grunt cucumberjs Favourite 这可能吗? 顺便说一句,这是我的gruntfile.js : 'use strict'; module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), … cucumberjs: { src: 'features', options: { steps: 'features/step_definitions', format: 'pretty' } } }); … grunt.loadNpmTasks('grunt-cucumber'); grunt.registerTask('default', [… 'cucumberjs']); };