lishijie211 / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Add support for R#7 #900

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Looks like this is in the code but not released? I compiled and tested the 
current code (SVN rev 3364), and got it working. (Posted about it on 
stackoverflow 
http://stackoverflow.com/questions/12982978/how-to-support-mbunit-tests-in-resha
rper-7)

I still see some features missing 
- Several tests can not be started directly from source - looking for a 
pattern, will update when/if I realize what is the difference between OK and 
NOK. (Suspecting attributes)
- List of tests in unit test explorer is not sorted.
- "Open Test Report" is disabled - this prevents me from getting the nice 
html-report, minor issue

Any plans to work on this in the immediate future?

Obviously the data-driven testing feature, 
http://code.google.com/p/mb-unit/issues/detail?id=861 would also be an awesome 
improvement to the runner.

Original issue reported on code.google.com by es...@albrektsen.net on 19 Oct 2012 at 10:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
OK - so I think I isolated the issue with append to session (And in Retrospect, 
I think this is an old bug - I think it is present in other R# runners also) - 
it is related to the TestsOn attribute.

It looks like only the first test on a given type is recognized by R#. See 
attached project for reproduction. 
Test1 and Test2 are listed and "runnable", but Test3 is not. 
Comment out the TestsOn in Test3 and it is present. Change 
[TestsOn(typeof(System.Double))] -> [TestsOn(typeof(System.Int16))] and it is 
OK.

Original comment by es...@albrektsen.net on 19 Oct 2012 at 10:33

Attachments:

GoogleCodeExporter commented 9 years ago
OK - so I have done some more digging.

JetBrains parses unit tests in two ways - "File Mode" and "Assembly mode". 
The "File mode" (IUnitTestFileExplorer) seems to be working OK.
The "Assembly mode" (IUnitTestMetadataExplorer) seems to fail with 
ProcessCancelledException in ReSharperReflectionPolicy.cs:124 - I have posted a 
question to JetBrains on this, it is awaiting moderation.

I will update this issue when/if I get any feedback. 

Original comment by es...@albrektsen.net on 22 Oct 2012 at 2:43

GoogleCodeExporter commented 9 years ago
I have debugged the code - the ProcessCancelledException seems to not be the 
culprit, I am awaiting more details from JetBrains, see 
http://devnet.jetbrains.net/thread/439267

Original comment by es...@albrektsen.net on 22 Oct 2012 at 9:41

GoogleCodeExporter commented 9 years ago
Here is a patch that addresses the fact that R# does not like us creating new 
IUnitTestElements every time. Tested on my machine, and while imperfect, works 
a LOT better than the trunk code.

Original comment by es...@albrektsen.net on 26 Oct 2012 at 6:31

Attachments:

GoogleCodeExporter commented 9 years ago
Here's the reflection hack I used to make Gallio more reliably find tests in 
R#7 as requested in 
https://groups.google.com/d/msg/gallio-dev/XTggrBilcrI/Ur0P5Qv0r1YJ

Original comment by johan.ap...@gmail.com on 29 Oct 2012 at 10:51

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here is a unified patch containing:
1 - My change from comment 
http://code.google.com/p/mb-unit/issues/detail?id=900#c5
2 - Johan's patch from comment 
http://code.google.com/p/mb-unit/issues/detail?id=900#c6
3 - Improved my patch - it now seems to correctly handle class and method 
renames.
    NB: The GallioTestElement is no longer mutable - I removed readonly from the declaredElementResolver field...

Original comment by es...@albrektsen.net on 29 Oct 2012 at 11:46

Attachments:

GoogleCodeExporter commented 9 years ago
And here is a compiled version for R#7.1 - still waiting to get instructions on 
how to commit these patches to SVN...

Original comment by espen.al...@gmail.com on 17 Nov 2012 at 10:24

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like JetBrains obsoleted IFacadeTaskServer.TaskExplain so some output 
from simple tests is lost. 

http://youtrack.jetbrains.com/issue/RSRP-335805

Attached a patch that should fix this. 

Original comment by johan.ap...@gmail.com on 5 Dec 2012 at 9:58

Attachments:

GoogleCodeExporter commented 9 years ago
Hi all. There are a couple of other issues to get a good 7.1 compile:

1. test elements found while editing are caching a ReSharper object that 
becomes invalid when the file is edited, this causes tests to be "lost" and 
removed. While this was fixed in comment #8 above, I've added a more robust fix
2. invalid elements need to be removed from their parent elements correctly, or 
they'll leak memory
3. there's an exception due to an icon not being found

I've attached various patch files, although since it changes the existing fix 
for the invalid cached object, I don't know how cleanly it will apply. You can 
easily see the diffs, though. I've also put my changes on a GitHub repo (which 
is a snapshot of the current svn revision, not a full mirror) - 
https://github.com/citizenmatt/gallio

