Rx9 : What are subplatforms in relation to TestEnvironmentAssembly<>

Looking at some other plugins I've updated my assemblyinfo.cs

https://testcop.codeplex.com/SourceControl/latest#Project/Src/TestCop.Plugin.Tests/Properties/AssemblyInfo.cs

However I get some exceptions thrown when running tests.

They are:

•The filter has failed to yield the narrowed list. There're no known subplatforms with the assembly

•Could not autoselect a module zone by the JetBrains.Application.BuildScript.Application.Zones.AutoselectZoneByClrVersionAttribute autoselection attribute. There are no matches for attribute value 4.

•The instance of the environment has not been created

What is needed for the test environment to be initialised ?

29 comments
Comment actions Permalink

Hello,

What is needed for the test environment to be initialised ?


Unit tests don't need anything special.

Tests which start the simulated runtime with the full Shell must be run in
a folder into which the packages have been extracted. This includes all R#
packages needed for your plugin, and the plugin package itself. Otherwise
the startup code won't know what to run and in which configuration. What's
the file listing in the folder of the DLL? Also beware the "shadow copying"
option of the test runner.

Matt might have a doc on unit testing in plugins, but I'm not sure.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

I'm currently writing up what needs to be done to get testing working in 9.0. There are a couple of steps needed to get it to work. Should be a couple of days. Sorry for the delay.

0
Comment actions Permalink

Hi Matt, do you have an update on unit testing R#9 plugins?  Regards...

0
Comment actions Permalink

I'm trying to migrate my plug-in to R# 9 and faced the same issue.

I've search for other plug-ins that already migrated to R# 9 (for instance https://github.com/controlflow/resharper-postfix) tried to run tests from it and got the same error: Invalid Operation exception with a message that "no known subplatform with the assembly".

Maybe that will help to understand the root cause of the issue that some of us faces.

0
Comment actions Permalink

Hello,

Do you have the contents of all the packages (including such of the plugin)
in your bin folder?


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Hello,

I turned on a fusion logs and check the output, I can't see any errors in the assembly loading process.

As I mentioned already, I tried to run tests for existing plug-ins that I've pulled from githib, like: https://github.com/hazzik/ReSharper.StringFormat and https://github.com/controlflow/resharper-postfix.

When I'm trying to run tests for them for R#9 I'm getting the same issue.

It is possible that my plug-in was screwed, but I don't think that two other plug-ins are screwed in the same way. And I assume that author of them at least try to run the tests.

Any other ideas how to diagnose the issue? Targets, build definitions, packages version?

0
Comment actions Permalink

It's not your code, it's the code in the TestEnvironmentAssembly class - it makes certain assumptions about your code and project structure that aren't usually valid for extensions. I've got a work around, and can run now happily run tests with ReSharper 9, but need to refactor it to make it useful for public consumption. I'll be working on it today.

0
Comment actions Permalink

Yeah, sorry for the long delay. I've got it working, with a replacement for TestEnvironmentAssembly. I need to clean the code up a little bit, and I'll write it up on the devguide. Apologies for this taking a while - things have got a little hectic lately, but the good news is this is my number 1 priority for this week.

0
Comment actions Permalink

Great Matt. Happy to test it out for you as I don't wish to make any more changes to my plugin until I have unit tests back online...

0
Comment actions Permalink

Hi Matt, are you ready to share your workaround ?

0
Comment actions Permalink

Hi,

Do you have an update on unit testing R#9 plugins?

0
Comment actions Permalink

