DaedalicEntertainment / ue4-test-automation

Facilitates setting up integration test suits with Unreal Engine 4 Gauntlet.
https://www.daedalic.com
MIT License
215 stars 62 forks source link

Empty DaeTestConfig fields #18

Closed helghast closed 2 years ago

helghast commented 3 years ago

I don't know why, but if I don't force it to read DaeTestConfig fields (JUnitReportPath, ReportPath, TestName), it leaves them empty and it doesn't generate the reports or choose the map to test. (DaeGauntletTest.cs)

`public override DaeTestConfig GetConfiguration() { DaeTestConfig Config = base.GetConfiguration(); // force read commandline field Config.JUnitReportPath = Context.TestParams.ParseValue("JUnitReportPath", ""); Config.ReportPath = Context.TestParams.ParseValue("ReportPath", ""); Config.TestName = Context.TestParams.ParseValue("TestName", "");

        Log.Warning("DaeTestConfig Config: {0}, {1}, {2}", Config.JUnitReportPath, Config.ReportPath, Config.TestName);

        // Start a single instance of the game.
        UnrealTestRole ClientRole = Config.RequireRole(UnrealTargetRole.Client);
        ClientRole.Controllers.Add("DaeGauntletTestController");
        // force write client command fields
        ClientRole.CommandLine += string.Format(" -JUnitReportPath=\"{0}\"", Config.JUnitReportPath);
        ClientRole.CommandLine += string.Format(" -ReportPath=\"{0}\"", Config.ReportPath);
        ClientRole.CommandLine += string.Format(" -TestName=\"{0}\"", Config.TestName);

        Log.Warning("DaeTestConfig ClientRole.CommandLine: {0}", ClientRole.CommandLine);

        // Ignore user account management.
        Config.NoMCP = true;

        return Config;

}`

image

chadmv commented 3 years ago

The original DaeTestConfig.cs needs to have some dashes added when it adds the flags to the commandline

Original

public override void ApplyToConfig(UnrealAppConfig AppConfig, UnrealSessionRole ConfigRole, IEnumerable<UnrealSessionRole> OtherRoles)
{
    base.ApplyToConfig(AppConfig, ConfigRole, OtherRoles);

    if (!string.IsNullOrEmpty(JUnitReportPath))
    {
        AppConfig.CommandLine += string.Format(" JUnitReportPath=\"{0}\"", JUnitReportPath);
    }

    if (!string.IsNullOrEmpty(ReportPath))
    {
        AppConfig.CommandLine += string.Format(" ReportPath=\"{0}\"", ReportPath);
    }

    if (!string.IsNullOrEmpty(TestName))
    {
        AppConfig.CommandLine += string.Format(" TestName=\"{0}\"", TestName);
    }
}

Updated

public override void ApplyToConfig(UnrealAppConfig AppConfig, UnrealSessionRole ConfigRole, IEnumerable<UnrealSessionRole> OtherRoles)
{
    base.ApplyToConfig(AppConfig, ConfigRole, OtherRoles);

    if (!string.IsNullOrEmpty(JUnitReportPath))
    {
        AppConfig.CommandLine += string.Format(" -JUnitReportPath=\"{0}\"", JUnitReportPath);
    }

    if (!string.IsNullOrEmpty(ReportPath))
    {
        AppConfig.CommandLine += string.Format(" -ReportPath=\"{0}\"", ReportPath);
    }

    if (!string.IsNullOrEmpty(TestName))
    {
        AppConfig.CommandLine += string.Format(" -TestName=\"{0}\"", TestName);
    }
}
janousch commented 2 years ago

@chadmv Thanks for the tip :) Fixed in commit 925142971a2fe3847bf3dce2e4ad20196e6f24f0 .