SlideShare una empresa de Scribd logo
1 de 13
Testing . NET systems using F#
HOW LONG WILL IT TAKE YOU?
@RBARTELINK
DUBLIN ALT.NET
24 OCTOBER, 2013
The test pyramid
 It’s not easy to achieve a good balance in a set of tests
 Too much AT -> slow + doesn’t drive implementation properly
 Too much UT -> Not meeting Living Documentation aim
 One size won’t fit all

http://martinfowler.com/bliki/TestPyramid.html (originated by Mike Cohn)
ATDD workflow

http://www.infoq.com/articles/atdd-from-the-trenches
Why?
 You need to express high and low level tests
 MbUnit, Sub/N/M/Spec are single paradigm
 3 year old tests are uglier than 3yo production code
 Test code is just different to production code
 Learn a language a year
 F# has been in VS since 2009
 One of F#’s many paradigms is to be a better C#
What can I use
 Everything (yes, everything) you know
 NUnit, MSpec, SpecFlow
 FluentAssertions,
 RhinoMocks, FakeItEasy, NSubstitute
 Things you’re already using
 xUnit.net, LINQ, Moq
 Modern Libs
 AutoFixture, AutoFixture.xUnit, AutoFixture.AutoMoq
 Foq, AutoFixture.AutoFoq
 TickSpec
Gherkin
 Feature files (Gherkin)
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
When I add 2 and 2
Then I should see 4
TickSpec
 TickFacts
[<TickFact>] let AdditionFeature () =
EmbeddedResourceFeatures.ScenariosFrom “Addition"

 Step Definitions (TickSpec with unquote)
module CalculatorSteps =
[<When>] ``I add (.*) and (.*)`` x y =
result <- Calculator()
|> enter x |> plus |> enter y
|> compute
[<Then>] ``I should see (.*)`` expected =
test <@ expected = result @>
Gherkin Backgrounds and Outlines
Feature: Addition
Background:
Given I switch my calculator to fancy mode
Scenario Outline: The Hard Stuff
When I add <First> and <Second>
Then I should see <Total>
Examples:
|First|Second|Total|
|1
|1
|2
|
|9
|-1
|8
|
Unit Testing
 Tick methods (xUnit/NUnit with unquote)
module CalculatorFacts =
[<Fact>] let ``Adding two small ints works`` () =
let result = Calculator() |> enter 2 |> plus |> enter 2 |> compute

test <@ 2+2 = result @>

 Mocking DSLs (Foq)
Mock<IList<char>>.With(fun x ->
<@ x.Count --> 2
x.Item(0) --> '0'
x.Item(1) --> '1'
x.Contains( any() ) --> true
x.RemoveAt( 2) ==> System.ArgumentOutOfRangeException()
@>)
Low Level Stuff
Type inference any()
(for real)

It.IsAny<DateTime>()

mock()

Mock.Of<T>

Tuples

let tuple = key,value
let _,value = tuple

var tuple = Tuple.Create( key, value)
var value = tuple.Item2

Lambdas

let gen a b = CreateSut a b |> Fill
let gen = CreateSut >> Fill

var gen = (int a, int b) =>
CreateSut( a, b).Fill()

Object
Expressions

let time = { new ITime with
member mock.GetHour() = 15}

class FakeTime15 {int GetHour() { return
15;}}
var time = new FakeTime15()

Custom ops

expected =? Actual // From unquote

Asset.Equal( expected, actual)

Quotations

test <@ expected =
result |> String.Concat “,” @>

Assert.That( expected, Is.EqualTo(
String.Concat( “,”, result)));

let list = Mock<IList>
.Method(fun x -> <@ x.Contains @>)
.Returns( true)

var mock = new Mock<IList>();
mock.Setup( x=> x
.Contains( It.IsAny<object>())
.Returns( true)
The bad points
 Need to install FSC on CI server (2 clicks or 11 MB






MSI or put FSC in tools dir Just Works)
You can’t mix F# and C# in a single project
F12 from F# to/from C# doesn’t work (but built in
Ctrl-, and F12 within files is fine)
No refactoring support of consequence (but not as
important as you think)
C# starts to grate a little more every day (as does “in
F# you can just…”)
Books
 Growing Object Oriented Software, Guided by Tests





