SlideShare a Scribd company logo
1 of 22
|do|



  |FitNesse in |flow| mode|




                 !note by: Mike Suarez
!contents
•   Fit & FitLibrary
•   Column & Row
•   Flow Mode
•   Mixing
•   Switching
•   Free Text
Fit          FitLibrary
•   Column   •   SetUp
•   Row      •   Array
•   Table    •   Sequence
•   Action   •   Do
Column Fixture
|Greeting               |
|whom |greet?           |
|World|Hello World      |
|Kitty|Hello Kitty      |
|     |fail[Hello Pluto]|
Hello World
public class Greeting : ColumnFixture {

    public string Whom { get; set; }

    public string Greet() { return "Hello " + Whom; }
}
Column Fixture with Symbols
|Login                                          |
|User Name|Password      |Is Valid?|Last Logged?|
|admin    |secret        |yes      |>>lastLogged|
|admin    |wrong password|no       |<<lastLogged|
Login
public class Login : ColumnFixture {

    public string UserName { get; set; }
    public string Password { get; set; }

    public bool IsValid { get {
      return User.Named[UserName].Password == Password;
    }}

    public DateTime LastLogged { get {
      return User.Named[UserName].LastLogged;
    }}
}
Row Fixture
|Top Ten Movies in Imdb                                         |
|Rank|Rating|Title                                         |Year|
|1   |9.1   |The Shawshank Redemption                      |1994|
|2   |9.1   |The Godfather                                 |1972|
|3   |9.0   |The Godfather: Part II                        |1974|
|4   |8.9   |Il buono, il brutto, il cattivo.              |1966|
|5   |8.9   |Pulp Fiction                                  |1994|
|6   |8.8   |Schindler's List                              |1993|
|7   |8.8   |12 Angry Men                                  |1957|
|8   |8.8   |One Flew Over the Cuckoo's Nest               |1975|
|9   |8.8   |Star Wars: Episode V - The Empire Strikes Back|1980|
|10 |8.8    |The Dark Knight                               |2008|
Top Ten
public class TopTenMoviesInImdb : RowFixture {

    public override object[] Query() {
      return Movie.TopTenInImdb;
    }

    public override Type GetTargetClass() {
      return typeof(Movie);
    }
}
Flow Mode
|Help File Is Product Specific|

|Load Products|

|Help File should be|Products.pdf|

|Select|Webcams|

|check|Help File is|Webcams.pdf|
Help File Is Product Specific
public class HelpFileIsProductSpecific {

    List<string> Products;
    string SelectedProduct;

    public void load_products() {
      Products = new List<string> {
         "Memory Cards", "Camcorders", "Webcams", "Lenses“
      };
    }

    public void Select(string product) {
      if (Products.Contains(product)) SelectedProduct = product;
    }

    public string help_file_is { get {
       return SelectedProduct == null ?
         "Products.pdf" : SelectedProduct + ".pdf";
    }}

    public bool help_file_should_be(string expectedHelpfile) {
      return help_file_is.Equals(expectedHelpfile);
    }
}
Mixed with Lists
|Oscars|

|The Best Picture nominees are|
|Title                        |
|Avatar                       |
|The Blind Side               |
|District 9                   |
|An Education                 |
|The Hurt Locker              |
|Inglourious Basterds         |
|Precious                     |
|A Serious Man                |
|Up                           |
|Up in the Air                |
Mixed with Column
|And the Oscar should go to            |
|Title?              |Director?        |
|Inglourious Basterds|Quentin Tarantino|
Oscars
public class Oscars {

    public List<Movie> The_Best_Picture_nominees_are() {
      return Movie.OscarNominees;
    }

    public Fixture And_the_Oscar_should_go_to() {
      var Winner = new ColumnFixture();
      Winner.SetSystemUnderTest(Movie.Winner);
      return Winner;
    }
}
Switching SUT
!define EventId {7036}
!define Source {Service Control Manager}

|Service Controller|

|Start Service|aspnet_state|
|Stop Service |aspnet_state|

|with|new|Event Log|

