Skip to content
ericmeyer edited this page Sep 1, 2012 · 6 revisions

Decision Tables

What are they?

They are described here: http://fitnesse.org/FitNesse.UserGuide.SliM.DecisionTable. This document is more how to implement them.

When Would I Use Them?

Decision tables are good for testing anything can be defined as a set of inputs and outputs, so they can be used for a wide variety of tests.

Mathematical functions obviously lend themselves well to this as does a lot of game logic.

On the MasterMind project, a decision table was used to drive the behavior of the taking a guess. https://github.com/ericmeyer/MasterMind

How to Implement Them

Fitnesse Page

!|adding two numbers|
|a   |b   |result?  |
|1   |2   |3        |
|11  |11  |22       |
|10  |5   |15       |

AddingTwoNumbers.h

#import <Foundation/Foundation.h>

@interface AddingTwoNumbers : NSObject

@property (nonatomic, strong) NSString* a;
@property (nonatomic, strong) NSString* b;

@end

AddingTwoNumbers.m

#import "AddingTwoNumbers.h"

@implementation AddingTwoNumbers

-(int) result {
    return [self.a intValue] + [self.b intValue];
}

@end

Clone this wiki locally