/// <summary> /// creates a correct type of runner and runs a single test. /// </summary> /// <param name="testPath"></param> /// <param name="errorReason"></param> /// <returns></returns> private TestRunResults RunHPToolsTest(TestInfo testinf, ref string errorReason) { var testPath = testinf.TestPath; var type = Helper.GetTestType(testPath); IFileSysTestRunner runner = null; switch (type) { case TestType.ST: runner = new ApiTestRunner(this, _timeout - _stopwatch.Elapsed); break; case TestType.QTP: runner = new GuiTestRunner(this, _useUFTLicense, _timeout - _stopwatch.Elapsed, _mcConnection, _mobileInfoForAllGuiTests); break; case TestType.LoadRunner: AppDomain.CurrentDomain.AssemblyResolve += Helper.HPToolsAssemblyResolver; runner = new PerformanceTestRunner(this, _timeout, _pollingInterval, _perScenarioTimeOutMinutes, _ignoreErrorStrings); break; } if (runner != null) { if (!_colRunnersForCleanup.ContainsKey(type)) { _colRunnersForCleanup.Add(type, runner); } Stopwatch s = Stopwatch.StartNew(); TestRunResults results = null; results = runner.RunTest(testinf, ref errorReason, RunCancelled); results.Runtime = s.Elapsed; if (type == TestType.LoadRunner) { AppDomain.CurrentDomain.AssemblyResolve -= Helper.HPToolsAssemblyResolver; } return(results); } //check for abortion if (System.IO.File.Exists(_abortFilename)) { ConsoleWriter.WriteLine(Resources.GeneralStopAborted); //stop working Environment.Exit((int)Launcher.ExitCodeEnum.Aborted); } return(new TestRunResults { ErrorDesc = "Unknown TestType", TestState = TestState.Error }); }
public void Awake() { if (TestRunner == null) { TestRunner = Object.FindObjectOfType <PerformanceTestRunner>(); if (TestRunner == null) { GameObject gameObject = new GameObject("__TestRunner"); Object.DontDestroyOnLoad(gameObject); TestRunner = gameObject.AddComponent <PerformanceTestRunner>(); } } }
//Running performance tests... static void run <T>() where T : IPerformanceTest, new() { Thread.Sleep(100); if (typeof(T) == typeof(EmptyTest)) { Console.WriteLine(string.Empty); return; } var test = new T(); Console.Write(test.Iterations.ToString("e0") + " " + (typeof(T) + ": ").PadRight(60)); // For more reliable results, run before PerformanceTestRunner.Run(test); var ms = PerformanceTestRunner.Run(new T()); Console.WriteLine(ms + " ms"); }
//Running performance tests... //ContextCreateEntity: 30 ms //ContextDestroyEntity: 29 ms //ContextDestroyAllEntities: 25 ms //ContextGetGroup: 5 ms //ContextGetEntities: 2 ms //ContextHasEntity: 10 ms //ContextOnEntityReplaced: 6 ms //EntityAddComponent: 257 ms //EntityGetComponent: 44 ms //EntityGetComponents: 4 ms //EntityHasComponent: 2 ms //EntityRemoveAddComponent: 289 ms //EntityReplaceComponent: 20 ms //MatcherEquals: 171 ms //MatcherGetHashCode: 17 ms //ContextCreateBlueprint: 256 ms //NewInstanceT: 393 ms //NewInstanceActivator: 542 ms //EntityIndexGetEntity: 59 ms //IterateHashetToArray: 456 ms //IterateHashSet: 774 ms //ObjectGetProperty: 6 ms //CollectorIterateCollectedEntities: 957 ms //CollectorActivate: 1 ms //PropertiesCreate: 251 ms private static void Run <T>() where T : class, IPerformanceTest, new() { Thread.Sleep(100); if (typeof(T) == typeof(EmptyTest)) { Console.WriteLine(string.Empty); return; } SB.Append((typeof(T) + ": ").PadRight(40)); // For more reliable results, run before PerformanceTestRunner.Run(new T()); var ms = PerformanceTestRunner.Run(new T()); SB.Append(ms.ToString() + " ms"); SB.AppendLine(); }
//Running performance tests... static void run <T>() where T : IPerformanceTest, new() { Thread.Sleep(500); if (typeof(T) == typeof(EmptyTest)) { Console.WriteLine(string.Empty); return; } var test = new T(); Console.Write(test.Iterations.ToString("e0") + " " + (typeof(T) + ": ").PadRight(60)); // For more reliable results, run before PerformanceTestRunner.Run(test); Tuple <long, long> msAndMemory = PerformanceTestRunner.Run(new T()); Console.Write((msAndMemory.Item1 + " ms").PadRight(10)); Console.Write(("mem.DIFF " + msAndMemory.Item2 + " bytes").PadRight(30)); Console.WriteLine("mem.ALL " + MemoryHelper.GetMemoryAllStatsString(currentProcess) + " bytes"); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(OverlayNGPerfTest)); }
public static void Main(string[] args) { var runner = new PerformanceTestRunner(); runner.Run(new Program(), args); }
/// <summary> /// creates a correct type of runner and runs a single test. /// </summary> /// <param name="testPath"></param> /// <param name="errorReason"></param> /// <returns></returns> private TestRunResults RunHPToolsTest(TestInfo testinf, ref string errorReason) { var testPath = testinf.TestPath; var type = Helper.GetTestType(testPath); // if we have at least one environment for parallel runner, // then it must be enabled var isParallelRunnerEnabled = _parallelRunnerEnvironments.Count > 0; if (isParallelRunnerEnabled && type == TestType.QTP) { type = TestType.ParallelRunner; } // if the current test is an api test ignore the parallel runner flag // and just continue as usual else if (isParallelRunnerEnabled && type == TestType.ST) { ConsoleWriter.WriteLine("ParallelRunner does not support API tests, treating as normal test."); } IFileSysTestRunner runner = null; switch (type) { case TestType.ST: runner = new ApiTestRunner(this, _timeout - _stopwatch.Elapsed); break; case TestType.QTP: runner = new GuiTestRunner(this, _useUFTLicense, _timeout - _stopwatch.Elapsed, _uftRunMode, _mcConnection, _mobileInfoForAllGuiTests); break; case TestType.LoadRunner: AppDomain.CurrentDomain.AssemblyResolve += Helper.HPToolsAssemblyResolver; runner = new PerformanceTestRunner(this, _timeout, _pollingInterval, _perScenarioTimeOutMinutes, _ignoreErrorStrings, _displayController, _analysisTemplate, _summaryDataLogger, _scriptRTSSet); break; case TestType.ParallelRunner: runner = new ParallelTestRunner(this, _timeout - _stopwatch.Elapsed, _mcConnection, _mobileInfoForAllGuiTests, _parallelRunnerEnvironments); break; } if (runner != null) { if (!_colRunnersForCleanup.ContainsKey(type)) { _colRunnersForCleanup.Add(type, runner); } Stopwatch s = Stopwatch.StartNew(); var results = runner.RunTest(testinf, ref errorReason, RunCancelled); results.Runtime = s.Elapsed; if (type == TestType.LoadRunner) { AppDomain.CurrentDomain.AssemblyResolve -= Helper.HPToolsAssemblyResolver; } return(results); } //check for abortion if (System.IO.File.Exists(_abortFilename)) { ConsoleWriter.WriteLine(Resources.GeneralStopAborted); //stop working Environment.Exit((int)Launcher.ExitCodeEnum.Aborted); } return(new TestRunResults { ErrorDesc = "Unknown TestType", TestState = TestState.Error }); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(PreparedPolygonCoversPerfTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(PolygonizerPerfTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(InteriorPointAreaPerfTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(IntersectionPerfTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(DepthSegmentStressTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(EdgeRayPerformanceTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(DistanceGeomPairPerfTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(RelateMonotoneLinesPerfTest)); }
public override void TestInternal() { PerformanceTestRunner.Run(typeof(HPRtreePerfTest)); }