[Pharo-dev] Tests with multiple processes
norbert at hartl.name
Tue Oct 29 18:34:08 EDT 2013
Am 29.10.2013 um 22:35 schrieb Chris Muller <asqueaker at gmail.com>:
> Testing with real sockets, across multiple images is the only way I
> would trust my own networking programs. OSProcess makes that an easy,
> one-click affair.
Agreed. That is what we do in addition. I’m doing tests for the logic behind the network. So this more about mocking the end-to-end communication in order to make a proper set of business logic tests.
> On Mon, Oct 28, 2013 at 5:50 PM, Norbert Hartl <norbert at hartl.name> wrote:
>> I’m working on project that deals with server to server communication. For the test suite it is necessary to simulate the two ends of the communication within one test. The problem is that in a single threaded environment you make a send call SC from server A to B but the response of B will happen before SC returned. That makes every state change the happens in A after SC bogus from a call flow perspective.
>> There are two approaches that have their own problems.
>> 1) Until now I’m reordering parts of the call stack to simulate the return of a call before the actual call is sent. But now I have nested sends that make my simple approach not working anymore. I could elaborate my approach by using something like delimited continuations to make a less brittle approach to stack call reordering in order to cope with the problem. That would need some work and the stack in the debugger will look a little bit odd/confusing.
>> 2.) The product will later have a dispatcher process that dispatches each send operation in its own process. That would solve one problem: the timing of when actions happen. But I’m not sure if it will be easy to orchestrate actions in a way that I would call controlled in order to have reliable tests.
>> Are there any approaches to simulate coroutines in a single thread environment or approaches to deal with multiple processes within one process?
>> It is hard to explain and I hope my description of the problem is understandable
>> thanks in advance,
More information about the Pharo-dev