public Api.ExecutionSettings BuildApiExecutionSettings(string[] commandLineArgs) { var quit = false; string testPlatform = TestMode.EditMode.ToString(); string[] testFilters = null; string[] testCategories = null; string testSettingsFilePath = null; int testRepetitions = 1; var optionSet = new CommandLineOptionSet( new CommandLineOption("quit", () => { quit = true; }), new CommandLineOption("testPlatform", platform => { testPlatform = platform; }), new CommandLineOption("editorTestsFilter", filters => { testFilters = filters; }), new CommandLineOption("testFilter", filters => { testFilters = filters; }), new CommandLineOption("editorTestsCategories", catagories => { testCategories = catagories; }), new CommandLineOption("testCategory", catagories => { testCategories = catagories; }), new CommandLineOption("testSettingsFile", settingsFilePath => { testSettingsFilePath = settingsFilePath; }), new CommandLineOption("testRepetitions", reps => { testRepetitions = int.Parse(reps); }) ); optionSet.Parse(commandLineArgs); DisplayQuitWarningIfQuitIsGiven(quit); CheckForScriptCompilationErrors(); LogParametersForRun(testPlatform, testFilters, testCategories, testSettingsFilePath); var testSettings = GetTestSettings(testSettingsFilePath); var filter = new Filter() { groupNames = testFilters, categoryNames = testCategories }; var buildTarget = SetFilterAndGetBuildTarget(testPlatform, filter); RerunCallbackData.instance.runFilters = new [] { new TestRunnerFilter() { categoryNames = filter.categoryNames, groupNames = filter.groupNames, testRepetitions = testRepetitions } }; RerunCallbackData.instance.testMode = filter.testMode; return(new Api.ExecutionSettings() { filters = new [] { filter }, overloadTestRunSettings = new RunSettings(testSettings), targetPlatform = buildTarget }); }
static bool ShouldRunTests() { var shouldRunTests = false; var optionSet = new CommandLineOptionSet( new CommandLineOption("runTests", () => { shouldRunTests = true; }), new CommandLineOption("runEditorTests", () => { shouldRunTests = true; }) ); optionSet.Parse(Environment.GetCommandLineArgs()); return(shouldRunTests); }
public CommandLineManagerImplementation(string[] commandLineArgs) { runFromCommandLine = false; coverageResultsPath = string.Empty; coverageHistoryPath = string.Empty; sourcePaths = string.Empty; generateAdditionalMetrics = false; generateHTMLReportHistory = false; generateHTMLReport = false; generateBadgeReport = false; useProjectSettings = false; assemblyFiltersSpecified = false; pathFiltersSpecified = false; pathStrippingSpecified = false; sourcePathsSpecified = false; assemblyFiltering = new AssemblyFiltering(); pathFiltering = new PathFiltering(); pathStripping = new PathStripping(); runTests = false; batchmode = false; burstDisabled = false; m_CoverageOptionsArg = string.Empty; m_CoverageOptions = new string[] { }; m_IncludeAssemblies = string.Empty; m_ExcludeAssemblies = string.Empty; m_IncludePaths = string.Empty; m_ExcludePaths = string.Empty; m_PathStrippingPatterns = string.Empty; CommandLineOptionSet optionSet = new CommandLineOptionSet( new CommandLineOption("enableCodeCoverage", () => { runFromCommandLine = true; }), new CommandLineOption("coverageResultsPath", filePathArg => { SetCoverageResultsPath(filePathArg); }), new CommandLineOption("coverageHistoryPath", filePathArg => { SetCoverageHistoryPath(filePathArg); }), new CommandLineOption("coverageOptions", optionsArg => { AddCoverageOptions(optionsArg); }), new CommandLineOption("runTests", () => { runTests = true; }), new CommandLineOption("batchmode", () => { batchmode = true; }), new CommandLineOption("burst-disable-compilation", () => { burstDisabled = true; }) ); optionSet.Parse(commandLineArgs); ValidateCoverageResultsPath(); ValidateCoverageHistoryPath(); if (runFromCommandLine) { ParseCoverageOptions(); } }
public ExecutionSettings BuildExecutionSettings(string[] commandLineArgs) { string resultFilePath = null; string deviceLogsDirectory = null; var optionSet = new CommandLineOptionSet( new CommandLineOption("editorTestsResultFile", filePath => { resultFilePath = filePath; }), new CommandLineOption("testResults", filePath => { resultFilePath = filePath; }), new CommandLineOption("deviceLogs", dirPath => { deviceLogsDirectory = dirPath; }) ); optionSet.Parse(commandLineArgs); return(new ExecutionSettings() { TestResultsFile = resultFilePath, DeviceLogsDirectory = deviceLogsDirectory }); }
public Api.ExecutionSettings BuildApiExecutionSettings(string[] commandLineArgs) { var quit = false; string testPlatform = TestMode.EditMode.ToString(); string[] testFilters = null; string[] testCategories = null; string testSettingsFilePath = null; int testRepetitions = 1; int? playerHeartbeatTimeout = null; bool runSynchronously = false; string[] testAssemblyNames = null; string buildPlayerPath = string.Empty; var optionSet = new CommandLineOptionSet( new CommandLineOption("quit", () => { quit = true; }), new CommandLineOption("testPlatform", platform => { testPlatform = platform; }), new CommandLineOption("editorTestsFilter", filters => { testFilters = filters; }), new CommandLineOption("testFilter", filters => { testFilters = filters; }), new CommandLineOption("editorTestsCategories", catagories => { testCategories = catagories; }), new CommandLineOption("testCategory", catagories => { testCategories = catagories; }), new CommandLineOption("testSettingsFile", settingsFilePath => { testSettingsFilePath = settingsFilePath; }), new CommandLineOption("testRepetitions", reps => { testRepetitions = int.Parse(reps); }), new CommandLineOption("playerHeartbeatTimeout", timeout => { playerHeartbeatTimeout = int.Parse(timeout); }), new CommandLineOption("runSynchronously", () => { runSynchronously = true; }), new CommandLineOption("assemblyNames", assemblyNames => { testAssemblyNames = assemblyNames; }), new CommandLineOption("buildPlayerPath", buildPath => { buildPlayerPath = buildPath; }) ); optionSet.Parse(commandLineArgs); DisplayQuitWarningIfQuitIsGiven(quit); CheckForScriptCompilationErrors(); LogParametersForRun(testPlatform, testFilters, testCategories, testSettingsFilePath); var testSettings = GetTestSettings(testSettingsFilePath); var filter = new Filter() { groupNames = testFilters, categoryNames = testCategories, assemblyNames = testAssemblyNames }; var buildTarget = SetFilterAndGetBuildTarget(testPlatform, filter); RerunCallbackData.instance.runFilters = new [] { new UITestRunnerFilter() { categoryNames = filter.categoryNames, groupNames = filter.groupNames, testRepetitions = testRepetitions } }; RerunCallbackData.instance.testMode = filter.testMode; var settings = new Api.ExecutionSettings() { filters = new [] { filter }, overloadTestRunSettings = new RunSettings(testSettings), targetPlatform = buildTarget, runSynchronously = runSynchronously, playerSavePath = buildPlayerPath }; if (playerHeartbeatTimeout != null) { settings.playerHeartbeatTimeout = playerHeartbeatTimeout.Value; } return(settings); }