|should contain entries in|System|log with|${Source}|source and|${EventId}|event id in the last|10|seconds|
|Message                                                                                                  |
|The ASP.NET State Service service entered the running state.                                             |
|The ASP.NET State Service service entered the stopped state.                                             |
Event Log
public class ServiceControllerFixture {

    public void StartService(string ServiceName) { ... }

    public void StopService(string ServiceName) { ... }

}

public class EventLog {

    public SubsetFixture should_contain_entries_in_log_with_source_and_eventId_in_the_last_seconds(
      string LogName, string SourceName, long EventID, int Seconds) {

        return new SubsetFixture(GetEventLogsFor(LogName, SourceName ...));
    }
}
Free Text
![ User Login
The user credentials should be requested on the first run of Zunzun
The credentials should be stored with encrypted password
]!

![
Once recorded, the credentials should not be requested
An error message should be shown if the credentials are invalid
]!
Account Config
public class AccountConfig {

    public bool The_user_credentials_should_be_requested_on_the_first_run_of_zunzun() {
      return true;
    }

    public bool The_credentials_should_be_stored_with_encrypted_password() {
      return true;
    }

    public bool Once_recorded_the_credentials_should_not_be_requested() {
      return true;
    }

    public bool An_error_message_should_be_shown_if_the_credentials_are_invalid() {
      return true;
    }
}
Free Text
![ Tweeting Photos
Zunzun should allow to browse for the photo
upload it into a website that stores photos
and paste the url in the Tweet
]!

![
The url should not be shortened
and should be pasted at cursor position
]!

![ Uploading Photos with Multiple Services
It should work with these services
yfrog
twitpic
]!
Tweeting Photos
public class TweetingPhotos {

    public   bool   Zunzun_should_allow_to_browse_for_the_photo() { return true; }
    public   bool   upload_it_into_a_website_that_stores_photos() { return true; }
    public   bool   and_paste_the_url_in_the_Tweet() { return true; }
    public   bool   The_url_should_not_be_shortened() { return true; }
    public   bool   and_should_be_pasted_at_cursor_position() { return true;}
}

public class UploadingPhotosWithMultipleServices : ConstraintFixture {

    public bool It_should_work_with_these_services(string ServiceName) { return true; }
}
Thank you
?

More Related Content

Viewers also liked (15)

An intro to the physics of passive solar
An intro to the physics of passive solarAn intro to the physics of passive solar
An intro to the physics of passive solar
 
Pathfinder & Adventure days 2015
Pathfinder & Adventure days 2015Pathfinder & Adventure days 2015
Pathfinder & Adventure days 2015
 
Apps
AppsApps
Apps
 
Dariah vcc3 2505-2013_displaying
Dariah vcc3 2505-2013_displayingDariah vcc3 2505-2013_displaying
Dariah vcc3 2505-2013_displaying
 
Kespro
KesproKespro
Kespro
 
Presentation
PresentationPresentation
Presentation
 
Racounteur agile 2011
Racounteur agile 2011Racounteur agile 2011
Racounteur agile 2011
 
Labor11
Labor11Labor11
Labor11
 
informed choice
informed choiceinformed choice
informed choice
 
Varises pada ibu hamil slide
Varises pada ibu hamil slideVarises pada ibu hamil slide
Varises pada ibu hamil slide
 
kehamilan tidak diinginkan (aborsi)
kehamilan tidak diinginkan (aborsi)kehamilan tidak diinginkan (aborsi)
kehamilan tidak diinginkan (aborsi)
 
Entomología
EntomologíaEntomología
Entomología
 
Sex aberrations
Sex aberrationsSex aberrations
Sex aberrations
 
Types of Motivation.
Types of Motivation.Types of Motivation.
Types of Motivation.
 
Powerpoint ..biomes
Powerpoint ..biomesPowerpoint ..biomes
Powerpoint ..biomes
 

Similar to Do

SDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk LaravelSDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk Laravelmarcusamoore
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»SpbDotNet Community
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonAEM HUB
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling RewriterJustin Edelson
 
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...Fons Sonnemans
 
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdfSummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdfARORACOCKERY2111
 
softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EEAlexis Hassler
 
Dependency Injection and Aspect Oriented Programming presentation
Dependency Injection and Aspect Oriented Programming presentationDependency Injection and Aspect Oriented Programming presentation
Dependency Injection and Aspect Oriented Programming presentationStephen Erdman
 
ASP.Net 5 and C# 6
ASP.Net 5 and C# 6ASP.Net 5 and C# 6
ASP.Net 5 and C# 6Andy Butland
 
Применение паттерна Page Object для автоматизации веб сервисов
Применение паттерна Page Object для автоматизации веб сервисовПрименение паттерна Page Object для автоматизации веб сервисов
Применение паттерна Page Object для автоматизации веб сервисовCOMAQA.BY
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good codeGiordano Scalzo
 
Microservices Chaos Testing at Jet
Microservices Chaos Testing at JetMicroservices Chaos Testing at Jet
Microservices Chaos Testing at JetC4Media
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Integrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsIntegrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsDan Wahlin
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mockskenbot
 
Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Antoine Sabot-Durand
 

Similar to Do (20)

Solid principles
Solid principlesSolid principles
Solid principles
 
SDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk LaravelSDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk Laravel
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin Edelson
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
 
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdfSummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
 
softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EE
 
Dependency Injection and Aspect Oriented Programming presentation
Dependency Injection and Aspect Oriented Programming presentationDependency Injection and Aspect Oriented Programming presentation
Dependency Injection and Aspect Oriented Programming presentation
 
DotNet Conference: code smells
DotNet Conference: code smellsDotNet Conference: code smells
DotNet Conference: code smells
 
ASP.Net 5 and C# 6
ASP.Net 5 and C# 6ASP.Net 5 and C# 6
ASP.Net 5 and C# 6
 
Применение паттерна Page Object для автоматизации веб сервисов
Применение паттерна Page Object для автоматизации веб сервисовПрименение паттерна Page Object для автоматизации веб сервисов
Применение паттерна Page Object для автоматизации веб сервисов
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
 
Microservices Chaos Testing at Jet
Microservices Chaos Testing at JetMicroservices Chaos Testing at Jet
Microservices Chaos Testing at Jet
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
Integrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsIntegrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight Applications
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014
 

