tdd


Testing behavior not consistent when watching actor for termination


When I write tests that involve subscribing to events on the Eventstream or watching actors and listning for "Terminated", the tests work fine running them 1 by 1 but when I run the whole testsuite those tests fail.
Tests also works if each of those tests are in a separate test class with Xunit.
How come?
A repo with those kind of tests: https://github.com/Lejdholt/AkkaTestError
Took a look at your repository. I can reproduce the problems you are describing.
It feels like a bug in the TestKit, some timing issue somewhere. But its hard to pin down.
Also, not all unit test frameworks are created equally. The testkit uses its own TaskDispatcher to enable the testing of what are normally inherently asynchronous processed operations.
This sometimes causes some conflicts with the testframework being used. Is also coincidentally why akka.net also moved to XUnit for their own CI process.
I have managed to fix your problem, by not using the TestProbe. Although im not sure if the problem lies with the TestProbe per say, or the fact that your where using an global reference (your 'process' variable).
I suspect that the testframework, while running tests in parrallel, might be causing some wierd things to happen with your testprobe reference.
Example of how i changed one of your tests:
[Test]
public void GivenAnyTime_WhenProcessTerminates_ShouldLogStartRemovingProcess()
{
IProcessFactory factory = Substitute.For<IProcessFactory>();
var testactor = Sys.ActorOf<FakeActor>("test2");
processId = Guid.NewGuid();
factory.Create(Arg.Any<IActorRefFactory>(), Arg.Any<SupervisorStrategy>()).Returns(testactor);
manager = Sys.ActorOf(Props.Create(() => new Manager(factory)));
manager.Tell(new StartProcessCommand(processId));
EventFilter.Info("Removing process.")
.ExpectOne(() => Sys.Stop(testactor));
}
It should be fairly self explanatory on how you should change your other test.
The FakeActor is nothing more then an empty ReceiveActor implementation.

Related Links

Selenium vs Celerity? [closed]
TDD and Code Coverage
Testing state in S#arp Architecture - Best practice
TDD System Under Test Creation Patterns (AutoFixture)
What is test-driven development? [duplicate]
Unit tests in TDD
Is Agile different from TDD ? If so what are the main differences?
What are the types of bugs test-driven development is most effective at catching?
TDD with Strategy Pattern
Is there a good place to discuss Test Driven Development?
TDD and UML together
TDD Example for Business Apps
How did/would you “force” yourself to do TDD rather than TAD? [closed]
Test driven development: Inversion of Control (IOC)
What failure modes can TDD leave behind?
Project Implementation estimates with TDD

Categories

HOME
pandas
client
amazon-ec2
zeromq
fluentd
google-api-php-client
iot
ebean
azure-storage-tables
append
session-variables
moonmail
ibm-odm
systemc
ef-migrations
footer
aurigma
connection-string
errorlevel
orleans
devops
opennlp
dynamic-featured-image
maxmind
replaceall
newline
nat
lightswitch-2013
google-qpx-express-api
stringtemplate
subset-sum
nssegmentedcontrol
ansible-playbook
splice
texmaker
powershell-dsc
eigenvalue
bootstrap-dialog
reactive-cocoa-5
sas-jmp
google-datalayer
menuitem
domain-model
dropbox-php
slickedit
knockout-components
imanage
redundancy
instant
measures
plottable.js
clang-static-analyzer
actionbardrawertoggle
superstack
ready-api
oauth2client
tcpserver
wso2cloud
thredds
generic-programming
system32
key-management
codeigniter-url
relocation
wordpress-theme-customize
dml
picturefill
ember-charts
mbr
xsockets.net
blending
coverflow
shellexecute
ocunit
factory-method
dbproviderfactories
bubble-chart
spring-portlet-mvc
transactionscope
coredump
hamachi
lpeg
visitor-statistic
w3wp.exe
infrastructure
mirah
memory-size
exchange-server-2003
noscript
pascal-fc
port-number
paul-graham

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App