Click here to load reader
Upload
maykel-suarez
View
40
Download
1
Embed Size (px)
Citation preview
|do|
|FitNesse in |flow| mode|
!note by: Mike Suarez
!contents
• Fit & FitLibrary
• Flow Mode
• Setup
• Verify
• With + Name + Use
• UltiPro
• To Fixture or not to Fixture
Fit FitLibrary
• Column
• Row
• Table
• Action
• SetUp
• Array
• Sequence
• Do
Flow Mode
|Hello Goodbye|
|You say |goodbye|
|and I say |hello|
|I don't know why you say |goodbye| I say |hello|
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;
}}
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|
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 });
}}
Verify Lists
|The Best Picture nominees should be|
|Title |
|Avatar |
|The Hurt Locker |
|Inglourious Basterds |
|Precious |
|Up in the Air |
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" }
};
}
}
Verify Object
|And the Oscar should go to |
|Title? |Director? |
|Inglourious Basterds|Quentin Tarantino|
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;
}
}
With
|do|
|with|new|Person|
|show|Name|
|with|new|Person|Dr|Jekyll|
|check|Name|Dr Jekyll|
|with|alter ego|
|check|Name|Mr Hyde|
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“
};}}}
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.|
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); } }
}
UltiPro
• DevelopmentPlanning.IntegrationTest
• ReviewPlanning.AddingComments.EmployeePerspective
• ReviewPlanning.AddingComments.ManagerPerspective
• EmployeeReviews.SelectingEmployeesToDistribute
To Fixture or not to Fixture
Thank you
?