Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone done BDD with CQRS using SpecFlow/StoryQ

Tags:

cqrs

bdd

specflow

Does any one have experience utilizing ready frameworks as specflow with CQRS in BDD.

I liked the approach of Mark Nijhof, however I have already been using SpecFlow for other projects. Can anyone offer a bit of enlightenment, with an example if possible?

like image 881
mobygeek Avatar asked Dec 14 '11 13:12

mobygeek


2 Answers

I am using it in my current project.

I am using SpecFlow for UI testing (Web client) and for some import tests.

For unit testing, I am using Machine.Specifications.

I think SpecFlow suits the task well. I have support from the requirements expert, the sprint tester and sometimes the project manager in writing specifications which means that I can concentrate on implementing features instead of reading through heavy requirements specifications.

Technically I use CassiniWebDev to host the web client project and simple Process.Start for the NServiceBus endpoints for tests that use the full circle. I use Selenium for the web UI tests and FluentAutomation on top of that. It took a couple of days to set it all up, but it's definitely worth it.

I generate SpecFlow reports, use Pickles to render Features to web and take screen shots with Selenium and publish the entire thing on the project website so that all the stakeholders can see what's going on and what things look like at the moment.

I'd recommend SpecFlow for a BDD/CQRS project.

like image 79
Mikael Östberg Avatar answered Sep 19 '22 17:09

Mikael Östberg


I have used Machine.Spec for testing CQRS with BDD. From my point of view it worked quite well. For example:

    Establish context = () =>
        {
            // set up your fakes & mocks here...
        };

    Because of = () =>
        {
            _bus.Send(_createNewCustomer);
            _version++;
        };

    It should_create_a_customer = () =>
        {
            _repository.GetById(_id).Id.ShouldEqual(_id);
        };

    It should_publish_a_customer_Created_event = () =>
        {
            _subscriber.HandledEvents.Count.ShouldEqual(1);
            _subscriber.HandledEvents.First().Value.ShouldBeOfType(typeof(CustomerCreatedEvent));
        };

    Cleanup Clear_Context = () => _subscriber.HandledEvents.Clear();
like image 42
seanfitzg Avatar answered Sep 20 '22 17:09

seanfitzg