-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduced test discovery timeout (#90)
- Loading branch information
1 parent
905fb53
commit 41d7384
Showing
13 changed files
with
114 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
GoogleTestAdapter/Core.Tests/TestCases/TestCaseFactoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using FluentAssertions; | ||
using GoogleTestAdapter.Model; | ||
using GoogleTestAdapter.Tests.Common; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Moq; | ||
using static GoogleTestAdapter.Tests.Common.TestMetadata.TestCategories; | ||
|
||
namespace GoogleTestAdapter.TestCases | ||
{ | ||
|
||
[TestClass] | ||
public class TestCaseFactoryTests : TestsBase | ||
{ | ||
|
||
[TestMethod] | ||
[TestCategory(Unit)] | ||
public void CreateTestCases_DiscoveryTimeoutIsExceeded_DiscoveryIsCanceledAndCancelationIsLogged() | ||
{ | ||
MockOptions.Setup(o => o.TestDiscoveryTimeoutInSeconds).Returns(1); | ||
MockOptions.Setup(o => o.ParseSymbolInformation).Returns(false); | ||
|
||
var reportedTestCases = new List<TestCase>(); | ||
var stopWatch = Stopwatch.StartNew(); | ||
var factory = new TestCaseFactory(TestResources.TenSecondsWaiter, MockLogger.Object, TestEnvironment.Options, null); | ||
var returnedTestCases = factory.CreateTestCases(testCase => reportedTestCases.Add(testCase)); | ||
stopWatch.Stop(); | ||
|
||
reportedTestCases.Should().BeEmpty(); | ||
returnedTestCases.Should().BeEmpty(); | ||
stopWatch.Elapsed.Should().BeGreaterOrEqualTo(TimeSpan.FromSeconds(1)); | ||
stopWatch.Elapsed.Should().BeLessThan(TimeSpan.FromSeconds(2)); | ||
MockLogger.Verify(o => o.LogError(It.Is<string>(s => s.Contains(TestResources.TenSecondsWaiter))), Times.Once); | ||
MockLogger.Verify(o => o.DebugError(It.Is<string>(s => s.Contains(Path.GetFileName(TestResources.TenSecondsWaiter)))), Times.Once); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+5 KB
GoogleTestAdapter/Tests.Common/Resources/TestData/misc/TenSecondsWaiter.exe
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters