Loading ...
Sorry, an error occurred while loading the content.
 

FlowMode of FIT in SLIM

Expand Messages
  • dbinkeleraible@googlemail.com
    Hi, http://www.fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.FixtureGallery.ImportantConcepts.FlowMode
    Message 1 of 7 , Jun 1, 2017
      Hi,

      http://www.fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.FixtureGallery.ImportantConcepts.FlowMode

      I am new to Fitnesse and I try to work out if which is more appropriate for my uses case: FIT or SLIM.
      The flowMode seems to work in my case quite well because the DoFixture can hold common data (e.g. setup date) for all sub-fixtures.
      Can this also be achieved with SLIM?
      If not should I use FIT? Is FIT still maintained?

      Thanks in advanced.

      Daniel


    • andydassing
      You ll find it very rewarding to read the entire documentation set here: http://fitnesse.org/FitNesse.FullReferenceGuide
      Message 2 of 7 , Jun 1, 2017

        You'll find it very rewarding to read the entire documentation set here:

        Avoid the common "cut & paste" duplication style of development so prevalent in today's programmers.  Not everything is a Google search for something to clone. :-)  As an old education campaign once stated: "Reading is FUNdamental!"
        1. Slim has many advantages over Fit:
          http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM

        2. Slim fixtures are much easier to write:
          http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.FixtureCode

        3. Slim's Script Table is the counterpart to DoFixture and flow mode:
          http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM.ScriptTable

        4. Use the Slim Library Table to create a list of sub-fixtures:
          http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM.LibraryTable

        5. Use Symbols to hold values and object instances for injection into other fixtures:
          http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM.SymbolsInTables
          http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbols

        6. Use Scenario Tables for reusable, parameterized script sequences:
          http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM.ScenarioTable


      • Mike Stockdale
        Are you using Java, .NET or ?
        Message 3 of 7 , Jun 1, 2017
          Are you using Java, .NET or ?
          On 2017-06-01 02:34, dbinkeleraible@... [fitnesse] wrote:
           

          Hi,

          http://www.fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.FixtureGallery.ImportantConcepts.FlowMode

          I am new to Fitnesse and I try to work out if which is more appropriate for my uses case: FIT or SLIM.
          The flowMode seems to work in my case quite well because the DoFixture can hold common data (e.g. setup date) for all sub-fixtures.
          Can this also be achieved with SLIM?
          If not should I use FIT? Is FIT still maintained?

          Thanks in advanced.

          Daniel



        • Daniel Binkele-Raible
          Java Would be great if you could point out some examples .. thankd Am 02.06.2017 04:33 schrieb Mike Stockdale jediwhale@syterra.com
          Message 4 of 7 , Jun 1, 2017
            Java 
            Would be great if you could point out some examples .. thankd

            Am 02.06.2017 04:33 schrieb "Mike Stockdale jediwhale@... [fitnesse]" <fitnesse@yahoogroups.com>:
             

            Are you using Java, .NET or ?

            On 2017-06-01 02:34, dbinkeleraible@... [fitnesse] wrote:
             

            Hi,

            http://www.fitnesse.org/ FitNesse.FullReferenceGuide. UserGuide.FixtureGallery. ImportantConcepts.FlowMode

            I am new to Fitnesse and I try to work out if which is more appropriate for my uses case: FIT or SLIM.
            The flowMode seems to work in my case quite well because the DoFixture can hold common data (e.g. setup date) for all sub-fixtures.
            Can this also be achieved with SLIM?
            If not should I use FIT? Is FIT still maintained?

            Thanks in advanced.

            Daniel



          • Andrew Dassing
            If you supply a sample DoFixture flow mode example, I ll convert it to Slim Script. *Andy Dassing* *nielsen* *•* Clean Coding *•* +1.813.366.5066 On Thu,
            Message 5 of 7 , Jun 2, 2017

              If you supply a sample DoFixture flow mode example, I'll convert it to Slim Script.




              Andy Dassing
              nielsen Clean Coding +1.813.366.5066



              On Thu, Jun 1, 2017 at 11:01 PM, Daniel Binkele-Raible dbinkeleraible@... [fitnesse] <fitnesse@yahoogroups.com> wrote:
               

              Java 
              Would be great if you could point out some examples .. thankd

              Am 02.06.2017 04:33 schrieb "Mike Stockdale jediwhale@... [fitnesse]" <fitnesse@yahoogroups.com>:
               

              Are you using Java, .NET or ?

              On 2017-06-01 02:34, dbinkeleraible@... [fitnesse] wrote:
               

              Hi,

              http://www.fitnesse.org/FitNes se.FullReferenceGuide.UserGuid e.FixtureGallery.ImportantConc epts.FlowMode

              I am new to Fitnesse and I try to work out if which is more appropriate for my uses case: FIT or SLIM.
              The flowMode seems to work in my case quite well because the DoFixture can hold common data (e.g. setup date) for all sub-fixtures.
              Can this also be achieved with SLIM?
              If not should I use FIT? Is FIT still maintained?

              Thanks in advanced.

              Daniel




            • Daniel Binkele-Raible
              Thanks for the offer. Here is the Code: !|SetupFlow| ... import fit.Fixture; import fitlibrary.DoFixture; import java.util.LinkedList; import java.util.List;
              Message 6 of 7 , Jun 2, 2017
                Thanks for the offer. Here is the Code:


                !|SetupFlow|

                |prepare resources|
                |object|
                |HttpClient|
                |RestService|

                |use resources|
                |object|
                |HttpClient|
                |RestService|

                import fit.Fixture;
                import fitlibrary.DoFixture;

                import java.util.LinkedList;
                import java.util.List;
                import java.util.function.Supplier;

                public class SetupFlow extends DoFixture {

                private final List<Supplier<Object>> complexObjects = new LinkedList<>();

                public Fixture prepareResources(){
                return new SetUpFixtureTest(this.complexObjects);
                }
                public Fixture useResources(){
                return new ResultFixture(this.complexObjects);
                }
                }


                import fitlibrary.SetUpFixture;
                import java.util.List;
                import java.util.function.Supplier;

                public class SetUpFixtureTest extends SetUpFixture {
                private final List<Supplier<Object>> complexObjects;

                public SetUpFixtureTest(List<Supplier<Object>> complexObjects) {
                this.complexObjects = complexObjects;
                }

                public void addObject(String obj){
                this.complexObjects.add(() -> obj);
                }
                }
                import fitlibrary.ArrayFixture;

                import java.util.AbstractMap.SimpleEntry;
                import java.util.List;
                import java.util.function.Supplier;

                import static java.util.stream.Collectors.toList;

                public class ResultFixture extends ArrayFixture {
                public ResultFixture(List<Supplier<Object>> complexObjects) {
                this.setActualCollection(complexObjects.stream()
                .map(x -> new SimpleEntry<>("object", x.get()))
                .collect(toList()));
                }
                }

                Thanks in Advance 

                Daniel

                2017-06-02 19:34 GMT+02:00 Andrew Dassing andrew.dassing@... [fitnesse] <fitnesse@yahoogroups.com>:
                 


                If you supply a sample DoFixture flow mode example, I'll convert it to Slim Script.




                Andy Dassing
                nielsen Clean Coding +1.813.366.5066



                On Thu, Jun 1, 2017 at 11:01 PM, Daniel Binkele-Raible dbinkeleraible@... [fitnesse] <fitnesse@yahoogroups.com> wrote:
                 

                Java 
                Would be great if you could point out some examples .. thankd

                Am 02.06.2017 04:33 schrieb "Mike Stockdale jediwhale@... [fitnesse]" <fitnesse@yahoogroups.com>:
                 

                Are you using Java, .NET or ?

                On 2017-06-01 02:34, dbinkeleraible@... [fitnesse] wrote:
                 

                Hi,

                http://www.fitnesse.org/FitNes se.FullReferenceGuide.UserGuid e.FixtureGallery.ImportantConc epts.FlowMode

                I am new to Fitnesse and I try to work out if which is more appropriate for my uses case: FIT or SLIM.
                The flowMode seems to work in my case quite well because the DoFixture can hold common data (e.g. setup date) for all sub-fixtures.
                Can this also be achieved with SLIM?
                If not should I use FIT? Is FIT still maintained?

                Thanks in advanced.

                Daniel





              • andydassing
                The first section is a direct conversion of your example. The next section is a runnable example to play with. Direct Conversion Wiki: !path lib/* !path bin
                Message 7 of 7 , Jun 7, 2017
                  The first section is a direct conversion of your example.  The next section is a runnable example to play with.

                  Direct Conversion
                  Wiki:
                  !path lib/*
                  !path bin

                  !define TEST_SYSTEM {slim}

                  !define ReferenceWIKI {fitnesse.org/FitNesse.FullReferenceGuide}
                  !define SlimWIKI (${ReferenceWIKI}.UserGuide.WritingAcceptanceTests.SliM)

                  |Import|
                  | org.apache.http.client    |
                  | some.rest.service.package |


                  |Library|
                  | object      |
                  | Http Client  |
                  | Rest Service |

                  |script|
                  | note | Do something with object OR HttpClient OR RestService |
                  ||
                  | note | For Import table package list see:  |
                  | note |   http://${SlimWIKI}.ImportTable    |
                  ||
                  | note | For Library table "actor" list see: |
                  | note |   http://${SlimWIKI}.LibraryTable   |
                  ||
                  | note | for Script Table "flow mode" see:   |
                  | note |   http://${SlimWIKI}.ScriptTable    |


                  Notes:
                  • Put the Import and Library tables in a SetUp page; this is standard FitNesse.
                  • Put the !path markups in a common parent page; this is standard FitNesse.
                  • Library items accept default constructors as well as constructors with arguments.
                  • Explore Scenarios and ScenarioLibrary for advanced DSL concepts.
                  - - - - - - - - - - -
                  Runnable Example
                  Wiki:
                  !path lib/*
                  !path bin

                  !define TEST_SYSTEM {slim}

                  |Import|
                  | my.path.to.objects |

                  |Library|
                  | My Object       | Dingo |
                  | My Http Client  |
                  | My Rest Service |

                  |script|
                  | ensure | object name was set |
                  | check  | get object name     | Dingo |
                  ||
                  | set object name | I'm Fido |
                  | show   | get object name |
                  | check  | get object name | I'm Fido |
                  | reject | object name contains | Alpha |
                  | check not | get object name | I'm Alpha |

                  |script|
                  | set object name |Object Name is Alpha|
                  | set http name   |Http Name is Omicron|
                  | set rest name   |REST Name is Epsilon|

                  |script|
                  | show | get http name   |
                  | show | get rest name   |
                  | show | get object name |

                  |script|
                  | check | get object name | Object Name is Alpha |
                  | check | get rest name | =~/^.EST.*is +[spE]{3}ilon$/ |

                  Source Files:
                  // -------------------------
                  // MyObject.java
                  package my.path.to.objects;

                  public class MyObject {

                      private String name;

                      public /*ctor*/ MyObject () {
                      }

                      public /*ctor*/ MyObject (final String name) {
                          this.name = name;
                      }

                      public void setObjectName (final String name) {
                          this.name = name;
                      }

                      public String getObjectName () {
                          return name;
                      }

                      public boolean objectNameWasSet () {
                          return name != null;
                      }

                      public boolean objectNameContains (final String text) {
                          return name.contains(text);
                      }
                  }

                  // -------------------------
                  // MyHttpClient.java
                  package my.path.to.objects;

                  public class MyHttpClient {
                      private String name = "huh?";

                      public void setHttpName (final String name) {
                          this.name  = name;
                      }
                      
                      public String getHttpName () {
                          return name;
                      }
                  }

                  // -------------------------
                  // MyRestService.java
                  package my.path.to.objects;

                  public class MyRestService {
                      private String name = "huh?";

                      public void setRestName (final String name) {
                          this.name  = name;
                      }
                      
                      public String getRestName () {
                          return name;
                      }
                  }





                Your message has been successfully submitted and would be delivered to recipients shortly.