Hello there,
I started writing automation tests for a multiplayer project and realise they do not execute any Server methods. What do I need to do/change for this to work?
Im fairly new to automation testing and dont know if this is the wrong or right way of doing this. However I know I already have Server and Client methods and do not wish to make local ‘duplicates’ of them just for testing.
Here’s snippet of the code:
IMPLEMENT_SIMPLE_AUTOMATION_TEST(FGunTest_ReloadAboveClipSize, "Gameplay.Combat.Gun.Reload Above ClipSize", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter)
bool FGunTest_ReloadAboveClipSize::RunTest(const FString& Parameters) {
UWorld* world = UWorld::CreateWorld(EWorldType::Editor, true, TEXT("TestWorld"));
FWorldContext& worldContext = GEngine->CreateNewWorldContext(EWorldType::Editor);
worldContext.SetCurrentWorld(world);
AGun* gun = world->SpawnActor<AGun>();
//>> This method is meant to be ran on the Server and doesnt happen!
gun->SrvReloadBullets(gun->GetClipSize()+1);
//>> This method is ran locally and works, but I dont want to use it.
gun->AddBullets(gun->GetClipSize()+1);
if (gun->GetNbBulletsInClip() > gun->GetClipSize()) {
return false;
}
gun->Destroy();
world->DestroyWorld(false, nullptr);
return true;
}
Also, would there be any way of waiting for clients to synchronize (or plainly x seconds) ?
Any way of switching to the client side?
Thank you <3