Display the attempted lookup's in the output log

Jan 9, 2015 at 11:08 AM
I'm trying to match the following in MyApp.Services
MyApp.Services.AccountService.cs
to the following test case in MyApp.Tests
MyApp.Tests.Services.AccountServiceTests.cs
The default single-test-project config should match this, right?

It would be helpful if TestCop would output the attempted namespaces + the extracted parts for easier debugging of regex'es.
Coordinator
Jan 9, 2015 at 7:05 PM
Edited Jan 9, 2015 at 8:15 PM
The default TestCop regex assumes MyCorp.MyApp. so one of the regexs needs changing if you have just MyApp.
Code Namespace RegEx
^(.*?)(\..*?)$
Test the above out at http://myregexp.com/
TestCop is looking at the namespace so the regex runs against MyApp.Services or MyApp.Services.SubNamespace
Jan 19, 2015 at 9:07 AM
That didn't work - it is still Single Test Project, right?

Image
Coordinator
Jan 19, 2015 at 6:32 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jan 26, 2015 at 7:42 PM
Hi Jeffijoe - have you got it working?
Jan 26, 2015 at 9:30 PM
No, and the sample does not work either. I tried all the different lookup configs and nothing works.
Coordinator
Jan 26, 2015 at 9:40 PM
Edited Jan 26, 2015 at 9:41 PM
Hi. A couple of questions....and hopefully I can reproduce the problem...
What version of visual studio and ReSharper are you using?
What doesn't work? Does ctrl-g ctrl-t shortcut call the testcop shortcut? And if it does what does the output window say?
Jan 26, 2015 at 9:43 PM
2013, and r# 8 latest. It is saying unable to locate assembly (not at the pc atm)
Coordinator
Jan 27, 2015 at 7:07 PM
Edited Jan 27, 2015 at 7:08 PM
Hi Jeffijoe

With
  • Visual Studio 2013 Professional
  • ReSharper 8.2
  • Testcop 1.8.2.7
I then...
  • Use the settings you screenshot for 'single test project per solution'
  • Open up the MyApp solution that I uploaded to the linked issue within Visual Studio 2013
  • Open up the file MyApp\MyApp.DAL\ClassA.cs within the editor
  • Issue the ctrl-g,ctrl-t shortcut and testcop opens up the associated unit test.
Is this exactly what you are doing too? Sometimes it is possible to edit ReSharper settings but they are 'over-ridden'...how do you edit ReSharper settings? Is it 'ReSharper->Options' or via 'ReSharper->Manage Options' (where there are layers of settings)

Regards....
Jan 27, 2015 at 8:38 PM
Yes, and I use the Manage Options -> Computer Settings, and I've tried the other layers too.
Coordinator
Jan 27, 2015 at 9:21 PM
Hi. Can you try editing the testcop regex via resharper-options instead? And if that doesn't do it I'll do a new build with more debug.
Coordinator
Jan 28, 2015 at 8:35 PM
Found a bug. I hope this fixes the issue for you.

When using the 'singe test project per solution' strategy it is using the wrong regex to find test projects and is using the 'regex' from "Test Project Per Code Project linked by namespace" strategy. This regex is just used by the logic to find the test assemblies.

ReSharper->Options->TestCop
Switch to the other strategy...set the regex to ^(.*?).?Tests$
Switch back to the single test project per solution strategy.
Save options
Jan 30, 2015 at 11:01 AM
That fixed it. Thanks! :)

Do you place the test in a folder based on namespace, or by original source file location?

I have a set of folders with their Namespace Provider attribute set to False, and so the test file is not created in the correct location.
Coordinator
Jan 30, 2015 at 6:40 PM
Good. I'll branch and fix the 8.2 version.

File location is created based on namespace rather than folder.
Coordinator
Feb 2, 2015 at 8:08 PM
Edited Feb 2, 2015 at 8:09 PM
I have uploaded a fix - 1.8.2.8-BETA

Note you may need to change your regex if you download this.