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

Does TDD in Puppet make sense, if positive how to implement it
Why we should start with a failing test in TDD?
TDD is applicable all the time? [closed]
Avoiding code duplication when defining Gherkin Given and When statements
Guard : phpunit is not installed on your machine
How to write User Stories for technical implementation details?
Test Driven Development process
The following setups were not matched - converting JustMock to Moq
Fitnesse ScenarioLibrary is not being included in the tests
How to TDD a 2-steps process which requires input from a remote party?
What are the guiding principles when practicing TDD? [closed]
TDD: refactoring and global regressions
Cucumber capybara fill_in failing
Applying TDD in Spikes
Test rig in TDD (test driven development)
TDD: Test first or Repository pattern first

Categories

HOME
asp.net-core
blogger
keras
isabelle
path-finding
google-play
react-virtualized
objectgears
youtube-dl
paw-app
v8
baqend
fancybox-3
volttron
spring-xd
google-cloud-ml
event-handling
fallback
dosgi
connection-string
jprofiler
swingx
reverse-proxy
ehcache
core-text
bootstrap-tour
language-agnostic
tibco-mdm
buildbot
linkerd
ping
saas
log4js-node
jspm
madlib
tinymce-4
pim
appfabric
vxworks
android-fingerprint-api
tasker
galen
fedex
nand2tetris
nxlog
cubic-spline
osx-mavericks
multipeer-connectivity
powercli
statsd
mplayer
magma
android-cursor
mediaelement
pycaffe
objective-c-swift-bridge
instant
passport-google-oauth
grails-tomcat-plugin
savon
flash-cs5
hill-climbing
freedesktop.org
maven-tomcat-plugin
cartesian-product
content-length
emailrelay
service-accounts
unity3d-gui
bridge.net
sorl-thumbnail
oxwall
jscript.net
qpainter
codeigniter-url
gui-test-framework
winddk
bitcoinj
openexr
marmalade
picturefill
srs
.aspxauth
tws
cos
django-nonrel
seed
plasma
mqx
sharp-repository
android-hardware
e4x
browser-detection
dmoz
funscript
dbproviderfactories
bubble-chart
custom-backend
deobfuscation
yui-datatable
krl
winbugs14
yslow
rescale
brewmp
iweb
defensive-programming

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App