microsoft / vssdktestfx Goto Github PK
View Code? Open in Web Editor NEWA testing framework for Visual Studio extensions
License: MIT License
A testing framework for Visual Studio extensions
License: MIT License
Hello ๐
I'm trying to install it via NuGet. Trying to install Microsoft.VisualStudio.Sdk.TestFramework
. But getting this error
Error NU1101 Unable to find package Microsoft.Internal.VisualStudio.Interop. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org
Also tried to check it on nuget.org but same issue
Maybe I'm doing something wrong? Could someone please help?
Best regards,
Alex
In a test project in VS, If I 'Run All' Tests from the class in VS, there are some random failing tests with the following message:
Message:โ
System.AggregateException : One or more errors occurred.
---- System.InvalidOperationException : Cannot create more than one System.Windows.Application instance in the same AppDomain.
---- The following constructor parameters did not have matching fixture data: GlobalServiceProvider gsp
Stack Trace:โ
----- Inner Stack Trace #1 (System.InvalidOperationException) -----
Application.ctor()
OleServiceProviderMock.MainThread()
--- End of stack trace from previous location where exception was thrown ---
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
OleServiceProviderMock.ctor()
GlobalServiceProvider.ctor()
----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----
using Microsoft.VisualStudio.Sdk.TestFramework;
using Xunit;
namespace LibForVsSdk.Tests
{
[Collection("LibForVsSdk.Tests.Test")]
public class UnitTest1
{
public UnitTest1(GlobalServiceProvider gsp)
{
}
[Fact]
public void TestFalse()
{
Assert.False(false);
}
[Fact]
public void TestTrue()
{
Assert.True(true);
}
[Theory]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
public void Test1(int number)
{
Assert.True(number < 10);
}
}
}
using Microsoft.VisualStudio.Sdk.TestFramework;
using Xunit;
namespace LibForVsSdk.Tests
{
[CollectionDefinition("LibForVsSdk.Tests.Test")]
public class CollectionDef : ICollectionFixture<GlobalServiceProvider>
{
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Sdk.TestFramework" Version="17.0.15" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
Am I doing something wrong?
Does this support NUnit?
I have many unit test cases written in NUnit. Migration them seems difficult.
Is this an internal-only package? We work on a public project (microsoft/sarif-visualstudio-extension) and are interested in using this publicly. Thanks!
Starting with the 17.0 release (and fixed in the 17.2 release) we had a bug where installing this package would fail due to missing nuget dependencies.
See #4 (comment) for a workaround.
Discovered this while unit testing a method that does something similar to:
IVsTask vsTask = this.JTF.RunAsyncAsVsTask(....,
{
cts.Token.ThrowIfCancellationRequested();
}
vsTask.GetResult(); // deadlocks
This is likely because MockVSTaskCompletionSource.SetCancelled method doesn't call TaskCompletionSource.SetCancelled.
With the recent privacy concerns with Moq (see here, here and https://github.com/moq/moq/issues/1372), I think it would be wise to remove the dependency on Moq from the NuGet package.
I don't see why any consumers of the Microsoft.VisualStudio.Sdk.TestFramework
NuGet package need to install the Moq
package as well. The only place it seems to be used is in a single using
declaration here:
The unit tests can continue to use Moq if you want, just as long as the published NuGet packages don't depend on it.
Would it be possible, please, if you've got a moment, now Visual Studio 2022 is out, to help us VSIX devs and release a built version of the head of the code to NuGet?
I seem to need it for testing a VS2022 VSIX that references v17 of the SDK. If there's a workaround let me know please. I have built my own version and it works, but I don't really want to publish that separately on NuGet.
I try to install this package . However, it always reports
`
Restoring packages for C:\Users\xxxx\source\repos\ImageOptimizer\Test\ImageOptimizer.Test\ImageOptimizer.Test.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.internal.visualstudio.interop/index.json
NotFound https://api.nuget.org/v3-flatcontainer/microsoft.internal.visualstudio.interop/index.json 1085ms
NU1101: Unable to find package Microsoft.Internal.VisualStudio.Interop. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org
Package restore failed. Rolling back package changes for 'ImageOptimizer.Test'.
Time Elapsed: 00:00:01.6479626
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.