(Freeman, Pryce)
Specification By Example (Adzic)
The RSpec book (Chelimsky et al)
Expert F# 3 (Syme)
Real World Functional Programming in F# and C#
(Petricek, Skeet)
Resources
 F#
 @ptrelford http://trelford.com/blog and samples
 SO F# tag
 Google
 @tomaspetricek http://tomasp.net/blog/
 Don’t forget MSDN
 ATDD
 GOOS
 @ploeh Outside In Test Driven Development
http://pluralsight.com/training/Courses/TableOfContents/ou
tside-in-tdd

Más contenido relacionado

La actualidad más candente

Operators and Control Statements in Python
Operators and Control Statements in PythonOperators and Control Statements in Python
Operators and Control Statements in PythonRajeswariA8
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fuclimatewarrior
 
Iterarators and generators in python
Iterarators and generators in pythonIterarators and generators in python
Iterarators and generators in pythonSarfaraz Ghanta
 
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
F# Eye 4 the C# Guy -  DDD Cambridge Nights 2014F# Eye 4 the C# Guy -  DDD Cambridge Nights 2014
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014Phillip Trelford
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingVijaySharma802
 
13 Strings and Text Processing
13 Strings and Text Processing13 Strings and Text Processing
13 Strings and Text ProcessingIntro C# Book
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1Abdul Haseeb
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
 
Advance python programming
Advance python programming Advance python programming
Advance python programming Jagdish Chavan
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasserySHAMJITH KM
 
Python for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.comPython for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.comShwetaAggarwal56
 

La actualidad más candente (20)

Stacks
StacksStacks
Stacks
 
Operators and Control Statements in Python
Operators and Control Statements in PythonOperators and Control Statements in Python
Operators and Control Statements in Python
 
C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
Python programming
Python  programmingPython  programming
Python programming
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
 
Iterarators and generators in python
Iterarators and generators in pythonIterarators and generators in python
Iterarators and generators in python
 
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
F# Eye 4 the C# Guy -  DDD Cambridge Nights 2014F# Eye 4 the C# Guy -  DDD Cambridge Nights 2014
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
13 Strings and Text Processing
13 Strings and Text Processing13 Strings and Text Processing
13 Strings and Text Processing
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Python Loop
Python LoopPython Loop
Python Loop
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
 
F# 101
F# 101F# 101
F# 101
 
Advance python programming
Advance python programming Advance python programming
Advance python programming
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
 
C Assignment Help
C Assignment HelpC Assignment Help
C Assignment Help
 
Python for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.comPython for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.com
 
10. Recursion
10. Recursion10. Recursion
10. Recursion
 

Destacado

Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Scott Wlaschin
 
5 Best Practices For F# Development
5 Best Practices For F# Development5 Best Practices For F# Development
5 Best Practices For F# Developmentdmohl
 
Railway Oriented Programming
Railway Oriented ProgrammingRailway Oriented Programming
Railway Oriented ProgrammingScott Wlaschin
 
Tata Communications Network Overview
Tata Communications Network OverviewTata Communications Network Overview
Tata Communications Network Overviewwkolman
 
Trinity Kings World Leadership is the foundation for all Leadership, anything...
Trinity Kings World Leadership is the foundation for all Leadership, anything...Trinity Kings World Leadership is the foundation for all Leadership, anything...
Trinity Kings World Leadership is the foundation for all Leadership, anything...Terrell Patillo
 
Linked Open Data - A Means for Public Sector Information Management
Linked Open Data - A Means for Public Sector Information ManagementLinked Open Data - A Means for Public Sector Information Management
Linked Open Data - A Means for Public Sector Information ManagementJohann Höchtl
 
The Saints by Joe McFadden
The Saints by Joe McFaddenThe Saints by Joe McFadden
The Saints by Joe McFaddenCachi Chien
 
Quick Look Video 01 29 11 Ws
Quick Look Video 01 29 11 WsQuick Look Video 01 29 11 Ws
Quick Look Video 01 29 11 WsJohnHoke
 
