Page History
...
이 샘플에서는 액터성능 테스트가 포함되어 있지만 액터모델과 상관없이 유닛테스트내에서 성능테스트툴을 이용할수 있습니다.
테스트 탐색기
테스트 탐색기를 통해 성능유닛 테스트를 수행하고 측정할수 있습니다.
...
기본 유닛테스트
| Code Block |
|---|
[Theory(DisplayName = "RoundRobinPoolTest")]
[InlineData(3,1000)]
public void RoundRobinPoolTest(int nodeCount, int testCount, bool isPerformTest = false)
{
var actorSystem = akkaService.GetActorSystem();
TestProbe testProbe = this.CreateTestProbe(actorSystem);
var props = new RoundRobinPool(nodeCount)
.Props(Props.Create(() => new BasicActor()));
var actor = actorSystem.ActorOf(props);
for (int i = 0; i < nodeCount; i++)
{
actor.Tell(testProbe.Ref);
}
int cutOff = 3000;
Within(TimeSpan.FromMilliseconds(cutOff), () =>
{
for (int i = 0; i < testCount; i++)
{
actor.Tell("hello" + i);
}
for (int i = 0; i < testCount; i++)
{
testProbe.ExpectMsg("world");
if (isPerformTest)
{
_dictionary.Add(_key++, _key);
_addCounter.Increment();
}
}
});
} |
...