-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add 'Test With > .NET' and 'Test With > .NET Core' commands #21
Comments
Wow, that looks great! It will be really useful to be able to just run .Net Core or .Net Desktop for multi-targeted tests. Is .Net Desktop an established moniker for .Net 4x? As opposed to "classic" or something? Or .Net 1-4x? I'm not familiar with In-Proc. What does that do? |
Yes, kind of. I don't particularly like it and expect it will become outdated. I'm very open to suggestions for alternatives. Just
It runs tests in an app-domain in the VS process. It smuggles in a link to the VS extensibility object (called DTE). This lets me easily run tests on the running instance of VS. Very useful when developing extensions. ;) |
My vote would be for plain ".Net" rather than ".Net Desktop." I think .Net/.Net Core would be clear and less ambiguous. |
Personally, I preferred the first one. Core is maybe slightly ambiguous. Not sure about the capitals in .NET though - perhaps that is what makes it a bit heavy? How about |
It's tricky! .NET Core is pretty much always written with .NET in caps (see https://www.microsoft.com/net/core). .Net is very often written as '.net' (with a larger font), often as '.Net' and I think less often as '.NET'. I've plumped for '.Net' when I write TestDriven.Net. dotnet.exe seems to expand them as .NETCoreApp and .NETFramework. This would be another possibility: |
I think I like this one best... :-) |
Calling the command '.NET Framework' makes it a lot easier to search for when adding a keyboard shortcut (the 'Test With' menu is mostly for discoverability). Also, I like the way that (T)est, (F)ramework and (C)ore line up on a QWERTY keyboard. It makes for some potentially nice keyboard combinations. 😃 The next question is icons. Maybe the plain old triangles are okay? I guess using the same icon groups the related commands together. |
I see what you mean. They do work well for keyboard combos. Not sure about the icons though. The old TD.Net icons were distinct from each other...? Is this a new icon for .Net Core? |
Good question. That logo looked familiar, but I didn't know its background. Here is a little info: It seems Microsoft have moved from a lower case '.net' to an upper case '.NET'. That helps a bit with the choice of menu labels. |
I don't see any icons for .NET Core on the website - although they do have a few on https://www.microsoft.com/net/core/platform you could use .... the penguin for instance ;) Maybe the "Unified" icon? |
@jedidja Yes, let's go with the penguin. ;) I'm thinking the sober triangles are maybe okay. Using the same icon helps group the related commands together. I'm just putting the finishing touches touches to a new upload (that includes this functionality). It's amazing low long things like adding helpful error messages can take... |
I've finally got a build to try with this functionality. With any luck it will work on all of your current .xproj based projects (with the issues @mwhelan came across resolved). The 'Test With > .NET Framework' and 'Test With > .NET Core' command will execute the first of that framework type defined in your Please give it a try and see if you can break it: Thanks! |
OK, that has fixed the issue with running non-test projects... however, it is also now not running a test project that it was previously running correctly. There are 3 test projects in this repo. |
Does it show an exception or other message when you target an individual test? |
That's odd. That package is publicly available on NuGet. I downloaded Specify from GitHub, deleted my local NuGet cache, and then built it and everything built OK and it found TestStack.BDDfy 4.3.1. The only "odd" package is an alpha for FakeItEasy, but I have included its NuGet source in the nuget.config file. |
I don't see an error. I just get the 0 tests run message. |
I was using a daily build of .NET Core. That may have confused it. Sorry about the false alarm! Swapped out and it's building now. Is this not working on yours?
|
Yes, mine run those two test projects the same as you are getting, but there is a third test project - Specify.Examples.UnitSpecs - where the tests are not running.... |
Ah, I see what happened. It's related to the "known test framework" issue you mentioned. I was doing some last minute tidying up and removed something that made all .NET Core projects look like they contain tests. It now doesn't realize that your project contains tests. :( With any luck this build will work: (I need to work on spotting .NET Core projects with tests, probably by looking inside the project.json) |
I've noticed that targeting xUnit tests inside generic types is problematic at the moment. I need to work on getting the
|
Do you have an example of what you mean by targeting xUnit tests inside generic types? I don't follow... That build is running all the test projects again, but it is trying to run the non-test project again:
|
Yes, say you targeted this fact:
|
that's my whole framework... :-) |
Ah okay, so you would never actually target the |
Actually, you would always target the Specify method. That is the only method in the test project that has a Fact/Test attribute, so the test runner picks it up and executes it, then BDDfy takes over and uses reflection to scan the class and run all the Given/When/Then methods. |
Currently there are a few things you can target and have tests successfully run:
If a future version you would also be able to target:
Which of these would ordinarily be useful? Do you tend to always run all tests in the project? Is console output important for the tests? |
Yes, console output is really important. Previous versions of xunit and nunit used to display output of each BDDfy test in console, but the latest versions do not (Specify just sits on top of BDDfy). I think it is to do with the architectural changes they made to support parallelism. So, it would be great to get it through TD.Net. I'm not sure what scenarios it would be useful to target abstract classes like The typical use case is to run a full class that inherits The normal use case looks like this. Unfortunately, test runners often just display the method name "Specify" for each test. Ideally the test runner would display the name of the class,
|
Here's a build with console output from xUnit: Unfortunately it can get messy, which is why I disabled it in previous builds. |
Oh wow, that is brilliant! It is great to see the Given/When/Then steps output to the console, as happened with earlier versions of xUnit and NUnit. I'd love to know more about how you did that as it might provide clues to how we can resolve it in BDDfy. Thing is, it's probably xUnit-specific code is it? BDDfy is agnostic to all tools and just uses this reporter to print to the console. |
The Luckily, @bradwilson gave me a tip that will make it easier to filter out the duplicate fail message: Here is a simplified example of what I'm dealing with:
...outputs the following text and events (some removed for clarity)...
Notice the output appears before the tests and the "output" properties are empty. I need to find a way to make this look okay. |
Yes, I had extraneous info for my Specify tests as well. Would be good to exclude xunit logging and confine it to the test/class name and test output. |
Here's a more polished release for you to try: TestDriven.NET-4.0.3316_Extraterrestrial_Alpha.zip I've done the following:
|
Yeah, the decision not to capture Console (and Debug and Trace) was an explicit one in v2. We have an injectable test output mechanism ( |
You should only see it on the Code and Project context menus for .xproj Could you see if anything appears in DebugView: On 31 July 2016 at 10:05, Michael Whelan [email protected] wrote:
|
OK... I was right clicking on a file. The icons look great. And I really like the feature of being able to choose The output is excellent too, showing exactly the right BDDfy output for Very jealous. Would love to replicate that in BDDfy... though without On Sun, Jul 31, 2016 at 11:00 AM, Jamie Cansdale [email protected]
|
Missed this comment before.
This might be possible at some point. I'm thinking of writing a
I'm scooping it up from the test process stdout. xUnit and NUnit aren't capturing it at the moment for this type of test runner. |
'Test With > .NET' and 'Test With > .NET Core' seem to be working nicely. Closing this issue. 😄 |
Allows tests to be executed with a specific framework in .xproj style projects.
The text was updated successfully, but these errors were encountered: