bdd

How to use bdd naming style with Resharper 4.5?

廉价感情. 提交于 2019-12-21 07:11:04
问题 I just upgraded to Resharper 4.5 and now see that all my BDDish test methods are marked as not conforming to the naming standard. My naming convention is like this: public void Something_ShouldHaveThisResult() Resharper doesn't like the underscore in the method. Is there a way to turn this off, just for test methods? I have a normal naming convention for the rest of my code. 回答1: On the menu: Resharper | Options -> Languages -> Common -> Naming Style: remove what ever naming style you want.

jasmine unit testing - testing for an undefined property of an object

无人久伴 提交于 2019-12-21 06:48:08
问题 I have the following statement expect(A.["BAR"].name).toEqual("foo"); which due to the fact my object A has the top level property "BAR" and bar has the value "foo" passes. I'd like to test my structure to confirm a property "NONEXISTINGPROP" has not be defined. e.g. expect(A.["NONEXISTINGPROP"].name).not.toBeDefined(); However I seem to get "TypeError: A.[NONEXISTINGPROP] is undefined" in the jasmine test runner this is exactly what I want to confirm. Any idea why Jasmine is crying. I was

how do I test (rspec) a http request that takes too long?

纵然是瞬间 提交于 2019-12-21 05:15:07
问题 How do I test the behavior if a request takes too long with rspec? I am thinking of using thread to mock this: describe "Test" do it "should timeout if the request takes too long" do lambda { thread1 = Thread.new { #net::http request to google.com } thread2 = Thread.new { sleep(xx seconds) } thread1.join thread2.join }.should raise_error end end I want to make sure that after the request is first made, another thread "kicks in" which in this case is just a sleep for xx seconds. Then I should

Specflow use parameters in a table with a Scenario Context

左心房为你撑大大i 提交于 2019-12-21 03:57:23
问题 I am using Specflow in C# to build automatic client side browser testing with Selenium. The goal of these tests is to simulate the business scenario where a client enters our website in specific pages, and then he is directed to the right page. I Want to use parameters inside a Scenario Context, for example: When I visit url | base | page | parameter1 | parameter2 | | http://www.stackoverflow.com | questions | <questionNumber> | <questionName> | Then browser contains test <questionNumber>

How to mock UIApplication in Swift?

不羁岁月 提交于 2019-12-21 03:39:11
问题 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

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

回眸只為那壹抹淺笑 提交于 2019-12-21 03:33:36
问题 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

Cucumber with TestNG

蹲街弑〆低调 提交于 2019-12-20 18:09:45
问题 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 ? 回答1: Dependency in maven's pom:

Cucumber with TestNG

橙三吉。 提交于 2019-12-20 18:09:06
问题 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 ? 回答1: Dependency in maven's pom:

Should I use specflow at unit test level? [duplicate]

落花浮王杯 提交于 2019-12-20 12:24:12
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: SpecFlow/BDD for Unit Tests? Over the last few years I have worked in TDD using NUnit/Moq and over the last few months I have been getting to grips with BDD using mSpec. So far so good but we now want to move more into acceptance criteria based tests where the business analysts are involved and we get an outside in development process. So now we have predefined Gherkin syntax files and with specflow it feels the

How to Load a File for Testing with Jasmine Node?

好久不见. 提交于 2019-12-20 10:24:45
问题 I have a simple JavaScript file, color.js , and a matching spec file, colorSpec.js . color.js: function Color() { } colorSpec.js: require('./color.js'); describe("color", function() { it("should work", function() { new Color(255, 255, 255); }); }); When I run jasmine-node colorSpec.js , I get the following exception: ReferenceError: Color is not defined How can I get Jasmine to load my color.js file before running colorSpec.js ? 回答1: you could load your color.js in the colorSpec.js with a