Trinity Kings World Leadership: Family Franchising Systems: City of Dallas, TX
Trinity Kings World Leadership: Family Franchising Systems: City of Dallas, TXTrinity Kings World Leadership: Family Franchising Systems: City of Dallas, TX
Trinity Kings World Leadership: Family Franchising Systems: City of Dallas, TXTerrell Patillo
 
Estudo de ROI com LotusLive Para efeito de Demonstração
Estudo de ROI com LotusLive Para efeito de DemonstraçãoEstudo de ROI com LotusLive Para efeito de Demonstração
Estudo de ROI com LotusLive Para efeito de DemonstraçãoWashington Cabral
 
130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)
130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)
130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)Masaaki Kurosu
 
Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...
Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...
Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...Terrell Patillo
 
True definition of biblical leadership
True definition of biblical leadershipTrue definition of biblical leadership
True definition of biblical leadershipTerrell Patillo
 
Hope (Victoria Kirdiy)
Hope (Victoria Kirdiy)Hope (Victoria Kirdiy)
Hope (Victoria Kirdiy)Cachi Chien
 
121216 uxにもの申す
121216 uxにもの申す121216 uxにもの申す
121216 uxにもの申すMasaaki Kurosu
 
Little Wings (Hummingbird Hawk Moth)
Little Wings (Hummingbird Hawk Moth)Little Wings (Hummingbird Hawk Moth)
Little Wings (Hummingbird Hawk Moth)Cachi Chien
 
The King of the United States Kingdom
The King of the United States KingdomThe King of the United States Kingdom
The King of the United States KingdomTerrell Patillo
 
King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...
King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...
King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...Terrell Patillo
 
Gherla Romania 2005 - Spring day in Europe project
Gherla Romania 2005 - Spring day in Europe project  Gherla Romania 2005 - Spring day in Europe project
Gherla Romania 2005 - Spring day in Europe project george papadopoulos
 
Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...
Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...
Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...Terrell Patillo
 

Destacado (20)

Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
 
5 Best Practices For F# Development
5 Best Practices For F# Development5 Best Practices For F# Development
5 Best Practices For F# Development
 
Railway Oriented Programming
Railway Oriented ProgrammingRailway Oriented Programming
Railway Oriented Programming
 
Tata Communications Network Overview
Tata Communications Network OverviewTata Communications Network Overview
Tata Communications Network Overview
 
Trinity Kings World Leadership is the foundation for all Leadership, anything...
Trinity Kings World Leadership is the foundation for all Leadership, anything...Trinity Kings World Leadership is the foundation for all Leadership, anything...
Trinity Kings World Leadership is the foundation for all Leadership, anything...
 
Linked Open Data - A Means for Public Sector Information Management
Linked Open Data - A Means for Public Sector Information ManagementLinked Open Data - A Means for Public Sector Information Management
Linked Open Data - A Means for Public Sector Information Management
 
The Saints by Joe McFadden
The Saints by Joe McFaddenThe Saints by Joe McFadden
The Saints by Joe McFadden
 
Quick Look Video 01 29 11 Ws
Quick Look Video 01 29 11 WsQuick Look Video 01 29 11 Ws
Quick Look Video 01 29 11 Ws
 
Trinity Kings World Leadership: Family Franchising Systems: City of Dallas, TX
Trinity Kings World Leadership: Family Franchising Systems: City of Dallas, TXTrinity Kings World Leadership: Family Franchising Systems: City of Dallas, TX
Trinity Kings World Leadership: Family Franchising Systems: City of Dallas, TX
 
Estudo de ROI com LotusLive Para efeito de Demonstração
Estudo de ROI com LotusLive Para efeito de DemonstraçãoEstudo de ROI com LotusLive Para efeito de Demonstração
Estudo de ROI com LotusLive Para efeito de Demonstração
 
130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)
130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)
130315 HCD-Netにおける資格認定制度 (英文 certification system of hcd net)
 
Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...
Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...
Trinity Kings World Leadership: The Law of the Picture: *Leaders Are Examples...
 
True definition of biblical leadership
True definition of biblical leadershipTrue definition of biblical leadership
True definition of biblical leadership
 
Hope (Victoria Kirdiy)
Hope (Victoria Kirdiy)Hope (Victoria Kirdiy)
Hope (Victoria Kirdiy)
 
