bdd

How to mock UIApplication in Swift?

不打扰是莪最后的温柔 提交于 2019-12-03 10:56:04
I'm currently using Quick + Nimble for my unit testing in Swift. I'm building an Inviter class that sends app invites via different methods. I need to mock out UIApplication to verify that my code calls openURL . My code so far: import Quick import Nimble import OCMock extension Inviter { convenience init(usingMockApplication mockApplication: UIApplication) { self.init() application = mockApplication } } class MockUIApplication : UIApplication { var application = UIApplication.sharedApplication() var openedURL: String? override func openURL(url: NSURL) -> Bool { openedURL = url.absoluteString

How to test for exceptions thrown using xUnit, SubSpec and FakeItEasy

不羁的心 提交于 2019-12-03 10:37:48
I’m using xUnit, SubSpec and FakeItEasy for my unit tests. I’ve so far created some positive unit tests like the following: "Given a Options presenter" .Context(() => presenter = new OptionsPresenter(view, A<IOptionsModel>.Ignored, service)); "with the Initialize method called to retrieve the option values" .Do(() => presenter.Initialize()); "expect the view not to be null" .Observation(() => Assert.NotNull(view)); "expect the view AutoSave property to be true" .Observation(() => Assert.True(view.AutoSave)); But now I want to write some negative unit tests and check that certain methods don't

How do I test error conditions in HTML5 pages with cucumber?

流过昼夜 提交于 2019-12-03 10:28:26
I am testing web application behavior with Cucumber (using Selenium and Watir under the hood). My web app has HTML5 pages and makes use of the new "required" attribute. If I have a data entry form with a required field, and I submit that form with the field blank, I would like to verify that the web app correctly responds with an error condition. Unfortunately, when testing using an HTML5 web browser, the error message that pops up on a failed field validation does not appear to be accessible to Cucumber through the web driver. In any case, the form is not submitted and the page remains on the

Rails 4 Paperclip FactoryGirl file uploading

元气小坏坏 提交于 2019-12-03 08:31:24
I have a FactoryGirl :product factory that uses fixture_file_upload to set image , which is a Paperclip attachment. image { fixture_file_upload "#{Rails.root}/spec/fixtures/images/product.png", 'image/png' } fixture_file_upload works fine, but every time a test creates a new Product using the factory, Paperclip creates a new file in publicproducts/<id>/original.png . This is the issue. . Filling a the folder publicproducts on each test run is not acceptable. The first workaround I can think of is the solution mentioned in https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Cleanup

spinach vs cucumber for BDD in rails

依然范特西╮ 提交于 2019-12-03 07:58:29
问题 I am starting on BDD. Was wondering which would be better to start with Cucumber or Spinach. My impression is that Spinach is new off the block. Look here Which one should I start with. The criteria would be - Support across the board. Flexibility of use Third party tool and APIs integration. Again it might be ignorant question of the newbie: Where does capybara fit into the picture. 回答1: For some context, I've been a long time user of Cucumber, but always wished it was Spinach since day one.

Checking object equality in Jasmine

家住魔仙堡 提交于 2019-12-03 07:20:50
问题 Jasmine has built-in matchers toBe and toEqual . If I have an object like this: function Money(amount, currency){ this.amount = amount; this.currency = currency; this.sum = function (money){ return new Money(200, "USD"); } } and try to compare new Money(200, "USD") and the result of sum, these built-in matchers will not work as expected. I have managed to implement a work-around based on a custom equals method and custom matcher, but it just seems to much work. What is the standard way to

Is it possible to use DDD and BDD together?

泄露秘密 提交于 2019-12-03 06:46:17
问题 I like the middle-out development that is achieved with DDD. Development is driven by domain, the most solid part of application. We don't depend on infrastructure, persistence and presentation. That sounds good. But it has no business value. Here comes business-focused BDD with outside-in development. We have no upfront domain design (choosing entities, value objects, aggregates). We take user story, write some scenarios and implement them one-by-one. We start development from most

How do I do unit & integration testing in a BDD style in ASP.NET MVC?

寵の児 提交于 2019-12-03 05:58:52
I am learning Behavior Driven Development with ASP.NET MVC and, based on a post from Steve Sanderson, understand that BDD can mean, at least, the following test types: individual units of code & UI interactions. Something similar is mentioned in this post . Do I need two different test frameworks if I want both unit and integration testing? Unit testing repositories, controllers, & services using a context/specification framework, like MSpec. The results of testing with this will be useful to the development team. Testing complete behaviors (integration) using a given/when/then framework, like

Cucumber with TestNG

本秂侑毒 提交于 2019-12-03 05:38:40
We have a very extensive framework in TestNG with Selenium WebDriver and I want to be able to continue using it, but use Cucumber BDD with it.I am aware that Cucumber works with JUnit, but not sure if it works with TestNG. Can anyone let me know if this is going to be available anytime soon ? If not, are there any workarounds so that I can use Cucumber with TestNG? Also, are there any other BDDs that are available in the market which can be used with TestNG ? Dependency in maven's pom: <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-testng</artifactId> <version>1.1.5</version>

BDD framework for the frontend?

混江龙づ霸主 提交于 2019-12-03 05:06:09
问题 On the server side we have Rspec/Cucumber for BDD development (ruby) vowsjs (node.js) Is there a BDD frameworks to use on web browsers (not qUnit or YUI test since these are only for TDD)? 回答1: Check out jasmine describe("Jasmine", function() { it("makes testing JavaScript awesome!", function() { expect(yourCode).toBeLotsBetter(); }); }); http://pivotal.github.com/jasmine/ https://github.com/pivotal/jasmine Should_be ( sic ) very familiar to a ruby person 回答2: You could also look at Yadda.