SUnit and "data driven" tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SUnit and "data driven" tests

Holger Freyther
Hi,

I have a test/algorithm that I would like to test with different sets of input (and matching expected) output.

Let's imagine I write a protocol library for the RTP streaming protocol and would like to verify my implementation of sequence number wrapping and jitter delay, e.g. the difficulty is to deal with the sequence number counter wrapping.

My test-input is an array of sequence numbers and their arrival time and the expected result would be a calculation of "packet loss", jitter. I would like SUnit to call my testcase multiple times with different data being available.

Is something like this supported with SUnit?

thank you
        holger
Reply | Threaded
Open this post in threaded view
|

Re: SUnit and "data driven" tests

Henrik Nergaard
One possibility is to move the assertions to another method and have each test method invoke that method with a specific input.

For example
testPacketA

 self assertJitterIn: #( 1 2 3 4) equals: 42


Best regards,
Henrik

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of Holger Freyther
Sent: Friday, August 12, 2016 10:21 AM
To: Any question about pharo is welcome <[hidden email]>
Subject: [Pharo-users] SUnit and "data driven" tests

Hi,

I have a test/algorithm that I would like to test with different sets of input (and matching expected) output.

Let's imagine I write a protocol library for the RTP streaming protocol and would like to verify my implementation of sequence number wrapping and jitter delay, e.g. the difficulty is to deal with the sequence number counter wrapping.

My test-input is an array of sequence numbers and their arrival time and the expected result would be a calculation of "packet loss", jitter. I would like SUnit to call my testcase multiple times with different data being available.

Is something like this supported with SUnit?

thank you
        holger