Giter Club home page Giter Club logo

resharper-xunit's Introduction

xUnit.net for ReSharper

This plugin for ReSharper adds support for xUnit.net tests. It supports the following:

  • xUnit.net 1.x and 2.0
  • Discovery and execution of [Fact] and [Theory] based tests from source code, or compiled assemblies (e.g. F# projects can run tests, although tests aren't found in the source editor)
  • External annotations to provide hints to ReSharper that test methods are being implicitly used, and that assert methods check for null, etc.
  • Live Templates to easily create asserts, test methods, etc.
  • Support for ReSharper 8.2 and 9.1. ReSharper 9.0 support is still available from the Extension Manager, but is no longer being maintained. Please upgrade to 9.1

Previously hosted on CodePlex as the xunitcontrib project.

Installing

The plugin can be installed from ReSharper's Extension Manager.

xUnit.net 2.0 support and known issues

Both xUnit.net 1.x and 2.0 are fully supported when running tests, however, the 2.0 support has the following limitations in the editor:

  • Test discovery is still based on 1.x. That means it will only find tests that are marked with [Fact] or other attributes that derive from FactAttribute (this includes [Theory]). Custom test discovery is not yet supported.
  • The Live Templates are still based on 1.x. The biggest problem here is that [Theory] is in the wrong namespace.
  • There is no code completion for [MemberData] has not yet been implemented. xUnit.net 1.x's [PropertyData] is still supported.

See Pull Request #1 for progress on full support.

Building and contributing

See contributing.md for more details.

License

This project is licensed as Apache 2.0. It was relicensed from Ms-PL on 02/05/2014. Previously licensed code is still available at commit b7aa82ad014b089da931a6ab5eb3017a43b5846d and earlier, and with the previous project page on CodePlex.

resharper-xunit's People

Contributors

citizenmatt avatar controlflow avatar eddiegarmon avatar remogloor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

resharper-xunit's Issues

xUnit runner persistently does not work

Across clean installs (OS - Win 8.1 and Visual Studio 2013 - various updates up to and including update 4) and multiple machines, I've found the xunit runner to be extremely unreliable. Sometimes it works. Sometimes the chevrons next to each test don't show up. Sometimes they show up, but clicking debug or release does nothing. Sometimes clicking on debug/release looks like it's attempting to do something, but then does nothing. Sometimes, right-clicking on a test class and running all tests works, sometimes it doesn't. I cannot isolate the factors that contribute to whether it will fully work or not. Right now I have Resharper 8.2.3000.5176 installed.

Other developers on my team have had the same experience. We don't have any company-mandated config, these are all independent machines running individual copies of VS, etc.

So I guess this is a bug, but moreso it's a plea for help. What can I do to make the resharper x-unit runner stable and reliable? Right now I'm forced to use the built-in VS test runner which totally sucks in comparison to the re-sharper plug-in (when it works). I'm happy to provide any additional info.

Problem analyser for collection and class fixtures

Ensure ICollectionFixture and IClassFixture are used on the right classes, and that they have constructor parameters that match the types. Ensure that no extra constructor parameters are defined. Allow create from usage?

Cannot find in resharper extension gallery

I was trying to set up our intern's computer today, and we couldn't find this in Resharper's extension manager. Indeed, going back to my machine (where I have it installed), I cannot find it in my extension manager there either. (We did make sure to include prerelease).
We have Resharper 8.2.
As far as I can tell from browsing your various pages, this isn't something you've announced as intentional. Did some glitch get it kicked out of the extension manager?

Ambiguous method name manual test failing as aborted?

Run the tests in the AmbiguousMethodNames class in the manual tests solution, and it gets displayed as "aborted", although the tests correctly get reported. Only one of the tests methods with ambiguous names (i.e. MethodsWithOverridesCannotBeUniquelyFoundByName) is displayed.

Annotations not working when using xunit.assert.source?

We use a couple of custom Assert methods and follow xunit's recommendation of using the xunit.assert.source NuGet package to get the assert source.

The external ReSharper annotations do not seem to work for our Assert methods (like [NotNull] on Assert.NotNull()).

Is it possible to make the annotations work with Asserts in source form? The namespace is still Xunit, if that has anything to do with it.

Not available in Resharper 8.2

I've just upgraded computers and installed Resharper 8.2.0.2160.

If I go to Resharper's Extension Manager RESHARPER -> Manage Extensions, and search for Xunit.net, I cannot find the plugin. xUnit.net Test Support cannot be found in the online extensions.

Thoughts?

VS2015 / Resharper 9.1 EAP02 support

I need the EAP to run MSTest tests, but also have projects using xunit.

Simply expanding the Wave version on the nuspec allowed me to install the plugin. The icons show up on a test but running a test just spins.

I have some time to get this working, before I dig in, does 9.1 support require a new version of the SDK, and is there an EAP of the SDK available?

Viewing Console.Out, Console.Error and Debug.WriteLine

With NUnit tests, output written to Console.Out, Console.Error or Debug.Write* appears in the detail area when the test is selected.

I cannot seem to get any test output to appear in the same panel via the xunit test runner.

Am I doing it wrong?

xUnit Test Support 2.0.5
VS2013 Community 12.0.31101.00 Update 4
ReSharper 9.0 Update 1

Custom trait not being picked up

When implementing a custom ITraitAttribute and ITraitDiscoverer I can see that the discoverer is being executed for the correct attribute, but you can't filter on that trait as it's not listed under Group by.

Tests won't run using latest xUnit 2.0.0-rc1-build2826

Just says "Inconclusive: Test not run". Looks like there was some breaking change in the RC that requires latest runner. Thanks.

VS 2013 Update 4
ReSharper 9.0 Update 1 Build 9.0.20141219.130142
xUnit 2.0.0-rc1-build2826

When debugging a single test MemberData is generated for tests that are not being run

using Xunit;
using System.Threading;

namespace XUnitTestRunnerBug
{
public class Class1
{

    [Theory, MemberData("GetSomeData")]
    public void Test(string somedata) {}

    public static string GetSomeData()
    {
       Thread.Sleep(Timeout.Infinite);
        return "Test";
    }

    [Fact]
    public void Test2()
    {
        Assert.True(true);
    }
}

}

Using the test runner if you debug or run Test2. GetSomeData is executed, I would not expect it to be run as the test it is required for is not being run.
This is an issue for me because I have a number of tests were the data generation takes a long time and I don't want to run it for tests that I am not actively debugging.

Aborted tests

We have a project with about a thousand tests (many of them are data-driven tests). We recently updated to v2.0.5. When we now run all tests of this project, the run mostly aborts and the remaining tests are marked as being inconclusive. The number of executed tests until the abort happens varies. Did you ever experience this or do you have an idea what could cause this? When using the xUnit command line runner it works as expected. Some of the tests take quite a long time (up to five minutes), so could it be a timeout?

Issue when using Exude

https://github.com/GreanTech/Exude is an extension for xunit that allows to write unit tests as methods returning IEnumerables of test cases.
I can define test cases in F# like this:

[<FirstClassTests>]
let testCases () = seq {
                      yield TestCase(fun () -> Assert.Equal (1, 1))
                      yield TestCase(fun () -> Assert.Equal (1, 2))
                      yield TestCase(fun () -> Assert.Equal (1, 3))
                    } 

R#'s runner picks it up fine and runs all 3. However, the results are returned like this:
Runner As you can see, the problem is the fact that the entire method with 3 test cases is represented as one node. It would be nice if I could see separate nodes for each test case, as if each was a standard [Fact].

Xunit's console runner does indeed show these as 3 separate tests, but they seem to have the same name (testCases) -- could that be the reason why they are grouped under one node in R#?

Code completion on type parameter of attributes

Add reference provider (code completion, ctrl-click navigation, find usages, rename, etc) to the type parameters of:

  • CollectionBehaviorAttribute
  • DataDiscovererAttribute
  • TestCaseDiscovererAttribute
  • TestCaseOrdererAttribute
  • TestFrameworkAttribute
  • TraitDiscovererAttribute

Need to enable MaxDegreeOfParallelism

Currently there is no way to run tests without multi-threading or to limit the number of concurrent threads. Given that xunit 2.0 runs all tests in parallel this breaks some tests that execute not-thread safe code.

Tests stay in running state when assertions are not met, instead of just failing

image

Sometimes, when a tests fails (example: nhibernate schema validation, automapper assertconfiguration valid, but also business logic tests (are all properties saved to the db, for example), the test runner ends up in a state where it says that the test is still running, and it never gets out of this state anymore (see screenshot). No other tests below these tests in the unit test sessions tree are being executed.

When debugging, you can actually see the assertion failures, and when you then continue the debug session, it ends up in this forever running state as well.

Before, I was using R#8, nothing was wrong. Another dev on my team with R#8 had the issue already. Now we have both upgraded to R#9, and are both facing the issue. 2 other developers on the team don't face the issue, and our CI server (TeamCity) isn't showing this issue either.

My configuration:

  • Visual Studio Professional 2013, version 12.0.31101.00 Update-4
  • Resharper 9.0 Update 1 (Build 9.0.2014129.130142)
  • XUnit.net Test Support for ReSharper 9 2.0.1

Any clue what might be causing this?

Incorrect displaying russian test descriptions

My test is marked as [Fact(DisplayName = "Русский")]
The version for R# v8 displays its display name correct, but the current one displays it as
\x0420\x0443\0x441\0x43A\0x438\0x439

Running an Async Task test elides the Test Method from the stack frame

I'm using an assertion framework (Approvals.Net) that crawls the stack trace to find the name of the current test method. With version 2.0.5 of the runner, the stack trace when I call Approvals.Verify from an async Task test doesn't include the actual test method, so Approvals.Net crashes.

Inconclusive: Test not run

I'm using:

  • Visual Studio 2013 Professional Update 4
  • xUnit.net Test Support for ReSharper 9 (2.0.2)
  • JetBrains ReSharper 9.0 Update 1 Build 9.0.20141219.130142
  • xunit 2.0.0-rc2-build2857
  • xunit.abstractions 2.0.0-rc2-build2857
  • xunit.assert 2.0.0-rc2-build2857
  • xunit.core 2.0.0-rc2-build2857
  • xunit.extensibility.core 2.0.0-rc2-build2857

I can't run any of my unit tests ([Fact] or [Theory]), all the tests are marked as inconclusive.

This is the error message I get:

Unable to run xUnit.net tests - Constructor on type 'Xunit.Sdk.TestFrameworkProxy' not found.

unit-test-runner

Debugging one test runs all the tests inside the class

I have a class with three [Fact] tests inside it. They all use a common function that was throwing an exception (from another namespace, if that matters). It doesn't matter which one I debug (either via C-u C-d or select the test and click the debug), but it runs all three of them one after the other. It also runs in a consistent order, so I had to fix them in an suboptimal order. :)

I double-checked that "update" didn't list any new features. Below is the detail from the Resharper about menu. I'm using Visual Studio Ultimate (detail is below ReSharper).

JetBrains ReSharper Platform 6 Build 6.0.20141219.120158 on 2014-12-19 12:56:02Z
JetBrains ReSharper 9.0 Update 1 Build 9.0.20141219.130142 on 2014-12-19 13:12:31Z

Application Packages:
CitizenMatt Xunit build 2.0.6-alpha-20150318 on 2015-03-28 18:35:10Z.
Humanizer Annotations build 2.0.0 on 2015-03-28 18:35:10Z.
JetBrains Fake VisualStudio VsPackageAssembly build 12.0.0.0 on 2015-03-28 18:35:17Z.
JetBrains Platform Core Ide build 6.0.20141219.120158 on 2014-12-19 12:56:02Z.
JetBrains Platform Core Shell build 6.0.20141219.120162 on 2014-12-19 12:53:09Z.
JetBrains Platform Core Text build 6.0.20141219.120158 on 2014-12-19 12:56:02Z.
JetBrains Platform Installer build 6.0.20141219.120158 on 2014-12-19 12:56:02Z.
JetBrains Platform Symbols build 6.0.20141219.120158 on 2014-12-19 12:56:02Z.
JetBrains Platform VisualStudio build 6.0.20141219.120158 on 2014-12-19 12:56:02Z.
JetBrains Psi.Features ExternalAnnotations build 9.0.20141219.130140 on 2014-12-19 13:00:40Z.
JetBrains Psi.Features SolutionBuilder build 9.0.20141219.130140 on 2014-12-19 13:00:40Z.
JetBrains Psi.Features src build 9.0.20141219.130140 on 2014-12-19 13:00:40Z.
JetBrains Psi.Features Tasks build 6.0.20141219.130140 on 2014-12-19 13:00:40Z.
JetBrains Psi.Features VisualStudio build 9.0.20141219.130140 on 2014-12-19 13:00:40Z.
JetBrains ReSharper src build 9.0.20141219.130142 on 2014-12-19 13:12:31Z.

ReSharper 9.0.0.0 Licensed to Ryan, Inc
Visual Studio 12.0.31101.0.

Copyright © 2015 JetBrains. All rights reserved.

And Visual Studio's:

Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0451022-02028
Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0451022-02028
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06181-004-0451022-02028
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0451022-02028
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0451022-02028
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0451022-02028
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0451022-02028
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0451022-02028
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

ASP.NET and Web Tools   12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.3
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JetBrains ReSharper Platform 6   Build 6.0.20141219.120158 on 2014-12-19 12:56:02Z
JetBrains ReSharper Platform package for Microsoft Visual Studio. For more information about ReSharper Platform, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50926.663
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Release Management for Visual Studio Package   1.0
Release Management for Visual Studio

SQL Server Data Tools   12.0.41012.0
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Git Extensions
Git Extensions is a graphical interface for Git
For more information about Git Extensions, see the Git Extensions website at
http://sourceforge.net/projects/gitextensions/
Copyright © 2008-2014 Henk Westhuis

Tests don't seem to run when the project is hosted on a network share

Using Visual Studio 2013 Community, Resharper 8.2.3. One Class library project. It has the nuget references for xunit, xunit VS runner. The xunit extension for R# is also installed.

When opening the project from a network drive,

  • The VS test explorer simply doesn't detect the tests
  • Resharper shows the icons next to the test. Running the test seems to do something. Not sure what, but the test runner UI shows that its processing and it remains that way till manually stop the test execution. Bottomline, the test doesn't run, no pass/fail message.
  • After failing to execute the tests, I uninstalled the xunit VS runner and installed xunit console runner. I am able to execute the tests properly from the console.

When opening the project from a local c: drive (after copying the files over)

  • Both test runners (VS & R#) run the tests properly and immediately. I uninstalled the console runner from the previous run and reinstalled the VS runner.

Any ideas on how to make this scenario work with the R# runner? I am on a Macbook (Mavericks), running Windows 8.1 using Parallels. I prefer the files being accessible from OSX and not isolated to the windows drive inside Parallels.

Tests with the same name are omitted

When there are tests with the same name but they are placed in different test classes only one test with a given name will run when we try to run all tests in the project or solution. The rest of them will be skipped (marked with a blue question mark).
It is still possible to run tests in each class be explicitly running them in their classes.

Environment: VS2013 Update 4, R# 9.0 Update 1, latest version of resharper-xunit for that env.

Update external annotations to xunit2

The external annotations file gives more context to ReSharper's analysis, such as marking methods as "assertion methods", that is, marking the method as throwing an exception given a certain value, e.g. null or not-null. These are missing for xunit.assert.dll.

See the ExternalAnnotations folder.

Cannot run tests after upgrading to xUnit to 0.99.7

After upgrading to xUnit to 0.99.7 (from 0.99.6) I can no longer run tests from VS due to:

[Window Title]
Unit Test Runner

[Main Instruction]
Unit Test Runner failed to run tests

[Content]
System.Runtime.Remoting.RemotingException: The method 'get_Class' was not found on the interface/type 'Xunit.Abstractions.ITestCase, xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'.

[V]

[Buttons]
[Header=_OK, Content=]

[Expanded Information]

Server stack trace:
at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall..ctor(SmuggledMethodCallMessage smuggledMsg, ArrayList deserializedArgs)
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Xunit.Abstractions.ITestCase.get_Class()
at XunitContrib.Runner.ReSharper.RemoteRunner.TestRunner.<>c__DisplayClass1.b__0(ITestCase c)
at System.Linq.Enumerable.WhereListIterator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at XunitContrib.Runner.ReSharper.RemoteRunner.XunitTestRun.RunTests(IEnumerable`1 testCases)
at XunitContrib.Runner.ReSharper.RemoteRunner.TestRunner.Run(XunitTestAssemblyTask assemblyTask, TaskProvider taskProvider)

xunit2 - Support escaped strings in DataAttributes

        [InlineData( "escape mania: $ \\ \b \f \n \r \t \v", "unicode mania: \x78\xF2\x12C" )]

The 'escape mania' string above currently aborts the runner. I have not tested to the extent Unicode escapes are supported.

Test discovery is unreliable in 2.0.0

With xUnit 1.9.1 and the latest R# and resharper-xunit, "Run all tests" only discovers a part of my test suite. Some folders don't show up at all, and trying to "run all" in those folders results in "no tests found". However, the tests can be run from the left gutter commands when the individual files are open.

All tests aborted immediately

Using the latest version all tests abort immediately. The last working version for us is 2.0.0-alpha-20140812.

We are running:
VS 2013 Version 12.0.31101.00 Update
ReSharper 8.2.3 Full Edition Build 8.2.3000.5176 on 2014-10-09T20:08:24
Windows 7 Professional SP1

Can't run one test only in one class

Hi,
After I updated the extension to 2.0.6-alpha, I am not able to run a test separately in a class. Whenever, I run or debug, it runs all the tests.

Problem analyser for InlineDataAttribute

Add a problem analyser to ensure that the parameters of InlineDataAttribute match the parameters on the method. Can it also provide code completion? Update usage, such as using ReSharper to delete the parameter?

Does the current v1.x version support async void - style tests?

Question: Does the current v1.x version support async void - style tests? I understand that xUnit itself supports them (as of this commit), but the behavior I'm seeing in VS 2013 seems not to support it. Mainly, async void test methods always pass and coverage tools (e.g. NCrunch) show the code after the initial await go uncovered.

I have v1.6.2.19405 of the R#er plugin installed.

My apologies if I'm overlooking something obvious here or barking up the wrong tree.

Failing test never completes

I have a strange issue after updating to "xUnit.net Test Support 2.1.6"

I use Visual Studio, ReSharper 8.2.3, xUnit 1.9.2 and FluentAssertions 3.3.0.

The following test never completes:

[Fact]
public void Failing_Test_Never_Completes()
{
    var oneList = new List<MyDto>
    {
        new MyDto
        {
            Id = 42,
        }
    };
    var secondList = new List<MyDto>
    {
        new MyDto
        {
            Id = 44,
        },
    };

    oneList.ShouldAllBeEquivalentTo(secondList);
}

When I debug the test, it appears a TargetInvocationException is thrown from xUnit, which I tracked down to IndexOutOfRangeException in the following stack trace:

at XunitContrib.Runner.ReSharper.RemoteRunner.AbstractionExtensions.ConvertExceptions(IFailureInformation failure, String& simplifiedMessage)
at XunitContrib.Runner.ReSharper.RemoteRunner.TestExecutionVisitor.Visit(ITestFailed testFailed)
at Xunit.TestMessageVisitor.DoVisit[TMessage](IMessageSinkMessage message, Func`2 callback)
at Xunit.TestMessageVisitor.OnMessage(IMessageSinkMessage message)
at Xunit.TestMessageVisitor`1.OnMessage(IMessageSinkMessage message)
at XunitContrib.Runner.ReSharper.RemoteRunner.TestExecutionVisitor.OnMessage(IMessageSinkMessage message)
at Xunit.TestClassCallbackHandler.OnTest(XmlNode xml)
at Xunit.TestClassCallbackHandler.OnXmlNode(XmlNode xml)
at Xunit.XmlNodeCallbackHandler.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

In the call stack, I found a variable with the following XML, thought it might be relevant.

<test name="ConsoleApplication7.MyTest.Failing_Test_Never_Completes" type="ConsoleApplication7.MyTest" method="Failing_Test_Never_Completes" result="Fail" time="0.698"><failure exception-type="Xunit.Sdk.AssertException"><message>Expected item[0].Id to be 44, but found 42.

With configuration:
- Use declared types and members
- Compare enums by value
- Match member by name (or throw)
- Be strict about the order of items in byte arrays
</message><stack-trace>   ved FluentAssertions.Execution.LateBoundTestFramework.Throw(String message) i z:\Builds\work\b7ceef20fdfcf0ee\Shared\Execution\LateBoundTestFramework.cs:linje 30
   ved FluentAssertions.Execution.TestFrameworkProvider.Throw(String message) i z:\Builds\work\b7ceef20fdfcf0ee\FluentAssertions.Net40\Execution\TestFrameworkProvider.cs:linje 42
   ved FluentAssertions.Execution.CollectingAssertionStrategy.ThrowIfAny(IDictionary`2 context) i z:\Builds\work\b7ceef20fdfcf0ee\FluentAssertions.Core\Execution\CollectingAssertionStrategy.cs:linje 50
   ved FluentAssertions.Execution.AssertionScope.Dispose() i z:\Builds\work\b7ceef20fdfcf0ee\FluentAssertions.Core\Execution\AssertionScope.cs:linje 252
   ved FluentAssertions.Equivalency.EquivalencyValidator.AssertEquality(EquivalencyValidationContext context) i z:\Builds\work\b7ceef20fdfcf0ee\FluentAssertions.Core\Equivalency\EquivalencyValidator.cs:linje 36
   ved FluentAssertions.AssertionExtensions.ShouldBeEquivalentTo[T](T subject, Object expectation, Func`2 config, String because, Object[] reasonArgs) i z:\Builds\work\b7ceef20fdfcf0ee\Shared\AssertionExtensions.cs:linje 542
   ved FluentAssertions.AssertionExtensions.ShouldBeEquivalentTo[T](T subject, Object expectation, String because, Object[] reasonArgs) i z:\Builds\work\b7ceef20fdfcf0ee\Shared\AssertionExtensions.cs:linje 503
   ved FluentAssertions.AssertionExtensions.ShouldAllBeEquivalentTo[T](IEnumerable`1 subject, IEnumerable expectation, String because, Object[] reasonArgs) i z:\Builds\work\b7ceef20fdfcf0ee\Shared\AssertionExtensions.cs:linje 567
   ved ConsoleApplication7.MyTest.Failing_Test_Never_Completes() i c:\Users\mbp\Documents\Visual Studio 2013\Projects\ConsoleApplication7\ConsoleApplication7\Program.cs:linje 34</stack-trace></failure></test>

Test runner doesn't show structure with nested test classes

Hi,

I'm trying to use a unit testing setup structure close to what Phil Haack described here:

http://haacked.com/archive/2012/01/02/structuring-unit-tests.aspx/

However, when I use nested classes for structuring tests, the ReSharper 9 test runner does not show the complete test structure. I do not know if this is an issue with the ReSharper test runner itself, or the xUnit specific extension.

Here is an exaggerated example to show my point:

image

When I run the unit tests with the option set to group by project structure, it looks like this:

image

If I try to group by Projects and Namespaces, it looks like this:

image

So it seems like we only see the actual class that contains a test - any parent classes that itself does not hold one or more unit tests are not visible as part of the hierarchy.

Is this by design, or should I actually be able to see the exaggerated structure in this case?

Edit: I should mention - one of the problems with this is that it gets hard to tell tests for different classes apart when doing this. In the example above, if I had another class with tests in a GivenNullInput subclass, they would be kept apart, but visible at the same level with no indication of what they belong to.

Support asp.net vNext

ReSharper doesn't currently support running tests for asp.net vnext, as it's a new execution environment, and requires a new hosting executable to run the tests via dnx (nee klr), and communicate back to the VS process. This introduces a few moving parts:

  • The ReSharper test runner needs to start up the dnx environment, and load a hosting dll
  • The hosting dll needs to create a communication channel back to ReSharper, in order to report progress. This is likely to be the same as the communication channel used by ReSharper's current external hosting processes (xml over sockets)
  • The hosting dll then needs to load a ReSharper/xunit runner, that can glue xunit and ReSharper together (this is conceptually the same as the current runner dll)
  • The xunit runner then has to load the asp.net version of xunit and run the tests, capturing the results, so they can be passed back to ReSharper

I'm in conversation with the ReSharper dev team about getting a dnx host environment launcher working. We obviously want to get something working that will enable debugging, profiling and coverage, too. Once this is in place, I can implement the xunit runner (little known fact, the asp.net environment allows for any test runner, they've only implemented xunit right now).

Support for traits defined on base classes

Hi,

thanks for the great plugin. One feature I am missing is support for traits defined on abstract base classes of tests. These are currently not picked up by Resharper (at least with XUnit 1.9.2, which I am still using because of performance problems with v2).

Actually, I even have a fix for this problem. Sorry for not making a pull request, but I didn't have a chance to test it properly with all Resharper-XUnit version combinations.
Anyway, the only change needed to make it work (at least for Resharper 9 / xunit v1) is replacing MetadataTypeInfoAdapter.GetCustomAttributes method with this implementation:

public IEnumerable GetCustomAttributes(Type attributeType)
{
var current = metadataTypeInfo;
while (current != null)
{
foreach (var attribute in (from attribute in current.CustomAttributes
where attributeType.IsAssignableFrom(attribute.UsedConstructor.DeclaringType)
select attribute.AsAttributeInfo()))
{
yield return attribute;
}
current = (current.Base == null) ? null : current.Base.Type;
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.