Page History
...
이 샘플에서는 액터성능 테스트가 예시되어있지만 액터모델과 상관없이 유닛테스트내에서 심플한 측정모드를 이용할수 있습니다.
| Table of Contents |
|---|
테스트 탐색기
...
테스트 탐색기를 통해 성능유닛 테스트를 수행하고 측정할수 있습니다.
...
- https://github.com/psmon/NetCoreLabs/blob/main/ActorLibTest/Intro/RoutersTest.cs - 닷넷버전
- https://github.com/psmon/java-labs/blob/master/springweb/src/test/java/com/webnori/springweb/akka/README.md -자바버전으로도 병렬 작성중입니다.
기본 유닛테스트
...
| 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();
}
}
});
} |
...