Sorry it's taken so long - the updates have been rolled into the 9.1 SDK. I'll be writing it up this week (yeah, yeah, we've heard that before :-/) but the short version is that you need to create a class that derives from ExtensionTestEnvironmentAssembly<TZone>. TZone is something like:

[ZoneDefinition]
public interface IMyTestZone : ITestsZone, IRequire<PsiFeatureTestZone>//, IRequire<OtherZones>
{
}


This sets up a zone definition that tells the ReSharper environment what zones should be activated - everything that IMyTestZone derives from or requires. If you want to add any custom components in your test assembly, they need to be marked as requiring this zone, or ReSharper won't create them.

You generally don't need to have any implementation in your derived ExtensionTestEnvironmentAssembly class - it handles everything for you. UNLESS, your plugin is made up of multiple assemblies. Unfortunately, we only tested the base class with a simple plugin structure - a plugin dll and a test dll. If your plugin uses other assemblies, it fails, and you need to override the default implementation. We're hoping to fix this in a future update (I'm hoping as part of the 9.1 timeline - we want to add C++ support). In the meantime, you can copy this implementation from xunit.

Finally, you also need to add a property to your .csproj file - JetTestProject=True. Again, see xunit as an example. This tells the SDK to copy all assemblies and other content for test projects. For non-test projects, we no longer copy-local.

You need to take care when doing data driven tests - if you try to access BaseTestDataPath in your TestCases source property, then it will crash, because the environment hasn't been set up at that point, and the base test won't be able to find the test data path. Generally speaking, the guidance for nunit's TestCases attribute is to not access properties of the type you're on, as it won't have had time to initialise properly (as in, the property is called very early in the test run). However, you can manually ensure the test data path is correctly set - there's an example of this in the AgentMulder project.

When setting up the environment, ReSharper will try to infer the product home root, either by looking for a file called "Product.Root", or walking up the directories from the executing assembly, looking for a test\data folder. This path can be overridden with the TestDataPathBase attribute (although this is marked as obsolete, it's still working).

Hope this helps to get things moving. Apologies that it's taken so long.

0
Comment actions Permalink

Thanks for your explanation. I changed my code, but I still get errors

using System;
using System.Collections.Generic;
using System.Reflection;
using JetBrains.Application;
using JetBrains.Application.BuildScript.Application;
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.Application.BuildScript.PackageSpecification;
using JetBrains.Application.BuildScript.Solution;
using JetBrains.Application.Environment;
using JetBrains.Application.Environment.HostParameters;
using JetBrains.Metadata.Reader.API;
using JetBrains.Metadata.Utils;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.ReSharper.TestFramework;
using JetBrains.TestFramework;
using JetBrains.TestFramework.Application.Zones;
using JetBrains.TestFramework.Utils;
using JetBrains.Threading;
using JetBrains.Util;
using NUnit.Framework;
 
namespace ResharperWebDevTools.Tests
{
    [ZoneDefinition]
    public interface IDevTestZone : ITestsZone, IRequire<PsiFeatureTestZone>
    {
    }
 
    [SetUpFixture]
    public class TestEnvironmentAssembly : ExtensionTestEnvironmentAssembly<IDevTestZone>
    {
        // The default implementation of ExtensionTestEnvironmentAssembly breaks with multiple assemblies
        protected override JetHostItems.Packages CreateJetHostPackages(JetHostItems.Engine engine)
        {
            var mainAssembly = GetType().Assembly;
            var productBinariesDir = mainAssembly.GetPath().Parent;
 
            // Home dir
            if (AllAssembliesLocator.TryGetProductHomeDirOnSources(productBinariesDir).IsNullOrEmpty())
            {
                var relativeTestDataPath = TestUtil.GetTestDataPathBase_Find_FromAttr(mainAssembly) ?? TestUtil.DefaultTestDataPath;
                var productHomeDir = FileSystemUtil.GetDirectoryNameOfItemAbove(productBinariesDir, relativeTestDataPath);
                Environment.SetEnvironmentVariable(AllAssembliesLocator.ProductHomeDirEnvironmentVariableName, productHomeDir.FullPath);
            }
 
            return engine.OnPackagesInFlatFolderDependentOnAssembly(mainAssembly,
              packages =>
              {
                  var packageFiles = new HashSet<ApplicationPackageFile>(new JetBrains.EqualityComparer<ApplicationPackageFile>(
                    (file1, file2) => file1.LocalInstallPath == file2.LocalInstallPath, file => file.LocalInstallPath.GetHashCode()));
                  var packageReferences = new HashSet<ApplicationPackageReference>(new JetBrains.EqualityComparer<ApplicationPackageReference>(
                    (reference1, reference2) => string.Equals(reference1.PackageId, reference2.PackageId, StringComparison.OrdinalIgnoreCase),
                    reference => reference.PackageId.GetHashCode()));
                  var assemblyNameInfo = AssemblyNameInfo.Parse(mainAssembly.FullName);
                  using (var loader = new MetadataLoader(productBinariesDir))
                  {
                      ProcessAssembly(packages, productBinariesDir, loader, assemblyNameInfo, packageFiles, packageReferences);
                  }
                  var packageArtifact = new ApplicationPackageArtifact(new SubplatformName(assemblyNameInfo.Name), new JetSemanticVersion(assemblyNameInfo.Version), CompanyInfo.Name, CompanyInfo.NameWithInc, DateTime.UtcNow, null, null, packageFiles, new JetPackageMetadata(), packageReferences, Guid.Empty);
                  return new AllAssembliesOnPackages(packages.Subplatforms.Concat(new SubplatformOnPackage(packageArtifact)).AsCollection());
              });
        }
 
        private static void ProcessAssembly(AllAssemblies allAssemblies, FileSystemPath productBinariesDir, MetadataLoader metadataLoader, AssemblyNameInfo assemblyNameInfo, HashSet<ApplicationPackageFile> packageFiles, HashSet<ApplicationPackageReference> packageReferences)
        {
            var assembly = metadataLoader.TryLoad(assemblyNameInfo, JetFunc<AssemblyNameInfo>.False, false);
            if (assembly == null) return;
 
            var subplatformOfAssembly = allAssemblies.FindSubplatformOfAssembly(assemblyNameInfo, OnError.Ignore);
 
            if (subplatformOfAssembly != null)
            {
                var subplatformReference = new ApplicationPackageReference(subplatformOfAssembly.Name, subplatformOfAssembly.GetCompanyNameHuman());
                packageReferences.Add(subplatformReference);
                return;
            }
 
            if (!packageFiles.Add(new ApplicationPackageFile(assembly.Location.MakeRelativeTo(productBinariesDir), assemblyNameInfo)))
                return;
 
            foreach (var referencedAssembly in assembly.ReferencedAssembliesNames)
            {
                ProcessAssembly(allAssemblies, productBinariesDir, metadataLoader, referencedAssembly, packageFiles, packageReferences);
            }
        }
    }
}

TestFixture]
public class WindowOnloadQuickFixTest : QuickFixAvailabilityTestBase
{
      protected override bool HighlightingPredicate(IHighlighting highlighting, IPsiSourceFile psiSourceFile)
    {
        return highlighting is WindowOnLoadHighlighting;
    }

      [TestCase("test01.js")]
      public void Test(string file)
      {
          DoTestFiles(file);
      }

     [Test]
    public void Test()
    {
        DoTestFiles("test01.js");
    }
}


ERROR
Expected: not null
  But was:  null

TearDown : JetBrains.TestFramework.Utils.TestLoggerListener+TestWrapperException : Can't find package JetBrains.Tests.Platform.NETFrameWork 2.0 Expected: not null But was: null

--- EXCEPTION #1/2 [AssertionException]
Message = “
  Can't find package JetBrains.Tests.Platform.NETFrameWork 2.0
    Expected: not null
    But was:  null

ExceptionPath = Root.InnerException
ClassName = NUnit.Framework.AssertionException
Data.NuGet.Source.#1 = “nuget.org [https://www.nuget.org/api/v2/]”
Data.TempDataPath = C:\Users\xxx\AppData\Local\Temp\Nagugul
HResult = COR_E_EXCEPTION=80131500
Source = nunit.framework
StackTraceString = “
  at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
     at JetBrains.ReSharper.TestFramework.TestPackagesAttribute.ProcessPackagesInternal(PackageSourceProvider sourceProvider, FileSystemPath tempDataPath, FrameworkName framework, IEnumerable`1 packages, Boolean inTeamCity)
     at JetBrains.ReSharper.TestFramework.TestPackagesAttribute.<>c__DisplayClass35.<ProcessPackages>b__34(FileSystemPath tempPath)
     at JetBrains.TestFramework.Projects.PackagesCache.<>c__DisplayClass1.<GetOrCreatePackageManager>b__0()
     at JetBrains.Util.CollectionUtil.GetOrCreateValue[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`1 funcNew)
     at JetBrains.TestFramework.Projects.PackagesCache.GetOrCreatePackageManager(Hash hash, Func`2 createPackageManager)
     at JetBrains.ReSharper.TestFramework.TestPackagesAttribute.ProcessPackages(PackagesCache packagesCache, FileSystemPath testDataPath, FrameworkName framework, IEnumerable`1 packages)
     at JetBrains.TestFramework.Projects.BaseTestEx.InitDataPackages(BaseTest test, IEnumerable`1 packages)
     at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.InitSolution(Func`2 createSolutionConfiguration, IReuseSolutionInTestsComponent reuseSolutionInTestsComponent)
     at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.<>c__DisplayClass1d.<DoTestSolution>b__14()
     at JetBrains.Application.IShellLocksEx.ExecuteWithReadLock(IShellLocks thіs, Action F)
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)


--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “
  Can't find package JetBrains.Tests.Platform.NETFrameWork 2.0
    Expected: not null
    But was:  null

ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.TestFramework.BaseTest.RunGuarded(Action action)
     at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.DoTestSolution(Func`2 testSolutionConfiguration, Action`2 test)
     at JetBrains.ReSharper.TestFramework.BaseTestWithTextControl`1.DoTestSolution(String[] fileSet)
     at ResharperWebDevTools.Tests.WindowOnloadQuickFixTest.Test() in d:\CreditQuest\Tools\ResharperDeveloperTools\ResharperWebDevTools.Tests\WindowOnloadQuickFixTest.cs:line 26
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at NUnit.Core.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)
     at NUnit.Core.TestMethod.RunTestMethod()
     at NUnit.Core.TestMethod.RunTestCase(TestResult testResult)
     at NUnit.Core.TestMethod.RunTest()
     at NUnit.Core.NUnitTestMethod.RunTest()
     at NUnit.Core.TestMethod.RunRepeatedTest()
     at NUnit.Core.TestMethod.RunTestInContext()
     at NUnit.Core.TestMethod.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestFixture.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.SetUpFixture.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter, Boolean tracing, LoggingThreshold logLevel)
     at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestRunner.Run(EventListener listener, ITestFilter filter)
     at JetBrains.ReSharper.UnitTestRunner.nUnit.BuiltInNUnitRunner.RunTests(IRemoteTaskServer server, Dictionary`2 tests, Dictionary`2 fixtures, List`1 explicitly, Boolean useAddins, List`1 assemblies)
     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
     at System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(IMessage reqMsg)
     at System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)
     at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(Object[] args)
     at System.Threading.Thread.InternalCrossContextCallback(Context ctx, IntPtr ctxID, Int32 appDomainID, InternalCrossContextDelegate ftnToCall, Object[] args)
     at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(IMessage reqMsg)
     at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)
     at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
     at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)


   at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
   at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.DoTestSolution(Func`2 testSolutionConfiguration, Action`2 test)
   at JetBrains.ReSharper.TestFramework.BaseTestWithTextControl`1.DoTestSolution(String[] fileSet)
   at ResharperWebDevTools.Tests.WindowOnloadQuickFixTest.Test() in WindowOnloadQuickFixTest.cs: line 26
--TearDown
   at JetBrains.Util.Tests.ThrowsAccumulatedLoggerExceptions.ThrowLoggedExceptions()
   at JetBrains.TestFramework.BaseTestNoShell.TearDown()

0
Comment actions Permalink

I knew I'd miss something off. You also need to add a nuget.config file to your test\data folder, like this: https://github.com/xunit/resharper-xunit/blob/xunit2/resharper/test/data/nuget.config

It sets up a nuget package source that the test framework will use to download the appropriate .net framework GAC assemblies for the test (by default, they're set up to run .net 3.5). Once this is in place, the test environment will download the assemblies and cache them in %TEMP%\JetTestPackages (if they're already there, they won't get downloaded again), and the in-memory test solution will reference these assemblies. The first run might take a little while as the packages are downloaded.

0
Comment actions Permalink

I added nuget.config file to test\data folder, but I still get following error :
  Expected: not null
  But was:  null

TearDown : JetBrains.TestFramework.Utils.TestLoggerListener+TestWrapperException : Can't find package JetBrains.Tests.Platform.NETFrameWork 2.0 Expected: not null But was: null

--- EXCEPTION #1/2 [AssertionException]
Message = “
  Can't find package JetBrains.Tests.Platform.NETFrameWork 2.0
    Expected: not null
    But was:  null

ExceptionPath = Root.InnerException
ClassName = NUnit.Framework.AssertionException
Data.NuGet.Source.#1 = “nuget.org [https://www.nuget.org/api/v2/]”
Data.TempDataPath = C:\Users\xxx\AppData\Local\Temp\Jadodid
HResult = COR_E_EXCEPTION=80131500
Source = nunit.framework
StackTraceString = “
  at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
     at JetBrains.ReSharper.TestFramework.TestPackagesAttribute.ProcessPackagesInternal(PackageSourceProvider sourceProvider, FileSystemPath tempDataPath, FrameworkName framework, IEnumerable`1 packages, Boolean inTeamCity)
     at JetBrains.ReSharper.TestFramework.TestPackagesAttribute.<>c__DisplayClass35.<ProcessPackages>b__34(FileSystemPath tempPath)
     at JetBrains.TestFramework.Projects.PackagesCache.<>c__DisplayClass1.<GetOrCreatePackageManager>b__0()
     at JetBrains.Util.CollectionUtil.GetOrCreateValue[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`1 funcNew)
     at JetBrains.TestFramework.Projects.PackagesCache.GetOrCreatePackageManager(Hash hash, Func`2 createPackageManager)
     at JetBrains.ReSharper.TestFramework.TestPackagesAttribute.ProcessPackages(PackagesCache packagesCache, FileSystemPath testDataPath, FrameworkName framework, IEnumerable`1 packages)
     at JetBrains.TestFramework.Projects.BaseTestEx.InitDataPackages(BaseTest test, IEnumerable`1 packages)
     at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.InitSolution(Func`2 createSolutionConfiguration, IReuseSolutionInTestsComponent reuseSolutionInTestsComponent)
     at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.<>c__DisplayClass1d.<DoTestSolution>b__14()
     at JetBrains.Application.IShellLocksEx.ExecuteWithReadLock(IShellLocks thіs, Action F)
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)


--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “
  Can't find package JetBrains.Tests.Platform.NETFrameWork 2.0
    Expected: not null
    But was:  null

ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.TestFramework.BaseTest.RunGuarded(Action action)
     at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.DoTestSolution(Func`2 testSolutionConfiguration, Action`2 test)
     at JetBrains.ReSharper.TestFramework.BaseTestWithTextControl`1.DoTestSolution(String[] fileSet)
     at ResharperWebDevTools.Tests.WindowOnloadQuickFixTest.Test() in d:\CreditQuest\Tools\ResharperDeveloperTools\ResharperWebDevTools.Tests\WindowOnloadQuickFixTest.cs:line 26
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at NUnit.Core.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)
     at NUnit.Core.TestMethod.RunTestMethod()
     at NUnit.Core.TestMethod.RunTestCase(TestResult testResult)
     at NUnit.Core.TestMethod.RunTest()
     at NUnit.Core.NUnitTestMethod.RunTest()
     at NUnit.Core.TestMethod.RunRepeatedTest()
     at NUnit.Core.TestMethod.RunTestInContext()
     at NUnit.Core.TestMethod.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestFixture.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.SetUpFixture.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
     at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
     at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter, Boolean tracing, LoggingThreshold logLevel)
     at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestRunner.Run(EventListener listener, ITestFilter filter)
     at JetBrains.ReSharper.UnitTestRunner.nUnit.BuiltInNUnitRunner.RunTests(IRemoteTaskServer server, Dictionary`2 tests, Dictionary`2 fixtures, List`1 explicitly, Boolean useAddins, List`1 assemblies)
     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
     at System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(IMessage reqMsg)
     at System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)
     at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(Object[] args)
     at System.Threading.Thread.InternalCrossContextCallback(Context ctx, IntPtr ctxID, Int32 appDomainID, InternalCrossContextDelegate ftnToCall, Object[] args)
     at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(IMessage reqMsg)
     at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)
     at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
     at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)


   at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
   at JetBrains.ReSharper.TestFramework.BaseTestWithSolution.DoTestSolution(Func`2 testSolutionConfiguration, Action`2 test)
   at JetBrains.ReSharper.TestFramework.BaseTestWithTextControl`1.DoTestSolution(String[] fileSet)
   at ResharperWebDevTools.Tests.WindowOnloadQuickFixTest.Test() in WindowOnloadQuickFixTest.cs: line 26
--TearDown
   at JetBrains.Util.Tests.ThrowsAccumulatedLoggerExceptions.ThrowLoggedExceptions()
   at JetBrains.TestFramework.BaseTestNoShell.TearDown()

0
Comment actions Permalink

Did you use the nuget.config file I linked to? The packages it downloads are on a custom nuget gallery maintained by JetBrains, not nuget.org. It's listed as one of the package sources, with a fallback to nuget.org for anything that's required (i.e. other tests can declare they need e.g. the xunit package, and it'll get downloaded)

0
Comment actions Permalink

I added the nuget.config as is, from your sample.

0
Comment actions Permalink

It's not picking up the nuget.config you've added - the exception is listing only one package source, which is nuget.org. Where did you put the nuget.config file? AIUI, it will load the first nuget.config it finds relative to the the fully qualified RelativeTestDataPath, e.g. given test\data\csharp\completion\list, it will walk up the hierarchy until it finds a nuget.config file. I put mine in test\data.

0
Comment actions Permalink

I put mine nuget.config to test\data that relative to fully qualified RelativeTestDataPath.
resharper_sdk1.jpg

0
Comment actions Permalink

I can't see what's going wrong here. When I try and set up the same as what you've described, it just works fine. Would you be able to send me your solution?

0
Comment actions Permalink

Where to send the download link? Thanks

0
Comment actions Permalink

matt.ellis at jetbrains.com

0
Comment actions Permalink

Matt - it is working for me. YAY, at last I feel like I can release a 9.1 version of my plugin.  
Two related questions...  
1) do we still need to change our package ID between 9.0 and 9.1 ?  
2) I often get a teardown exception when running all my unit tests...any ideas?   