Is there anyone around to push the accumulated changes in this thread to svn?

Thanks
Matt
--
Matt Ellis
Technical Evangelist
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Original comment by m.t.ellis on 11 Dec 2012 at 9:23

Attachments:

GoogleCodeExporter commented 9 years ago
I just submitted my patches for R#7 and R#7.1 to the Gallio team (Andrew 
Stopford)

Unfortunately - I have _not_ had time to review the comments/improvements from 
comments 10 and 11 above.

When/if I get time, I will try to combine the patches outlined here - or 
hopefully, we will get this code into SVN fast so that we can all contribute to 
making this plugin work as seamlessly as possible.

Just as a motivation for anyone with spare time: Please implement R# support 
for datadriven tests: http://code.google.com/p/mb-unit/issues/detail?id=861 :-)

NB: In order to compile the R#7.1 code, you probably need to manually install 
the R#7.1 SDK into v3\src\Extensions\ReSharper\libs\ReSharper\v7.1

Original comment by espen.al...@gmail.com on 11 Dec 2012 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago
Here is a combined version with all the patches (My patches + Johan's patch + 
Matt's patches).

Seems to work very nicely on my box. :-)

I have submitted the actual patches to the MbUnit team, but unfortunately there 
has been no response... :-(

Original comment by es...@albrektsen.net on 29 Dec 2012 at 7:32

Attachments:

GoogleCodeExporter commented 9 years ago
Which version of MbUnit+Gallio does one need to work with this plugin?

Original comment by candy.ch...@gmail.com on 26 Feb 2013 at 5:06

GoogleCodeExporter commented 9 years ago
Gallio 3.4

Original comment by es...@albrektsen.net on 26 Feb 2013 at 5:07

GoogleCodeExporter commented 9 years ago
This still doesn't work for me... Any update on if they are going to support it 
in resharper?

Original comment by thearcha...@gmail.com on 17 Apr 2013 at 11:21

GoogleCodeExporter commented 9 years ago
"They" will never support R# - it is up to us - contributors to Gallio/MbUnit 
to implement it. I have contributed the code - but right now there is a big 
debate as to whether Gallio is dead - currently the build servers are down and 
nobody are actively keeping the project alive. Check out 
https://groups.google.com/forum/?fromgroups=#!topic/gallio-dev/6FWzukxO_Wo for 
status on this...

What specifically is not working? I use R#7.1 and Gallio/MbUnit on myWin7x64 
VS2012.SP2 machine. Works fine for me...

Original comment by es...@albrektsen.net on 17 Apr 2013 at 11:26

GoogleCodeExporter commented 9 years ago
I'm using R# 7.1.3 on VS2012 SP2 (win8 x64) and  after installing Gallio 3.4 
and your R# plugin it partially works. R# puts the icons in and when I click 
run tests it finds (some, but not always all) tests, but then it indicates that 
all tests are ignored (which they're not). Any ideas on what that could be? 

When I installed Gallio 3.4 I did a custom install (and didn't install any of 
the VS2010 or R# stuff). Could that be the problem?

Original comment by petrikva...@gmail.com on 13 Jun 2013 at 8:34

GoogleCodeExporter commented 9 years ago
FYI, the compiled runner attached to comment #13 works with R# 7.1.2 but will 
not work with 7.1.3. Just drop the files into the following folder on your 
system to activate it:

C:\Users\Username\AppData\Local\JetBrains\DotNet\vAny\Plugins\

Original comment by la...@mcnearney.net on 21 Jun 2013 at 11:21

GoogleCodeExporter commented 9 years ago
Is there a way to get this to work for Resharper 8?

Original comment by malhot...@gmail.com on 23 Sep 2013 at 8:18

GoogleCodeExporter commented 9 years ago
Is there any Gallio/MbUnit plugin for Resharper 8?

Original comment by wieslaw....@gmail.com on 22 Jan 2014 at 4:06