121216 uxにもの申す
121216 uxにもの申す121216 uxにもの申す
121216 uxにもの申す
 
Little Wings (Hummingbird Hawk Moth)
Little Wings (Hummingbird Hawk Moth)Little Wings (Hummingbird Hawk Moth)
Little Wings (Hummingbird Hawk Moth)
 
The King of the United States Kingdom
The King of the United States KingdomThe King of the United States Kingdom
The King of the United States Kingdom
 
King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...
King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...
King Teola "Tee" Patillo II of the Patillo Family Kingdom goes to court to fi...
 
Gherla Romania 2005 - Spring day in Europe project
Gherla Romania 2005 - Spring day in Europe project  Gherla Romania 2005 - Spring day in Europe project
Gherla Romania 2005 - Spring day in Europe project
 
Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...
Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...
Trinity Kings World Leadership: Family Franchising Systems: Human Capital Man...
 

Similar a Dublin ALT.NET session Thu Oct 24 2013

Core .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 EnhancementsCore .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 EnhancementsRobert MacLean
 
Tdd with python unittest for embedded c
Tdd with python unittest for embedded cTdd with python unittest for embedded c
Tdd with python unittest for embedded cBenux Wei
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?Amir Barylko
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"LogeekNightUkraine
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Comunidade NetPonto
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Gianluca Padovani
 
Test driven development in .Net - 2010 + Eclipse
Test driven development in .Net - 2010 + EclipseTest driven development in .Net - 2010 + Eclipse
Test driven development in .Net - 2010 + EclipseUTC Fire & Security
 
White-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTestWhite-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTestDávid Honfi
 
Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and IterationsSameer Wadkar
 
Online test program generator for RISC-V processors
Online test program generator for RISC-V processorsOnline test program generator for RISC-V processors
Online test program generator for RISC-V processorsRISC-V International
 
Jaap Groeneveld - Go Unit Testing Workshop
Jaap Groeneveld - Go Unit Testing WorkshopJaap Groeneveld - Go Unit Testing Workshop
Jaap Groeneveld - Go Unit Testing WorkshopJaapGroeneveld2
 

Similar a Dublin ALT.NET session Thu Oct 24 2013 (20)

Unit Testing with Foq
Unit Testing with FoqUnit Testing with Foq
Unit Testing with Foq
 
Core .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 EnhancementsCore .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 Enhancements
 
Agile mobile
Agile mobileAgile mobile
Agile mobile
 
Tdd with python unittest for embedded c
Tdd with python unittest for embedded cTdd with python unittest for embedded c
Tdd with python unittest for embedded c
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
 
FSharp in the enterprise
FSharp in the enterpriseFSharp in the enterprise
FSharp in the enterprise
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)
 
Test driven development in .Net - 2010 + Eclipse
Test driven development in .Net - 2010 + EclipseTest driven development in .Net - 2010 + Eclipse
Test driven development in .Net - 2010 + Eclipse
 
White-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTestWhite-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTest
 
Getting Started With Testing
Getting Started With TestingGetting Started With Testing
Getting Started With Testing
 
Review version 3
Review version 3Review version 3
Review version 3
 
Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and Iterations
 
Online test program generator for RISC-V processors
Online test program generator for RISC-V processorsOnline test program generator for RISC-V processors
Online test program generator for RISC-V processors
 
Jaap Groeneveld - Go Unit Testing Workshop
Jaap Groeneveld - Go Unit Testing WorkshopJaap Groeneveld - Go Unit Testing Workshop
Jaap Groeneveld - Go Unit Testing Workshop
 
C#, What Is Next?
C#, What Is Next?C#, What Is Next?
C#, What Is Next?
 