Could not remove an item “(nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, System.Func`1[System.Reflection.Assembly])” from the collection because the item is not present in the collection. Parameter name: value  --- EXCEPTION #1/2 [ArgumentException] Message = “Could not remove an item “(nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, System.Func`1[System.Reflection.Assembly])” from the collection because the item is not present in the collection.” ExceptionPath = Root.InnerException ClassName = System.ArgumentException HResult = COR_E_ARGUMENT=E_INVALIDARG=80070057 Source = JetBrains.Platform.Util ParamName = value StackTraceString = “   at JetBrains.DataFlow.CollectionEvents`1.InternalRemove(TValue value, Object cookie)      at JetBrains.DataFlow.CollectionEvents`1.Remove(TValue item)      at JetBrains.Util.CollectionUtil.<>c__DisplayClass8e`1.
b__8d()      at JetBrains.DataFlow.Lifetime.Terminate() ”  --- Outer ---  --- EXCEPTION #2/2 [LoggerException] Message = “   Could not remove an item “(nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, System.Func`1[System.Reflection.Assembly])” from the collection because the item is not present in the collection.   Parameter name: value ” ExceptionPath = Root ClassName = JetBrains.Util.LoggerException InnerException = “Exception #1 at Root.InnerException” HResult = COR_E_APPLICATION=80131600 StackTraceString = “   at JetBrains.DataFlow.Lifetime.Terminate()      at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)      at JetBrains.Util.ILoggerEx.Catch(ILogger thіs, Action F, ExceptionOrigin origin)      at JetBrains.Application.Environment.JetEnvironment.InternalDestroy(LifetimeDefinition lifetimeDefinition, JetHostParametersCaller host)      at JetBrains.DataFlow.Lifetime.Terminate()      at JetBrains.DataFlow.SequentialLifetimes.SetCurrentLifetime(LifetimeDefinition lifetimeToSet)      at JetBrains.TestFramework.TestEnvironmentAssembly`1.TearDown()      at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)      at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)      at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)      at NUnit.Core.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)      at NUnit.Core.Reflect.InvokeMethod(MethodInfo method, Object fixture)      at NUnit.Core.TestSuite.DoOneTimeTearDown(TestResult suiteResult)      at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)      at NUnit.Core.SetUpFixture.Run(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)      at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)      at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter, Boolean tracing, LoggingThreshold logLevel)      at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestRunner.Run(EventListener listener, ITestFilter filter)      at JetBrains.ReSharper.UnitTestRunner.nUnit.BuiltInNUnitRunner.RunTests(IRemoteTaskServer server, Dictionary`2 tests, Dictionary`2 fixtures, List`1 explicitly, Boolean useAddins, List`1 assemblies)      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)      at System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(IMessage reqMsg)      at System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)      at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(Object[] args)      at System.Threading.Thread.InternalCrossContextCallback(Context ctx, IntPtr ctxID, Int32 appDomainID, InternalCrossContextDelegate ftnToCall, Object[] args)      at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(IMessage reqMsg)      at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)      at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)      at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args) ”     at JetBrains.Util.Tests.ThrowsAccumulatedLoggerExceptions.ThrowLoggedExceptions()

0
Comment actions Permalink

Hi Matt,

I sent you my project.

Thanks

0
Comment actions Permalink

Hooray!

No, you don't need a new package. The gallery has been updated so that it will only return the latest compatible vesion of a package for a given feed. So the Wave 1.0 feed will only return Wave 1.0 compatible versions of a package. The Wave 2.0 version will not be included, but will be in the Wave 2.0 feed.

I'm not sure about that exception. I did see it myself as I was getting tests running, but can't remember why, or how I got rid of it. Are you doing anything in your implementation of TestEnvironmentAssembly.TearDown? Are you using the overridden implementation of CreateJetHostPackages?

0
Comment actions Permalink

Hi Matt, I am using the one from XUnit that you linked. It looks the same.

0
Comment actions Permalink

Hi Matt,

Will you have you looked at the problem, which I sent to you on mail?

0
Comment actions Permalink

Yes, you have a byte ordering mark at the start of your nuget.config, which is confusing everything. Remove that, and it runs the test (although it fails).

0
Comment actions Permalink

Thanks, after editing of the nuget.config files tests works

0

Please sign in to leave a comment.