Running test script scenarios in python
<p>I'm developing a script to test another program. Basically I replicated a class with all the functions that the program I am testing have. To make things simple, assume I have only 2 functions: set(value) and add(value). set(value) sets an accumulator value and add(value) adds value to it; and I'm testing a program that should do the same thing.</p>

<p>I also have a check() function that verifies that the accumulator value in which set(value) and add(value) operates have the same value as the value retrieved by the program I'm testing; so, after EACH operation, I want to run this check() function and make sure they match.</p>

<p>To try to make this clear, here's a (non-tested) example:</p>

<pre><code>def set(self, value):
    self.acc = value
    sendCommandToMyProgram('set', value)

def add(self, value):
    self.acc += value
    sendCommandToMyProgram('add', value)

def check(self):
    return self.acc == sendCommandToMyProgram('check', value)
</code></pre>

<p>and I want to do "test scenarios" like:</p>

<pre><code>set(1)
check()
add(2)
check()
add(-2)
check()
add(3)
</code></pre>

<p>and many others</p>

<p>What would be the best way to make this "test scenario" script? It would be nice if it could work with functions that takes different parameters (in this example, both set() and add() received just one parameter - value -, but this isn't always the case).</p>

<p>thanks</p>
