Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get tests working in Visual Studio #11

Closed
dougbu opened this issue Aug 8, 2016 · 2 comments
Closed

Get tests working in Visual Studio #11

dougbu opened this issue Aug 8, 2016 · 2 comments
Assignees

Comments

@dougbu
Copy link
Member

dougbu commented Aug 8, 2016

Since the last time we did anything w/ this code, xUnit has removed the Visual Studio extension and moved to a new NuGet package for the same purpose (xunit.runner.visualstudio). Get the code using this new approach.

Also move from xUnit 1.9.1 to the current stable version (2.1.0). This likely involves removing references to the deprecated xunit.extensions package.

@dougbu
Copy link
Member Author

dougbu commented Aug 8, 2016

Selflessly assigning this to myself

@Eilon Eilon added this to the 5.2.4 milestone Aug 9, 2016
dougbu added a commit that referenced this issue Aug 24, 2016
- #11 (1 of 4 or so)
- remove almost all mention of `.Result`, `.Wait()`, ... in test code
- rename (mostly newly-) `Task`-returning helpers `...Async`
- remove newly-unused `Microsoft.TestCommon.TaskExtensions`
- remove status checks of `Task`s that have been `await`ed
- remove some (not all) `Assert.NotNull(task)` checks
- start Task`s that `RazorParser.CreateParseTask()` returns (see #22)
- fix `async void` tests

Add Moq `Setup()`s for new NREs
- appears the `Task.WaitUntilCompleted()` extension method didn't execute all inner tasks
 - more importantly, `null` inner tasks were ignored

nit: `Assert.Equal(null, xyz)` -> `Assert.Null(xyz)`
dougbu added a commit that referenced this issue Aug 25, 2016
- #11 (2 of 4 or so)
- let NuGet make its changes to `*.csproj` files
- add NuGet-provided `app.config` file to Formatting.NetCore and SignalR test projects
dougbu added a commit that referenced this issue Aug 25, 2016
dougbu added a commit that referenced this issue Aug 26, 2016
- #11 (2 of 4)
- let NuGet make its changes to `*.csproj` files
- add NuGet-provided `app.config` file to Formatting.NetCore and SignalR test projects

Work around type load failures unique to running xUnit tests in VS
- get `TracingTest` working in Visual Studio

Remove duplicate test data
- led to warnings when discovering tests in VS
dougbu added a commit that referenced this issue Aug 26, 2016
- #11 (3 of 4)
- work around devlooped/moq#129 and devlooped/moq#212; Moq creates proxies for all `interface` methods
 - e.g. set up `IDisposable.Dispose()` calls
 - related bug devlooped/moq#212 means we can't use `MockBehavior.Strict` in some cases
  - especially when method returns a value and therefore can't be set up to call base
  - `CallBase = true` is often required in these cases
- work around devlooped/moq#149; `DefaultValue.Mock` restrictions
 - where necessary, explicitly set members up instead
- work around odd failures in `JsonResultTest` using `SetupSet()` on deep properties
 - use `MockBehavior.Strict` in `NullContentIsNotOutput()` to confirm `Write()` is not called
- handle less-predictable proxy type names
dougbu added a commit that referenced this issue Aug 26, 2016
- #11 (4 of 4 or so)
- newer version of `xunit.abstractions` exists (2.0.1) but it
  "is not compatible with 'xunit.extensibility.core 2.1.0 constraint: xunit.abstractions (= 2.0.0)'"
- add xunit.runner.msbuild package to central packages.config
 - need this package to execute tests after upgrade to xUnit.net 2.1.0
 - need recent Beta to pick up PR xunit/xunit#807; MSBuild crashes otherwise
 - for this part, do not make *.csproj changes that NuGet attempts; update our `WebStack.xunit.targets` instead
- use latest `xunit.exe` because Beta xunit.runner.msbuild package needs at least 2.12
 - old 2.7 minimum version, 2.8 that is at https://nuget.org/nuget.exe, and 2.12 are also all old
dougbu added a commit that referenced this issue Aug 29, 2016
- #11 (4 of 4)
- newer version of `xunit.abstractions` exists (2.0.1) but it
  "is not compatible with 'xunit.extensibility.core 2.1.0 constraint: xunit.abstractions (= 2.0.0)'"
- add xunit.runner.msbuild package to central packages.config
 - need this package to execute tests after upgrade to xUnit.net 2.1.0
 - need recent Beta to pick up PR xunit/xunit#807; MSBuild crashes otherwise
 - for this part, do not make *.csproj changes that NuGet attempts; update our `WebStack.xunit.targets` instead
- use latest `xunit.exe` because Beta xunit.runner.msbuild package needs at least 2.12
 - old 2.7 minimum version, 2.8 that is at https://nuget.org/nuget.exe, and 2.12 are also all old

Update TestCommon to match latest xUnit.net APIs
- continue to expose required xUnit.net classes in `Microsoft.TestCommon` namespace
 - adjust to `sealed` classes, namespace moves, et cetera
- do not use removed `Assert.ThrowsDelegate` and `Assert.ThrowsDelegateWithReturn` types
 - can't use these types with underlying `Assert` using `Action` and `Func<object>`
- remove `StringAssertions` since those assertions are now in xUnit.net

nits
- remove `Console.WriteLine()` from a test
- use new `Assert.Matches()` in tests checking exception messages that contain a Moq proxy type name
dougbu added a commit that referenced this issue Aug 29, 2016
- related to #11 (1 of 4 additions)
- do not use `GlobalFacebookConfiguration`
- group tests that read / write `static`s (`ScopeStorage` and `ViewEngines`) together
 - one `[Xunit.Collection]` for all readers and writers
  - won't run in parallel, avoiding reads while writers have messed up the state
 - `IDisposable` for all test classes that don't already reliably clean up their writes
- enable the subset of above tests that were disabled due to previous use of `static`s
dougbu added a commit that referenced this issue Aug 29, 2016
- related to #11 (2 of 4 additions)
- tests sometimes hang with loads of threads stuck in `BackgroundParser.MainThreadState.GetParcel()`
dougbu added a commit that referenced this issue Aug 29, 2016
- related to #11 (3 of 4 additions)
- reduce work done within inner loop
- add messages for `Exception`s this class `throw`s
- release acquired `Mutex`es
- reduce timeout for acquiring global `Mutex`
dougbu added a commit that referenced this issue Aug 29, 2016
- related to #11 (4 of 4 additions)
- need xUnit.net AppDomain support in console runs but not in VS runs
 - setting in `WebStack.xunit.targets` overrides `xunit.runner.json` default
 - somewhat avoids issues such as xunit/xunit#353 and xunit/xunit#947
- pre-enumerating `[Theory]`s also slows down test discovery and execution
 - remains a good idea to leave the test execution engine running
@dougbu
Copy link
Member Author

dougbu commented Aug 29, 2016

  1. 31bfa83; await all the things
  2. 27f29d5; Add xunit.runner.visualstudio dependency
  3. 7d6d8c2; Update test projects to latest stable Castle.Core and Moq packages
  4. 2d8f677; Update test projects to latest stable xUnit.net packages and nuget.exe

Additions:

  • 29a8fee; Cleanup use of static state
  • 2e98bc0; Don't leak ManualResetEventSlims or Threads waiting on them
  • 0c3cbd2; Address frequent PortReserver failures
  • 890f4df; Improve speed of VS test runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants