DaedalicEntertainment/ue4-test-automation

Empty DaeTestConfig fields

helghast opened this issue · 2 comments

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

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);
	}
}

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