19

Click here to load reader

DocumentDo

Embed Size (px)

Citation preview

Page 1: DocumentDo

|do|

|FitNesse in |flow| mode|

!note by: Mike Suarez

Page 2: DocumentDo

!contents

• Fit & FitLibrary

• Flow Mode

• Setup

• Verify

• With + Name + Use

• UltiPro

• To Fixture or not to Fixture

Page 3: DocumentDo

Fit FitLibrary

• Column

• Row

• Table

• Action

• SetUp

• Array

• Sequence

• Do

Page 4: DocumentDo

Flow Mode

|Hello Goodbye|

|You say |goodbye|

|and I say |hello|

|I don't know why you say |goodbye| I say |hello|

Page 5: DocumentDo

Hello Goodbye

public class HelloGoodbye{public string YouSay { get; set; }public string ISay { get; set; }

public void AndISay(string Something) { ISay = Something;

}

public bool I_dont_know_why_you_say_I_say(string YouSay, string ISay)

{return YouSay == this.YouSay && ISay == this.ISay;

}}

Page 6: DocumentDo

SetUp

|Movie Ratings |

|Code |Name |

|G |General audiences |

|PG |Parental guidance suggested |

|PG-13|Parents strongly cautioned |

|R |Restricted |

|NC-17|No one 17 and under admitted|

Page 7: DocumentDo

MPAA

public class Rating {public string Code { get; set; }public string Name { get; set; }

}

public class MovieRatings : SetUpFixture{public static List<Rating> MPAA = new List<Rating>();

public void CodeName(string Code, string Name) {MPAA.Add(new Rating { Code = Code, Name = Name });

}}

Page 8: DocumentDo

Verify Lists

|The Best Picture nominees should be|

|Title |

|Avatar |

|The Hurt Locker |

|Inglourious Basterds |

|Precious |

|Up in the Air |

Page 9: DocumentDo

Best Picture Nominees

public class Movie

{

public string Title { get; set; }

}

public class Oscars

{

public List<Movie> The_Best_Picture_nominees_should_be()

{

return new List<Movie>

{

new Movie { Title = "Avatar" },

new Movie { Title = "The Hurt Locker" },

new Movie { Title = "Inglourious Basterds" },

new Movie { Title = "Precious" },

new Movie { Title = "Up in the Air" }

};

}

}

Page 10: DocumentDo

Verify Object

|And the Oscar should go to |

|Title? |Director? |

|Inglourious Basterds|Quentin Tarantino|

Page 11: DocumentDo

An the Oscar goes to …

public class Movie

{

public string Title { get; set; }

public string Director { get; set; }

}

public class Oscars

{

public Fixture And_the_Oscar_should_go_to()

{

var Winner = new ColumnFixture();

Winner.SetSystemUnderTest (

new Movie {

Title = "Inglourious Basterds",

Director = "Quentin Tarantino"

});

return Winner;

}

}

Page 12: DocumentDo

With

|do|

|with|new|Person|

|show|Name|

|with|new|Person|Dr|Jekyll|

|check|Name|Dr Jekyll|

|with|alter ego|

|check|Name|Mr Hyde|

Page 13: DocumentDo

The Mysterious Case of Dr. Jekyll and Mr. Hyde

public class Person {

public string Name { get { return FirstName + " " + LastName; } }

public string FirstName { get; set; }public string LastName { get; set; }

public Person() {FirstName = "John";LastName = "Doe";

}

public Person(string FirstName, string LastName) {this.FirstName = FirstName;this.LastName = LastName;

}

public Person AlterEgo { get { return new Person {FirstName = "Mr", LastName = "Hyde“

};}}}

Page 14: DocumentDo

Name + Use

|do|

|name|Vincent|with|new|Character|Vincent|Vega||name|Jules|with|new|Character|Jules|Winnfield|

|use|Vincent||say|You know what they put on French fries in Holland instead of ketchup?|

|use|Jules||say|What?|

|use|Vincent||check|reply|Mayonnaise.|

|use|Jules||say|Goddamn.|

|use|Vincent||say|I've seen 'em do it, man. They fuckin' drown 'em in that shit.|

Page 15: DocumentDo

It’s Pulp Fiction

public class Line {

public string Actor { get; set; }

public string Text { get; set; }

}

public class Character : Person {

public Character(string FirstName, string LastName) : base(FirstName, LastName) { }

public bool Say(string Line) { return Line == ExpectedLine; }

public string Reply { get { return ExpectedLine; } }

static readonly List<Line> Script = new List<Line> {

new Line { Actor = "Vincent",Text = "You know what they put on French fries in Holland instead of ketchup?" },

new Line { Actor = "Jules", Text = "What?"},

new Line { Actor = "Vincent", Text = "Mayonnaise."},

new Line { Actor = "Jules", Text = "Goddamn."},

new Line { Actor = "Vincent", Text = "I've seen 'em do it, man. They fuckin' drown 'em in that shit."}

};

int LastLine;

string ExpectedLine { get { return NextLine.Text; } }

Line NextLine { get { return Lines[LastLine++]; } }

List<Line> Lines { get { return Script.FindAll(Line => Line.Actor == FirstName); } }

}

Page 16: DocumentDo

UltiPro

• DevelopmentPlanning.IntegrationTest

• ReviewPlanning.AddingComments.EmployeePerspective

• ReviewPlanning.AddingComments.ManagerPerspective

• EmployeeReviews.SelectingEmployeesToDistribute

Page 17: DocumentDo

To Fixture or not to Fixture

Page 18: DocumentDo

Thank you

Page 19: DocumentDo

?