Último

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Último (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

Dublin ALT.NET session Thu Oct 24 2013

  • 1. Testing . NET systems using F# HOW LONG WILL IT TAKE YOU? @RBARTELINK DUBLIN ALT.NET 24 OCTOBER, 2013
  • 2. The test pyramid  It’s not easy to achieve a good balance in a set of tests  Too much AT -> slow + doesn’t drive implementation properly  Too much UT -> Not meeting Living Documentation aim  One size won’t fit all http://martinfowler.com/bliki/TestPyramid.html (originated by Mike Cohn)
  • 4. Why?  You need to express high and low level tests  MbUnit, Sub/N/M/Spec are single paradigm  3 year old tests are uglier than 3yo production code  Test code is just different to production code  Learn a language a year  F# has been in VS since 2009  One of F#’s many paradigms is to be a better C#
  • 5. What can I use  Everything (yes, everything) you know  NUnit, MSpec, SpecFlow  FluentAssertions,  RhinoMocks, FakeItEasy, NSubstitute  Things you’re already using  xUnit.net, LINQ, Moq  Modern Libs  AutoFixture, AutoFixture.xUnit, AutoFixture.AutoMoq  Foq, AutoFixture.AutoFoq  TickSpec
  • 6. Gherkin  Feature files (Gherkin) Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers Scenario: Add two numbers When I add 2 and 2 Then I should see 4
  • 7. TickSpec  TickFacts [<TickFact>] let AdditionFeature () = EmbeddedResourceFeatures.ScenariosFrom “Addition"  Step Definitions (TickSpec with unquote) module CalculatorSteps = [<When>] ``I add (.*) and (.*)`` x y = result <- Calculator() |> enter x |> plus |> enter y |> compute [<Then>] ``I should see (.*)`` expected = test <@ expected = result @>
  • 8. Gherkin Backgrounds and Outlines Feature: Addition Background: Given I switch my calculator to fancy mode Scenario Outline: The Hard Stuff When I add <First> and <Second> Then I should see <Total> Examples: |First|Second|Total| |1 |1 |2 | |9 |-1 |8 |
  • 9. Unit Testing  Tick methods (xUnit/NUnit with unquote) module CalculatorFacts = [<Fact>] let ``Adding two small ints works`` () = let result = Calculator() |> enter 2 |> plus |> enter 2 |> compute test <@ 2+2 = result @>  Mocking DSLs (Foq) Mock<IList<char>>.With(fun x -> <@ x.Count --> 2 x.Item(0) --> '0' x.Item(1) --> '1' x.Contains( any() ) --> true x.RemoveAt( 2) ==> System.ArgumentOutOfRangeException() @>)
  • 10. Low Level Stuff Type inference any() (for real) It.IsAny<DateTime>() mock() Mock.Of<T> Tuples let tuple = key,value let _,value = tuple var tuple = Tuple.Create( key, value) var value = tuple.Item2 Lambdas let gen a b = CreateSut a b |> Fill let gen = CreateSut >> Fill var gen = (int a, int b) => CreateSut( a, b).Fill() Object Expressions let time = { new ITime with member mock.GetHour() = 15} class FakeTime15 {int GetHour() { return 15;}} var time = new FakeTime15() Custom ops expected =? Actual // From unquote Asset.Equal( expected, actual) Quotations test <@ expected = result |> String.Concat “,” @> Assert.That( expected, Is.EqualTo( String.Concat( “,”, result))); let list = Mock<IList> .Method(fun x -> <@ x.Contains @>) .Returns( true) var mock = new Mock<IList>(); mock.Setup( x=> x .Contains( It.IsAny<object>()) .Returns( true)
  • 11. The bad points  Need to install FSC on CI server (2 clicks or 11 MB     MSI or put FSC in tools dir Just Works) You can’t mix F# and C# in a single project F12 from F# to/from C# doesn’t work (but built in Ctrl-, and F12 within files is fine) No refactoring support of consequence (but not as important as you think) C# starts to grate a little more every day (as does “in F# you can just…”)
  • 12. Books  Growing Object Oriented Software, Guided by Tests     (Freeman, Pryce) Specification By Example (Adzic) The RSpec book (Chelimsky et al) Expert F# 3 (Syme) Real World Functional Programming in F# and C# (Petricek, Skeet)
  • 13. Resources  F#  @ptrelford http://trelford.com/blog and samples  SO F# tag  Google  @tomaspetricek http://tomasp.net/blog/  Don’t forget MSDN  ATDD  GOOS  @ploeh Outside In Test Driven Development http://pluralsight.com/training/Courses/TableOfContents/ou tside-in-tdd