>
> Yes, exactly! Think of it as an HTTP endpoint, you can only send messages 
> and see what it responds with, if you can observe the effect of the 
> previous message by sending it another message, then you can observe and 
> test the relationship.


*Gold.* Thank you. 

On Thursday, 20 November 2014 09:58:06 UTC+11, √ wrote:
>
>
>
> On Wed, Nov 19, 2014 at 11:51 PM, Richard Rodseth <rrod...@gmail.com 
> <javascript:>> wrote:
>
>> Hmm. I think what you're saying is that I shouldn't worry about 
>> validating actor state, only what outgoing messages are emitted. In this 
>> case, I might pump some measurement data into the parent, do an expectNoMsg 
>> on the client of the event bus. Pump some more data that *should* trigger 
>> notifications, and do an expectMsg. I think that would work, in conjunction 
>> with unit tests of the internal classes. There are some internal buffers 
>> that I felt I should verify that they are cleared, but I'll think over your 
>> advice.
>>
>>
> Yes, exactly! Think of it as an HTTP endpoint, you can only send messages 
> and see what it responds with, if you can observe the effect of the 
> previous message by sending it another message, then you can observe and 
> test the relationship.
>  
>
>> If this is universally true, then use of underlyingActor seems like an 
>> anti-pattern.
>>
>
> I'd say it is, but there may be cases where this is needed/required.
>  
>
>>
>> On Wed, Nov 19, 2014 at 11:52 AM, √iktor Ҡlang <viktor...@gmail.com 
>> <javascript:>> wrote:
>>
>>> I'm sorry, I didn't imply that you should add a status message, but if 
>>> the effects of changing the actors state is not observable in its behavior, 
>>> then why does it matter?
>>>
>>> On Wed, Nov 19, 2014 at 5:45 PM, Richard Rodseth <rrod...@gmail.com 
>>> <javascript:>> wrote:
>>>
>>>> I can use underlyingActor, but perhaps that doesn't qualify as "from 
>>>> the outside".
>>>> I might have a GetInfo message I could use (that exists to support a 
>>>> REST API).
>>>>
>>>>
>>>> On Wed, Nov 19, 2014 at 7:59 AM, √iktor Ҡlang <viktor...@gmail.com 
>>>> <javascript:>> wrote:
>>>>
>>>>> Can you, from the outside, observe whether it updated its internal 
>>>>> state?
>>>>>
>>>>> On Wed, Nov 19, 2014 at 4:53 PM, Richard Rodseth <rrod...@gmail.com 
>>>>> <javascript:>> wrote:
>>>>>
>>>>>> Sorry. The parent actor P gets a message containing measurement data. 
>>>>>> It calculates a sequence of notifications about that data, which it 
>>>>>> passes 
>>>>>> to the per-request child after become()ing "saving". That child updates 
>>>>>> the 
>>>>>> persistent state of P, and if that succeeds, posts the notifications to 
>>>>>> an 
>>>>>> event bus and sends an ack back to P, at which point P updates its 
>>>>>> internal 
>>>>>> in-memory model (advancing a time stamp, basically). 
>>>>>>
>>>>>> There are actually many Ps, but my "micro-integration test" is just 
>>>>>> to check that P sends the proper notifications to the event bus, and 
>>>>>> updates its internal state.
>>>>>>
>>>>>>
>>>>>> On Wed, Nov 19, 2014 at 3:48 AM, √iktor Ҡlang <viktor...@gmail.com 
>>>>>> <javascript:>> wrote:
>>>>>>
>>>>>>> I'm not sure I follow. Test for what message and what effect?
>>>>>>>
>>>>>>> On Wed, Nov 19, 2014 at 1:05 AM, Richard Rodseth <rrod...@gmail.com 
>>>>>>> <javascript:>> wrote:
>>>>>>>
>>>>>>>> This does rather beg the question of what the integration boundary 
>>>>>>>> is, and also if the use case in question ends with an ack back to the 
>>>>>>>> initiating actor, how would one test for that message (or its effect), 
>>>>>>>> given that it's a TestActorRef rather than a TestProbe. 
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Nov 18, 2014 at 3:08 PM, Richard Rodseth <rrod...@gmail.com 
>>>>>>>> <javascript:>> wrote:
>>>>>>>>
>>>>>>>>> Thanks for the input. I guess I can register a testprobe.ref as a 
>>>>>>>>> subscriber to the event bus. I will still need to control the 
>>>>>>>>> creation of 
>>>>>>>>> the per-request child so that I can inject a mock storage interface 
>>>>>>>>> that 
>>>>>>>>> acks with success so that the posting to the event bus occurs.
>>>>>>>>>
>>>>>>>>> On Tue, Nov 18, 2014 at 2:48 PM, √iktor Ҡlang <viktor...@gmail.com 
>>>>>>>>> <javascript:>> wrote:
>>>>>>>>>
>>>>>>>>>> You can test that the parent passed the correct set of results to 
>>>>>>>>>> the child actor by observing the results of the child actors 
>>>>>>>>>> processing.
>>>>>>>>>>
>>>>>>>>>> Usually it becomes tricky to apply Unit Testing to Actors, think 
>>>>>>>>>> Integration testing instead (but at a microlevel).
>>>>>>>>>>
>>>>>>>>>> On Tue, Nov 18, 2014 at 11:43 PM, Richard Rodseth <
>>>>>>>>>> rrod...@gmail.com <javascript:>> wrote:
>>>>>>>>>>
>>>>>>>>>>> The message A in the parent actor is computing a set of results. 
>>>>>>>>>>> The per-request child will be saving some state from those results, 
>>>>>>>>>>> and if 
>>>>>>>>>>> successful, posting a domain event containing the results to an 
>>>>>>>>>>> event bus 
>>>>>>>>>>> and also acking back to the parent.
>>>>>>>>>>>
>>>>>>>>>>> To begin with, I just wish to test that the parent actor passed 
>>>>>>>>>>> the correct set of results to the child constructor.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Nov 18, 2014 at 2:24 PM, √iktor Ҡlang <
>>>>>>>>>>> viktor...@gmail.com <javascript:>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Richard,
>>>>>>>>>>>>
>>>>>>>>>>>> what effects are you trying to test?
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, Nov 18, 2014 at 11:17 PM, Richard Rodseth <
>>>>>>>>>>>> rrod...@gmail.com <javascript:>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> I have a parent actor which, on receipt of a certain message 
>>>>>>>>>>>>> A, spawns a child actor, and sends it a "Run" message with no 
>>>>>>>>>>>>> parameters. 
>>>>>>>>>>>>> The child actor has constructor parameters derived from the 
>>>>>>>>>>>>> contents of 
>>>>>>>>>>>>> message A.
>>>>>>>>>>>>>
>>>>>>>>>>>>> What's the best way to test this? I don't think I can apply 
>>>>>>>>>>>>> techniques like
>>>>>>>>>>>>> childMaker: ActorRefFactory => ActorRef
>>>>>>>>>>>>> because of the per-request constructor parameters.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>  -- 
>>>>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>>>>> --- 
>>>>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from 
>>>>>>>>>>>>> it, send an email to akka-user+...@googlegroups.com 
>>>>>>>>>>>>> <javascript:>.
>>>>>>>>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>>>>>>>>> <javascript:>.
>>>>>>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> √
>>>>>>>>>>>>  
>>>>>>>>>>>> -- 
>>>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>>>> --- 
>>>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from 
>>>>>>>>>>>> it, send an email to akka-user+...@googlegroups.com 
>>>>>>>>>>>> <javascript:>.
>>>>>>>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>>>>>>>> <javascript:>.
>>>>>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  -- 
>>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>>> --- 
>>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from 
>>>>>>>>>>> it, send an email to akka-user+...@googlegroups.com 
>>>>>>>>>>> <javascript:>.
>>>>>>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>>>>>>> <javascript:>.
>>>>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> Cheers,
>>>>>>>>>> √
>>>>>>>>>>  
>>>>>>>>>> -- 
>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>> --- 
>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>>>> send an email to akka-user+...@googlegroups.com <javascript:>.
>>>>>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>>>>>> <javascript:>.
>>>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>  -- 
>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>> --- 
>>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>>> Groups "Akka User List" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>> send an email to akka-user+...@googlegroups.com <javascript:>.
>>>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>>>> <javascript:>.
>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> Cheers,
>>>>>>> √
>>>>>>>  
>>>>>>> -- 
>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>> https://groups.google.com/group/akka-user
>>>>>>> --- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "Akka User List" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to akka-user+...@googlegroups.com <javascript:>.
>>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>>> <javascript:>.
>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>  -- 
>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>> >>>>>>>>>> Search the archives: 
>>>>>> https://groups.google.com/group/akka-user
>>>>>> --- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Akka User List" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to akka-user+...@googlegroups.com <javascript:>.
>>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>>> <javascript:>.
>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Cheers,
>>>>> √
>>>>>  
>>>>> -- 
>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>> >>>>>>>>>> Check the FAQ: 
>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>> >>>>>>>>>> Search the archives: 
>>>>> https://groups.google.com/group/akka-user
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Akka User List" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to akka-user+...@googlegroups.com <javascript:>.
>>>>> To post to this group, send email to akka...@googlegroups.com 
>>>>> <javascript:>.
>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  -- 
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ: 
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives: 
>>>> https://groups.google.com/group/akka-user
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to akka-user+...@googlegroups.com <javascript:>.
>>>> To post to this group, send email to akka...@googlegroups.com 
>>>> <javascript:>.
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Cheers,
>>> √
>>>  
>>> -- 
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: 
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >>>>>>>>>> Search the archives: 
>>> https://groups.google.com/group/akka-user
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to akka-user+...@googlegroups.com <javascript:>.
>>> To post to this group, send email to akka...@googlegroups.com 
>>> <javascript:>.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  -- 
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com <javascript:>.
>> To post to this group, send email to akka...@googlegroups.com 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> √
>  

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to