GetWeightedDuration() public static method

public static GetWeightedDuration ( double duration ) : int
duration double
return int
コード例 #1
0
        public void GetTestsFromExecutable_LoadTests_AreFoundInReasonableTime()
        {
            var stopwatch              = Stopwatch.StartNew();
            var discoverer             = new GoogleTestDiscoverer(TestEnvironment);
            IList <TestCase> testCases = discoverer.GetTestsFromExecutable(TestResources.LoadTests);

            stopwatch.Stop();
            var actualDuration = stopwatch.Elapsed;

            int testParsingDurationInMs = CiSupport.GetWeightedDuration(0.5 * testCases.Count); // .5ms per test (discovery and processing)
            int overheadInMs            = CiSupport.GetWeightedDuration(1000);                  // pretty much arbitrary - let's see...
            var maxDuration             = TimeSpan.FromMilliseconds(testParsingDurationInMs + overheadInMs);

            actualDuration.Should().BeLessThan(maxDuration);
        }
コード例 #2
0
        public void GetTestsFromExecutable_OldExecutionEnvironment_LoadTests_AreFoundInReasonableTime()
        {
            MockOptions.Setup(o => o.UseNewTestExecutionFramework).Returns(false);

            var stopwatch              = Stopwatch.StartNew();
            var discoverer             = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options);
            IList <TestCase> testCases = discoverer.GetTestsFromExecutable(TestResources.LoadTests_Generated);

            stopwatch.Stop();
            var actualDuration = stopwatch.Elapsed;

            testCases.Count.Should().BeGreaterThan(0);
            int testParsingDurationInMs = CiSupport.GetWeightedDuration(testCases.Count); // .5ms per test (discovery and processing)
            int overheadInMs            = CiSupport.GetWeightedDuration(1000);            // pretty much arbitrary - let's see...
            var maxDuration             = TimeSpan.FromMilliseconds(testParsingDurationInMs + overheadInMs);

            actualDuration.Should().BeLessThan(maxDuration);
        }
コード例 #3
0
        public void GetTestsFromExecutable_LoadTests_AreFoundInReasonableTime()
        {
            if (CiSupport.IsRunningOnBuildServer)
            {
                Assert.Inconclusive("Skipping test since it is unstable on the build server");
            }

            var stopwatch              = Stopwatch.StartNew();
            var discoverer             = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options);
            IList <TestCase> testCases = discoverer.GetTestsFromExecutable(TestResources.LoadTests_Generated);

            stopwatch.Stop();
            var actualDuration = stopwatch.Elapsed;

            testCases.Count.Should().BePositive();
            int testParsingDurationInMs = CiSupport.GetWeightedDuration(testCases.Count); // .5ms per test (discovery and processing)
            int overheadInMs            = CiSupport.GetWeightedDuration(1000);            // pretty much arbitrary - let's see...
            var maxDuration             = TimeSpan.FromMilliseconds(testParsingDurationInMs + overheadInMs);

            actualDuration.Should().BeLessThan(maxDuration);
        }