Do

  • 1. |do| |FitNesse in |flow| mode| !note by: Mike Suarez
  • 2. !contents • Fit & FitLibrary • Column & Row • Flow Mode • Mixing • Switching • Free Text
  • 3. Fit FitLibrary • Column • SetUp • Row • Array • Table • Sequence • Action • Do
  • 4. Column Fixture |Greeting | |whom |greet? | |World|Hello World | |Kitty|Hello Kitty | | |fail[Hello Pluto]|
  • 5. Hello World public class Greeting : ColumnFixture { public string Whom { get; set; } public string Greet() { return "Hello " + Whom; } }
  • 6. Column Fixture with Symbols |Login | |User Name|Password |Is Valid?|Last Logged?| |admin |secret |yes |>>lastLogged| |admin |wrong password|no |<<lastLogged|
  • 7. Login public class Login : ColumnFixture { public string UserName { get; set; } public string Password { get; set; } public bool IsValid { get { return User.Named[UserName].Password == Password; }} public DateTime LastLogged { get { return User.Named[UserName].LastLogged; }} }
  • 8. Row Fixture |Top Ten Movies in Imdb | |Rank|Rating|Title |Year| |1 |9.1 |The Shawshank Redemption |1994| |2 |9.1 |The Godfather |1972| |3 |9.0 |The Godfather: Part II |1974| |4 |8.9 |Il buono, il brutto, il cattivo. |1966| |5 |8.9 |Pulp Fiction |1994| |6 |8.8 |Schindler's List |1993| |7 |8.8 |12 Angry Men |1957| |8 |8.8 |One Flew Over the Cuckoo's Nest |1975| |9 |8.8 |Star Wars: Episode V - The Empire Strikes Back|1980| |10 |8.8 |The Dark Knight |2008|
  • 9. Top Ten public class TopTenMoviesInImdb : RowFixture { public override object[] Query() { return Movie.TopTenInImdb; } public override Type GetTargetClass() { return typeof(Movie); } }
  • 10. Flow Mode |Help File Is Product Specific| |Load Products| |Help File should be|Products.pdf| |Select|Webcams| |check|Help File is|Webcams.pdf|
  • 11. Help File Is Product Specific public class HelpFileIsProductSpecific { List<string> Products; string SelectedProduct; public void load_products() { Products = new List<string> { "Memory Cards", "Camcorders", "Webcams", "Lenses“ }; } public void Select(string product) { if (Products.Contains(product)) SelectedProduct = product; } public string help_file_is { get { return SelectedProduct == null ? "Products.pdf" : SelectedProduct + ".pdf"; }} public bool help_file_should_be(string expectedHelpfile) { return help_file_is.Equals(expectedHelpfile); } }
  • 12. Mixed with Lists |Oscars| |The Best Picture nominees are| |Title | |Avatar | |The Blind Side | |District 9 | |An Education | |The Hurt Locker | |Inglourious Basterds | |Precious | |A Serious Man | |Up | |Up in the Air |
  • 13. Mixed with Column |And the Oscar should go to | |Title? |Director? | |Inglourious Basterds|Quentin Tarantino|
  • 14. Oscars public class Oscars { public List<Movie> The_Best_Picture_nominees_are() { return Movie.OscarNominees; } public Fixture And_the_Oscar_should_go_to() { var Winner = new ColumnFixture(); Winner.SetSystemUnderTest(Movie.Winner); return Winner; } }
  • 15. Switching SUT !define EventId {7036} !define Source {Service Control Manager} |Service Controller| |Start Service|aspnet_state| |Stop Service |aspnet_state| |with|new|Event Log| |should contain entries in|System|log with|${Source}|source and|${EventId}|event id in the last|10|seconds| |Message | |The ASP.NET State Service service entered the running state. | |The ASP.NET State Service service entered the stopped state. |
  • 16. Event Log public class ServiceControllerFixture { public void StartService(string ServiceName) { ... } public void StopService(string ServiceName) { ... } } public class EventLog { public SubsetFixture should_contain_entries_in_log_with_source_and_eventId_in_the_last_seconds( string LogName, string SourceName, long EventID, int Seconds) { return new SubsetFixture(GetEventLogsFor(LogName, SourceName ...)); } }
  • 17. Free Text ![ User Login The user credentials should be requested on the first run of Zunzun The credentials should be stored with encrypted password ]! ![ Once recorded, the credentials should not be requested An error message should be shown if the credentials are invalid ]!
  • 18. Account Config public class AccountConfig { public bool The_user_credentials_should_be_requested_on_the_first_run_of_zunzun() { return true; } public bool The_credentials_should_be_stored_with_encrypted_password() { return true; } public bool Once_recorded_the_credentials_should_not_be_requested() { return true; } public bool An_error_message_should_be_shown_if_the_credentials_are_invalid() { return true; } }
  • 19. Free Text ![ Tweeting Photos Zunzun should allow to browse for the photo upload it into a website that stores photos and paste the url in the Tweet ]! ![ The url should not be shortened and should be pasted at cursor position ]! ![ Uploading Photos with Multiple Services It should work with these services yfrog twitpic ]!
  • 20. Tweeting Photos public class TweetingPhotos { public bool Zunzun_should_allow_to_browse_for_the_photo() { return true; } public bool upload_it_into_a_website_that_stores_photos() { return true; } public bool and_paste_the_url_in_the_Tweet() { return true; } public bool The_url_should_not_be_shortened() { return true; } public bool and_should_be_pasted_at_cursor_position() { return true;} } public class UploadingPhotosWithMultipleServices : ConstraintFixture { public bool It_should_work_with_these_services(string ServiceName) { return true; } }
  • 22. ?