bdd

Reusing NSpec specifications

白昼怎懂夜的黑 提交于 2020-01-05 09:35:54
问题 I've started with NSpec recently and now I'm not sure how to scale this. What is the best way to reuse specifications ( it["something"] = () => {}; )? Let's say I have an interface IMyService and 2 classes that implement it: Service1 and Service2 . Now I want to write specifications that apply at IMyservice level, and run them against my 2 implementation classes. Maybe I'm missing something here, but I can find a simple way to do this. 回答1: You can use a abstract class to reuse the

Fluent NHibernate HasMany Collection Problems

萝らか妹 提交于 2020-01-05 09:15:30
问题 Update: It appears that changing my mapping from Cascade.All() to Cascade.AllDeleteOrphan() fixes most of my issues. I still have to explicitly set the Company property on the OperatingState, which seems unnecessary as it's being added to the Company entity, but at least I can work with that during an update. I still need to test that with a create. If any one can explain that, that would be a big help. Update 2: After playing with it some more, it appears I don't always have to specify the

How to test filters based on authorization using Gherkin?

一曲冷凌霜 提交于 2020-01-05 05:55:51
问题 I don't understand how should scenario look like when there is no actual business action to test something. Is the following scenario good enough? I don't understand how it can be converted into Past, Action, Future sequence. Scenario: Given The system contains the following users | email | role | | admin@example.com | ADMIN | | user@example.com | USER | And The system contains the following Products | Name | Active | | Product1 | true | | Product2 | false | Then The list of Products for

How can a gem provide Cucumber features and step definitions?

◇◆丶佛笑我妖孽 提交于 2020-01-03 18:33:24
问题 I have two Rails projects (A and B) with the following gems, among others: #project A gem "green_theme", :path => "~/dev/themes/green_theme" gem "devel_tasks", :path => "~/dev/themes/devel_tasks" #project B gem "red_theme", :path => "~/dev/themes/red_theme" gem "devel_tasks", :path => "~/dev/themes/devel_tasks" Both projects, A and B, have a features dir for features and steps. Both themes, red and green, should have common functionalities like login/logout buttons, html meta-tags, and so on.

How can a gem provide Cucumber features and step definitions?

♀尐吖头ヾ 提交于 2020-01-03 18:33:12
问题 I have two Rails projects (A and B) with the following gems, among others: #project A gem "green_theme", :path => "~/dev/themes/green_theme" gem "devel_tasks", :path => "~/dev/themes/devel_tasks" #project B gem "red_theme", :path => "~/dev/themes/red_theme" gem "devel_tasks", :path => "~/dev/themes/devel_tasks" Both projects, A and B, have a features dir for features and steps. Both themes, red and green, should have common functionalities like login/logout buttons, html meta-tags, and so on.

How to use multiple expect in jasmine

僤鯓⒐⒋嵵緔 提交于 2020-01-03 16:36:18
问题 I am using jasmine with jasmine-species . I am making a test of search in my site . In search there are multiple criteria a user can select . I want to know that how to expect with multiple criteria. Suppose this is my case expect(variable1).toEqual(''); expect(variable2).toEqual(''); expect(variable3).toEqual(''); expect(variable4).toEqual(''); My question is that i want to move all expects into single expect . Is this possible in jasmine ? if yes , then how ? Thanks in advance 回答1: expect

Application Testing with Rails

冷暖自知 提交于 2020-01-02 13:55:47
问题 This is more of a general question and some sort of best practice discussion. How would one test a Rails application? There are mantras like BDD and TDD and frameworks like RSpec and Cucumber but how much is enough and what is the best way to go? Is it enough to use Cucumber as integration tests? Are you guys writing additional unit tests, too? So what and how is your Rails testing strategy? Looking forward to good opinions... 回答1: How would one test a Rails application? Thoroughly, aiming

How do you run cucumber with Scala 2.11 and sbt 0.13?

拈花ヽ惹草 提交于 2020-01-02 02:24:46
问题 Does anyone have an example of a cucumber project with sbt 0.13 and Scala 2.11? Do I need both the cucumber-scala_2.11 and the sbt-cucumber-plugin" % "0.8.0" (is that plugin up to date)? Where does the plugin go now? Where do the .feature files go? Where do the cucumber tests go? How do I run the tests from sbt? (optional) How can I run the tests from IntellJ (15)? 回答1: Ok, I figured out a solution with the following caveat: I'm not using sbt. Idea We will write cucumber features and steps

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

[亡魂溺海] 提交于 2020-01-01 02:28:10
问题 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

Rails 3, RSpec 2.5: Using should_receive or stub_chain with named scopes

隐身守侯 提交于 2019-12-31 10:32:21
问题 I use Rails 3.0.4 and RSpec 2.5. In my controllers I use named scopes heavily, for example @collection = GuestbookEntry.nonreplies.bydate.inclusive.paginate( :page => params[:page], :conditions => { ... }) In my tests, I want to be able to mock the result of such a query, not the wording . I do not think it makes sense to do something like GuestbookEntry.stub_chain(:nonreplies, :bydate, ...).and_return(...) because this test will fail the moment I decide to reorder the named scopes. With