issue with using booleans in table #execute commands

91 views
Skip to first unread message

Karl Cassar

unread,
Aug 18, 2014, 11:20:46 AM8/18/14
to concordio...@googlegroups.com
I've been testing out Concordion.Net, and looks great.  I came up with an issue when executing multiple datasets in a table.  Basically, I have an input variable called 'isClosed' set as a boolean.  When set as boolean, this outputs an error in the test as per below:

The <table> 'execute' command only supports rows with an equal number of columns.

If instead of boolean I use an string, and then for example I compare to a value of "Y" (isClosed == "Y"), it works fine.

Attached you can find a zip file with two very similar tests.

  • MakingABooking_usingBools:  The test which fails, which uses booleans
  • MakingABooking_usingStrings: The test which works.
As you can see, both are using very similar data.

Specification and code is copied below for convenience.

Specification

<!DOCTYPE html>
<head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type" />
    <style type="text/css">
        .auto-style1 {
            width: 345px;
        }
    </style>
</head>
    <body>
        <h2>Booking 2.1</h2>
        <p>
            A booking can be made by a customer, at a specific time, for an amount of covers.
        </p>
        <p>
            The restaurant must have enough space at that particular time. Also, that particular time must not be closed
        </p>
        <p>
            <table concordion:execute="#result = MakeBooking(#totalCovers, #coversRemaining, #isClosed)" style="width: 100%;">
                <tr>
                    <th>Comment</th>
                    <th concordion:set="#totalCovers">Total Covers</th>
                    <th concordion:set="#coversRemaining">Remaining covers booked in all restasurant</th>
                    <th concordion:set="#isClosed">closed</th>
                    <th concordion:assertEquals="#result.canBook">can book</th>
                    <th concordion:assertEquals="#result.remainingCovers">remaining covers booked in all restaurant - after</th>
                </tr>
                <tr>
                    <td>Not enough remaining covers</td>
                    <td>6</td>
                    <td>5</td>
                    <td>n</td>
                    <td>N</td>
                    <td>5</td>
                </tr>

                <tr>
                    <td>Enough covers and open</td>
                    <td>8</td>
                    <td>12</td>
                    <td>N</td>
                    <td>Yes</td>
                    <td>4</td>
                </tr>

                <tr>
                    <td>enough covers but closed</td>
                    <td>8</td>
                    <td>12</td>
                    <td>Y</td>
                    <td>false</td>
                    <td>12</td>
                </tr>

                <tr>
                    <td>not enough covers and closed</td>
                    <td>6</td>
                    <td>5</td>
                    <td>true</td>
                    <td>No</td>
                    <td>5</td>
                </tr>

            </table>

        </p>
    </body>
</html>


Failing Code

        public Result MakeBooking(int totalCovers,
            int remainingCoversBookedInAllRestaurant,
            bool isClosed)
        {
            //given
            RestaurantTimeInfo timeInfo = new RestaurantTimeInfo();
            timeInfo.RemainingCovers = remainingCoversBookedInAllRestaurant;
            timeInfo.IsClosed = isClosed;

            //when
            var result = checkIfCanBook(timeInfo, totalCovers);

            //then

            return result;

        }

Working Code


        public Result MakeBooking(int totalCovers,
            int remainingCoversBookedInAllRestaurant,
            string isClosed)
        {
            //given
            RestaurantTimeInfo timeInfo = new RestaurantTimeInfo();
            timeInfo.RemainingCovers = remainingCoversBookedInAllRestaurant;
            timeInfo.IsClosed = strToBool(isClosed);

            //when
            var result = checkIfCanBook(timeInfo, totalCovers);

            //then

            return result;

        }


Any ideas?






sample-test.zip

j.r.

unread,
Aug 21, 2014, 6:59:48 AM8/21/14
to concordio...@googlegroups.com
Concordion.NET currently only supports Yes/No only in AssertEquals and not (yet) with input values.
If you change your bool input variables in the html specification to true/false, your tests are executed (there is still a failing test though).


Reply all
Reply to author
Forward
0 new messages