Getting started with BDD and nSpec - c#

In a previous question found here, I asked a question about BDD and SpecFlow. The best answer was to use nSpec instead of SpecFlow.
I found nSpec, but I am having trouble finding tutorials on how to use it with C#. My google mojo isn't working for this topic.
Apart from the small instructional on the nSpec github site on how to install nSpec, does anyone have any links to good beginning tutorials on using nSpec?

I'm not sure if we are talking about the same framework (whether you meant nStep or NSpec). But here is some information on NSpec.
NSpec Project Site
There is an NSpec Project Site that has a good set of features showcased to help you get started.
Sample NSpec Usage
On github, the NSpec Samples Project will give you greater insight into the framework.
Additional Resources
It's important to be aware that there are two flavors of BDD. The following link explains the two different forms, their pros and cons, and how you can benefit from each:
What is the most mature BDD Framework for .NET?
NSpec Project Site
Continuous Testing
Introduction to BDD and Mocking
BDD using NUnit and Moq

You can see the Cuke4nuke (nStep's cousin) screen cast here:
http://www.richardlawrence.info/2009/12/03/screencast-testing-web-applications-in-net-with-cuke4nuke-and-watin/
I think they're quite similar, so watching the screencast should get you the basic idea.
(You can also checkout Cuke4nuke's wiki)

If you have trouble in getting started, why don't you switch to a framework that has a tutorial available?
I have written a complete run-through for my own BDD engine, called Aubergine; you can see it here:
http://www.corebvba.be/blog/post/Getting-started-quickly-with-BDD-in-Net.aspx

Related

Real winforms/wpf projects which use MVC, MVP, MVVM

I have looked some videos and read some articles about MVC, MVP, MVVM. I think, that I understood basic principles and differences. But it seems to me that samples in articles and videos are very easy.
I think that it's easy to learn how to apply these patterns when you can look on some projects.
So I'd like to look on real projects(Winforms/WPF), which use MVC, MVP or MVVM. Could you provide me links to sources of such projects? (If it is open source)
It will be great if projects will have unit tests for Controller/Presenter/ViewModel, because it's one of my problem when I develop applications.
Thanks in advance.
CodePlex will have a fair few http://www.codeplex.com/
I assume you have also used the samples at http://www.asp.net/mvc (you seemed to suggest this in your post)
Edit: also see these questions:
Good examples of WPF applications
Real World ASP.NET MVC Applications with Source Code?
Mini SQL Query at codeplex http://minisqlquery.codeplex.com/
see my answer at https://stackoverflow.com/a/25376174/423356

Can any one suggest a step by step example for using moQ framework

Can any one suggest a step by step example for using moQ framework.
any guidelines or thumbrules that has to be followed while mocking objetcs . can be much help.
thanks.
Here's the moq quick-start
Update: To address your comment... A large part of writing testable code involves removing dependencies on classes/resources outside the scope of your control. A very common approach to doing this is by talking to interfaces instead of concrete examples.
It's a little much to describe properly (especially since I just rolled out of bed), so let suggest you pick up a copy of Roy Osherove's 'The Art of Unit Testing'. It's a fairly short book and is filled with good advice and lots of summary information to get you familiar with many of the approaches to unit testing.
I only started to use Moq recently and I am not sure how much help this will be but if you can get your hands on Chapter 3 of Pro ASP.NET MVC Framework there is a really good step-by-step example of using moq and NUnit with ASP.NET MVC.

Good resource to learn BDD, TDD (ruby , C#, javascript)

What are the good resource to learn BDD & TDD (ruby , C#, javascript).
What are the good framework using now?
See
Why should I practice Test Driven Development and how should I start?
Beginning TDD - Challenges? Solutions? Recommendations?
Good C# Unit testing book
Introducing BDD
What is the Path to Learn BDD on Ruby On Rails?
Jasmine
Hanselminutes - Understanding BDD and NSpec
I can't really speak with too much authority on this subject, nor will I speak with too greater vigour given how storongly people feel about those two acronyms but it seams as though you are new to BDD / TDD so I will tell you what I wish someonehad told me when I first encoubtered them.
Tests and tools are one component of the overall process and methodology behind TDD, it is arguably one of the more visible aspects and so it is likely that you will see a lot of references to testing being an importabt part of TDD, and it is, I'm just saying, if you are interested in learning about TDD, don't forget the other aspects of it as well.
Resources I have found helpful:
The Pragmatic Programmer: doesn't
really talk about TDD per se, but it
does emphisise a lot of other good
practices that will help you.
Hanselminutes Episode 169
Tools I find helpful
TestDriven.NET - test runner in
visual studio
xUnit.NET - Test Framework
Rhino Mocks - Isolation (mocking)
framework
Here are a few links that may be helpful to you.
What is the most mature BDD Framework for .NET?
Introduction to BDD and Mocking
BDD using NUnit and Moq
RSpec vs Cucumber (RSpec stories)
BDD with Cucumber and rspec - when is this redundant?
NSpec Project Site
Continuous Testing
IMO, the best way to learn these days is with plurasight
http://www.pluralsight-training.net/microsoft/
my boss pays for me and my fellow developer to access the videos, but even if he didnt, its thats good id pay for it myself.

New to TDD: Are there sample applications with tests to show how to do TDD?

I really want to get into TDD development but I have no point of reference where to start.
I think that looking at code and seeing how they write tests and make classes testable that it'll be easier for me to digest and start using myself.
Is anyone aware of any sample or small open source C# applications that include unit tests?
For shakalpesh,
I would recommend the ObjectMentor katas.
One is to create a bowling game scoring algorithm
Another is to convert infix expressions to postfix. (The shunting yard algorithm)
Bolwing Game
Shunting Yard Algorithm
I highly recommend "Test Driven Development: By Example (Addison-Wesley Signature Series)" by Kent Beck.
Far, far better than any other resources I've found on the net or elsewhere. Well worth the $40 - $50.
If you're looking for a real-life open source application where the unit tests are critical to evaluating correctness, I'd suggest BouncyCastle C#, the source is available here. It's an open source crypto API for .NET, has loads of tests and obviously the tests
help establish whether things are working or not. Great if you like jumping into the thick of things.
I personally believe it's better to see web / screencasts for this than reading sample source code.
I'd go watch Rob Connery's MVC storefront series here. He covers most of what you are looking for.
Also, look at DnRTV episodes w/ JP Boodhoo. Find it here.
Microsoft Press has the book, "Test Driven Development in Microsoft .NET", by Newkirk and Vorontsov, two members of the NUnit development team. It's a few years old now, but it'll show you a more complete view of the process.

Good place to start learning ASP.NET

I have a two years of experience of programming in Visual C# and Visual C++. I would like to know some good online sources to start learning ASP.NET or anything else I should/need to learn before diving into ASP.NET. I found some online videos that are proving to be quite useful. Perhaps I would like to know about some open source projects where I can have a look at the ASP.NET code directly.
Sorry, but I'm going to have to suggest the immediately obvious first:
Official Microsoft ASP .Net Site
There's a link at the top to both "Get Started" and "Learn", and I have found this site incredibly useful over the past year or so.
Speaking as a convert from WinForms to the Web, I offer the following tips
Learn the ASP.NET Life-cycle
Get to grips with the concepts of client vs server-side code; know how pages are served up etc
Don't bite off too much too soon, there are A LOT of new things to learn, and it changes very quickly. But you don't need to be writing a full-blown AJAX web app straight away.
I like http://www.asp.net/learn/ it has some great tuts and some cool videos that walk you through the processes.
Good Luck
IMHO, CodeProject (www.codeproject.com) has lots of excellent articles related to ASP.NET.
Regarding projects, there are plenty of ASP.NET applications in CodePlex (www.codeplex.com) or SourceForge.
Regarding a specific ASP.NET application, http://www.cuyahoga-project.org/ its a great application to see.
Best Regards.
https://web.archive.org/web/20211020202742/https://www.4guysfromrolla.com/
Loads of ASP.NET articles/tutorials at various levels. I found it pretty useful to get my head around some of the concepts.
Just to add, another great resource is www.learnvisualstudio.net
Its not free but it has a plethora of videos covering all aspects of asp.net from 1.1 to 3.5, AJAX, Webservices.
Programmer to Programmer style videos with great examples and downloadable source code.
Good luck :)

Categories