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

Logical operations in Fitnesse wiki

Expand Messages
  • kanth_cbp
    Hi, I am using fitnesse for an action script project. I am facing a situation where in I am supposed to check the correctnesse of the out put by comparing it
    Message 1 of 3 , Jan 2, 2012
    • 0 Attachment
      Hi,

      I am using fitnesse for an action script project. I am facing a situation where in I am supposed to check the correctnesse of the out put by comparing it with many options and if the output matches with any one of the options then the test case is passed. in simple words I want OR operator to be used
      Something like:
      |check|myFunction|output1 OR output2 OR...|

      But did not get how to implement this in my wiki page. Any way I can do this in my fixtures but is there any way to implement this selective comparison in Wiki page itself?
    • Dan Woodward
      There isn t really an OR function. Are you saying that a given test is never deterministic? That if you supply the same inputs that it can vary every time?
      Message 2 of 3 , Jan 3, 2012
      • 0 Attachment
        There isn't really an OR function.

        Are you saying that a given test is never deterministic? That if you supply the same inputs that it can vary every time? What makes it necessary for multiple outcomes to be possible?

        How many variations in output are there?

        If it is a limited set, then you could build fixtures that allow for multiple values to check against and then return a string version of true indicate success and then return the actual value if none of them match.

        My recommendation is to determine if there is a way to reduce the variability in the output and then be able to test getting each of the expected outputs. After all, if the test could respond with result A or B, but the system never responds with B, how would you know if you allowed for both choices. You might have a bug, since you never create the condition that results in B.

        Dan Woodward
        http://whotestedthis.squarespace.com
        ------
        FitNesse using Java and SliM



        --- In fitnesse@yahoogroups.com, "kanth_cbp" <kanth_cbp@...> wrote:
        >
        > Hi,
        >
        > I am using fitnesse for an action script project. I am facing a situation where in I am supposed to check the correctnesse of the out put by comparing it with many options and if the output matches with any one of the options then the test case is passed. in simple words I want OR operator to be used
        > Something like:
        > |check|myFunction|output1 OR output2 OR...|
        >
        > But did not get how to implement this in my wiki page. Any way I can do this in my fixtures but is there any way to implement this selective comparison in Wiki page itself?
        >
      • Dassing, Andrew
        I recommend a fixture method that takes a list, then call the SUT method ... Sample wiki page: !define TEST_SYSTEM {slim} ![ library
        Message 3 of 3 , Jan 3, 2012
        • 0 Attachment
          RE: [fitnesse] Re: Logical operations in Fitnesse wiki

          I recommend a fixture method that takes a list, then call the SUT method and loop through the value list.  Maybe something like this:
          |
          check| check my function |output1,output2,output3| Found |

          Sample wiki page:

              !define TEST_SYSTEM {slim}

              ![ library

                 bogus.fixture.MyHashExample

              ]!


              ![~ script

                check ~ check my function ~ this,bogus,that ~ Found

              ]!

          In the fixture:

              package bogus.fixture;
              import java.util.List;

              public class MyHashExample {

                  //-- -- -- -- -- -- -- -- -- -- -- -- -- --
                  public/* ctor */MyHashExample () {}
                 
                  //-- -- -- -- -- -- -- -- -- -- -- -- -- --
                  public String checkMyFunction (final List<String> expectedValues) {
                      boolean isMatched = false;
                      String functionValue = myFunction();
                      if (expectedValues != null) {
                          for (String expectedValue : expectedValues) {
                              isMatched = functionValue.equals(expectedValue);
                              if (isMatched) break;
                          }
                      }
                      return isMatched? "Found" : ("Got '" + functionValue + "' but expected " + expectedValues);
                  }

                  public String myFunction () {  //...simulates your SUT function
                      return "bogus";
                  }
              }

          From: fitnesse@yahoogroups.com [mailto:fitnesse@yahoogroups.com] On Behalf Of Dan Woodward

          Sent: Tuesday, January 03, 2012 10:20 AM

          To: fitnesse@yahoogroups.com

          Subject: [fitnesse] Re: Logical operations in Fitnesse wiki

           

          There isn't really an OR function.

          Are you saying that a given test is never deterministic? That if you supply the same inputs that it can vary every time? What makes it necessary for multiple outcomes to be possible?

          How many variations in output are there?

          If it is a limited set, then you could build fixtures that allow for multiple values to check against and then return a string version of true indicate success and then return the actual value if none of them match.

          My recommendation is to determine if there is a way to reduce the variability in the output and then be able to test getting each of the expected outputs. After all, if the test could respond with result A or B, but the system never responds with B, how would you know if you allowed for both choices. You might have a bug, since you never create the condition that results in B.

          Dan Woodward

          http://whotestedthis.squarespace.com

          ------

          FitNesse using Java and SliM

          --- In fitnesse@yahoogroups.com, "kanth_cbp" <kanth_cbp@...> wrote:

          >

          > Hi,

          >

          > I am using fitnesse for an action script project. I am facing a situation where in I am supposed to check the correctnesse of the out put by comparing it with many options and if the output matches with any one of the options then the test case is passed. in simple words I want OR operator to be used

          > Something like:

          > |check|myFunction|output1 OR output2 OR...|

          >

          > But did not get how to implement this in my wiki page. Any way I can do this in my fixtures but is there any way to implement this selective comparison in Wiki page itself?

          >

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