bdd

how to use capybara has_text

流过昼夜 提交于 2019-12-19 11:16:03
问题 So now I've got cucumber/capybara/selenium hitting a google app script, which is great, but for some reason I can't seem to check for text in the body of the page in the way I expect. In the debugger I can grab the page object, which I can in the browser has the expected text. Scanning the html directly shows the text appearing twice, and yet page.has_text? appears false: (rdb:1) p page.html.scan(/Introduction Video/) ["Introduction Video", "Introduction Video"] (rdb:1) p page.has_text?

How can I use ES2016 (ES7) async/await in my acceptance tests for a Koa.js app?

半世苍凉 提交于 2019-12-19 03:47:05
问题 I am in the process of writing my first Koa.js app, and having recently been introduced to the ES2016 (aka ES7) features of async / await , I wanted to make use of these. I found that my Google skills were not up to the task, and the few snippets of code I could find were either for the standard Koa (using generators) or otherwise not-as-bleeding-edge-as-ES7. See my answer below for how I got my tests running. 回答1: I'm still a beginner, so it's likely that a lot of this can be optimised

Pretty output of Gherkin feature files

不打扰是莪最后的温柔 提交于 2019-12-18 18:43:43
问题 We're building up a specification in Gherkin, and we'd like to present the feature files to the business stakeholders. How can we export all our feature files in some sort of 'pretty' format? For example: Generate a document containing all features OR integrate features into other documentation OR publish the feature files on a web portal (nicely formatted) 回答1: The best I've seen so far is Pickles; http://github.com/picklesdoc/pickles It's work in process but looks good already. Please

How to share state between scenarios using cucumber

巧了我就是萌 提交于 2019-12-18 16:59:58
问题 I have a feature "Importing articles from external website". In my first scenario I test importing a list of links from the external website. Feature: Importing articles from external website Scenario: Searching articles on example.com and return the links Given there is an Importer And its URL is "http://example.com" When we search for "demo" Then the Importer should return 25 links And one of the links should be "http://example.com/demo.html" In my steps I have the 25 links in a @result

BDD for C# NUnit

拈花ヽ惹草 提交于 2019-12-18 13:12:24
问题 I've been using a home brewed BDD Spec extension for writing BDD style tests in NUnit, and I wanted to see what everyone thought. Does it add value? Does is suck? If so why? Is there something better out there? Here's the source: https://github.com/mjezzi/NSpec There are two reasons I created this To make my tests easy to read. To produce a plain english output to review specs. Here's an example of how a test will look: -since zombies seem to be popular these days.. Given a Zombie, Peson, and

Cucumber for PHP application

大城市里の小女人 提交于 2019-12-18 12:18:37
问题 Is it possible to use Cucumber outside Rails? I'd like to start using it for testing some of my PHP applications, but I really don't know how to start. Probably the easiest way would be creating a Rails project only to run Cucumber features, but that seems like to me as overkill. What is the simplest way to set up Cucumber for testing a non-Rails application? 回答1: Check out: https://github.com/cucumber/cucumber/wiki/php It is easy to use cucumber with PHP, even managing the database. 回答2:

Cucumber for PHP application

流过昼夜 提交于 2019-12-18 12:18:02
问题 Is it possible to use Cucumber outside Rails? I'd like to start using it for testing some of my PHP applications, but I really don't know how to start. Probably the easiest way would be creating a Rails project only to run Cucumber features, but that seems like to me as overkill. What is the simplest way to set up Cucumber for testing a non-Rails application? 回答1: Check out: https://github.com/cucumber/cucumber/wiki/php It is easy to use cucumber with PHP, even managing the database. 回答2:

SpecFlow Re-usable step definitions

天大地大妈咪最大 提交于 2019-12-18 11:55:54
问题 Is there a way to have SpecFlow reuse Step Definitions? In other tools I have used a GivenWhenThen base class that contains methods such as WhenAnOrderIsCreated -- this inits a protected order member to be used by inheriting classes. Just cant seem to get this working with SpecFlow (doesnt seem to like inheritance) Is there a way to share steps across features? Many thanks 回答1: Why yes it's possible - check out the calling steps from step feature (https://specflow.org/documentation/Calling

How to find Cucumber steps that are not used

孤街醉人 提交于 2019-12-18 11:45:18
问题 I've been working with Cucumber for about a year and have been continually refactoring the features and step definitions along the way. I have tons of steps defined across many files and I can't help but feel like many of them are no longer needed. Is there a way to find which cucumber step definitions are no longer being used? 回答1: The stepdefs formatter can do this, e.g.: cucumber --dry-run -f stepdefs It will print 'NOT MATCHED BY ANY STEPS' for any non-matches. If you have any steps that

When running selenium with capybara/rails, how do I configure the server?

空扰寡人 提交于 2019-12-18 10:55:11
问题 Normally I use the rails dev server at port 3000. Capybara/Cucumber uses Capybara.server_port = 31337 . If I swap from the default driver to selenium, it looks like it tries to connect on port 80. I'm trying to understand: When using selenium, do I need to separately instantiate a test server on the test environment. If the answer to the above question is yes, how can I make it so I can seamlessly swap between web drivers without having to keep changing things? If someone has an example of a