Your SlideShare is downloading. ×
Mini-Training: NFluent
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Mini-Training: NFluent

570
views

Published on

NFluent is an ergonomic check library which aims at improving the flow of your .NET TDD experience

NFluent is an ergonomic check library which aims at improving the flow of your .NET TDD experience

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
570
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Nfluent
  • 2. Agenda • Definitions • Why use Nfluent • Create your own check method • Nfluent Definition of Done (DoD)
  • 3. What is Nfluent? • NFluent is an ergonomic check library which aims to fluent your .NET TDD experience (based on simple Check.That() assertion statements) • An important part of the NFluent value is to allow a smooth writing of all the checks. • NFluent by it’s nature, provides a really nice way to produce tests that make sense • NFluent is not coupled to any .NET unit test framework. It is fully designed to work in collaboration with your favorite one • NFluent is directly, but also freely, inspired by the Java FEST fluent check/reflection library (http://fest.easytesting.org/). • It’s a simple nuget package PM> Install-Package NFluent
  • 4. Why useNfluent? Simply because it makes your TDD more fluent 4
  • 5. NFluent aims your tests to be fluent to write auto-completion: With a super auto-completion 'dot' experience. Indeed, just type the Check.That() followed by one of your object and a dot, and your IDE will show you all the checks available for the type of the given object to verify. No more, no less ( no auto completion flooding) with Nfluent: with assert method: No hesitation about the kind of check that is possible and available regarding my current System Under Test (SUT) All you've got to remember is: Check.That, cause every check is then provided via auto-completion 5
  • 6. Fluent to read • very close to plain English, making it easier for non-technical people to read test code • your tests should also be your documentation and providing fluently sentences near plain english instead of questionable asserts will enhance that • Other check libraries have not chosen the proper vocabulary (they use Should() instead of Must()) With nfluent you'd rather rely on a stronger semantic for your checks ( NFluent's Check.That) 6
  • 7. fluent to troubleshoot • every failing check of the NFluent library throws an Exception with a crystalclear message status to ease your TDD experience • no need to set a breakpoint and to debug in order to be able to figure out what went wrong. 7
  • 8. less error-prone • no more confusion about the order of the "expected" and "actual" values you can find in the classical .NET unit tests frameworks With assert method confusion with expected and actual With Nfluent all is clear, just check.that: • all unit tests error message are reliable when tests are failing 8
  • 9. helpful to reverse engineer legacy code • temporarily write an on-purpose failing assert on a legacy method, so you can understand it and leverage on the "ready-to-be-copied-and-paste-for-arrays-orcollections-initialization-purpose" NFluent assert failure messages • With check error message also well formated so that we can easily instanciate arrays and collections type initializers 9
  • 10. Red Green Refactor 10
  • 11. Create your own check method • All the secret of the NFluent extensions is on the ICheck<T> returned by the Check.That<T>(T sut) • The idea is to provide an extension method on the ICheck<T> interface for the T type you want to check. With existing tests A new test 11
  • 12. Demo 12
  • 13. Nfluent Definition of Done (DoD) • No warning during the build (warn as error) • No StyleCop warning • 100% of test coverage for the NFluent project – Test names should be clear enough to know what is in stakes here • The entire build (i.e. including all the unit tests execution) takes less than a minute • With (of course) all unit tests passed ;-) 13
  • 14. • https://github.com/tpierrain/NFluent • http://www.codedistillers.com/rui/2013/11/26/nfluent-extensions/ • http://www.nuget.org/packages/NFluent/ 14
  • 15. Find out more • On https://techblog.betclicgroup.com/
  • 16. About Betclic • • • Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest Gaming, bet-at-home.com, Expekt… Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association). Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players.