adamchester / expecto-adapter Goto Github PK
View Code? Open in Web Editor NEWVisual Studio test adapter for Expecto (https://github.com/haf/expecto)
License: MIT License
Visual Studio test adapter for Expecto (https://github.com/haf/expecto)
License: MIT License
Expect.equal
stops further discovery of tests.
[<Tests>]
let equality =
testList "equality" [
testCase "equality 1" <| fun () ->
Expect.equal 42 42 ""
]
Place some other tests before and after this in a module. You will see the tests before discovered, the others not.
[8/22/2017 4:13:11 PM Informational] ------ Discover test started ------
[8/22/2017 4:13:11 PM Error] System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Mono.Cecil.Cil.MethodDebugInformation.GetSequencePointMapping()
at SourceLocation.SourceLocationFinder.getFirstOrDefaultSequencePoint(MethodDefinition m)
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](MethodDefinition m)
at [email protected](b& )
at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](IEnumerable`1& next)
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
at [email protected](b& )
at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@683[T,TResult](ConcatEnumerator`2 x, Unit unitVar0)
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
at [email protected](b& )
at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
at System.Linq.Enumerable.<TakeIterator>d__24`1.MoveNext()
at Microsoft.FSharp.Collections.SeqModule.TryFind[T](FSharpFunc`2 predicate, IEnumerable`1 source)
at Discovery.Discoverer.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestDiscoverer-DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
[8/22/2017 4:13:11 PM Informational] ========== Discover test finished: 48 found (0:00:00.4400538) ==========
Projects which target .net core are not supported right now by an adapter. It would be great if adapter supports not only .net framework related projects but also .net core related.
I think we could base on some solutions from yolo dev sdk
Maybe you guys have some more guides:
@adamchester @Alxandr @AnthonyLloyd
Somehow related: expecto #204
When I attempt Run Selected Tests from VS 2015 test window (same in VS 2017, with Framework 4.6.1 and 4.7):
System.MissingMethodException: Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption`1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1<Int32>)'.
at Execution.ExecuteProxy.ExecuteTests()
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](Result`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at Execution.ExpectoTestExecutor.runAllExecutors()
at Execution.ExpectoTestExecutor.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestExecutor-RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
Paket.lock:
Expecto (5.0)
Argu (>= 3.7)
FSharp.Core (>= 4.1.12)
Mono.Cecil (>= 0.10.0-beta5)
Expecto.BenchmarkDotNet (5.0)
BenchmarkDotNet (>= 0.10.5)
Expecto (>= 5.0)
FSharp.Core (>= 4.1.12)
Expecto.FsCheck (5.0)
Expecto (>= 5.0)
FsCheck (>= 2.8)
FSharp.Core (>= 4.1.12)
Expecto.VisualStudio.TestAdapter (5.0.0-alpha008) - version_in_path: true
Expecto (>= 5.0.0-beta1 < 6.0)
FSharp.Core (4.2.1)
I can only run the tests one or two times, after that it seems like Visual Studio, or something, has a "lock" on the test exe so my build fails. I get a couple of:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3989,5): warning MSB3026: Could not copy "obj\Debug\FSharpIntro.Tests.exe" to "bin\Debug\FSharpIntro.Tests.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\FSharpIntro.Tests.exe' because it is being used by another process.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3989,5): warning MSB3026: Could not copy "obj\Debug\FSharpIntro.Tests.exe" to "bin\Debug\FSharpIntro.Tests.exe". Beginning retry 2 in 1000ms. The process cannot access the file 'bin\Debug\FSharpIntro.Tests.exe' because it is being used by another process.
Then it fails with:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3989,5): error MSB3027: Could not copy "obj\Debug\FSharpIntro.Tests.exe" to "bin\Debug\FSharpIntro.Tests.exe". Exceeded retry count of 10. Failed.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3989,5): error MSB3021: Unable to copy file "obj\Debug\FSharpIntro.Tests.exe" to "bin\Debug\FSharpIntro.Tests.exe". The process cannot access the file 'bin\Debug\FSharpIntro.Tests.exe' because it is being used by another process.
Is it a known issue?
I'm experimenting with F#/Expecto and using Visual Studio as my IDE. I've created a test project that references Expecto and Expecto.VisualStudio.Adapter. It has a test case defined in it, but Visual Studio's test runner fails to pick it up.
The test project contains these files:
MyCompany.Message.FSharp.Tests.fsproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tests.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Expecto" Version="7.0.0" />
<PackageReference Include="Expecto.VisualStudio.TestAdapter" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MyCompany.Message.FSharp\MyCompany.Message.FSharp.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.3.4" />
</ItemGroup>
</Project>
Tests.fs
module Tests
open MyCompany.Message
open Expecto
[<Tests>]
let tests =
testCase "message should return size of payload in bytes" <| fun () ->
let message = create 0x1 [1uy; 2uy; 3uy]
Expect.equal 3 (size message) "unexpected message size"
Program.fs
module Program = let [<EntryPoint>] main _ = 0
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net47</TargetFramework>
test with my test branch
[1/22/2018 3:36:26 PM Informational] Running all tests (9999.0.0.0)
[1/22/2018 3:36:26 PM Informational] Creating test host for E:\GitRepos\PersonalServer\tests\PersonalServer.Tests\bin\Debug\net47\PersonalServer.Tests.exe
[1/22/2018 3:36:26 PM Informational] Executing tests in assembly E:\GitRepos\PersonalServer\tests\PersonalServer.Tests\bin\Debug\net47\PersonalServer.Tests.exe
[1/22/2018 3:36:26 PM Error] System.MissingMethodException: Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption`1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1<Int32>, Boolean)'.
at Execution.ExecuteProxy.ExecuteTests()
at Execution.ExecuteProxy.ExecuteTests()
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](Unit unitVar)
at [email protected](AsyncParams`1 args)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a](CancellationToken token, FSharpAsync`1 computation)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at Execution.ExpectoTestExecutor.runAllExecutors()
at Execution.ExpectoTestExecutor.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestExecutor-RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
[1/22/2018 3:36:26 PM Warning] No test is available in E:\GitRepos\PersonalServer\tests\PersonalServer.Tests\bin\Debug\net47\PersonalServer.Tests.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
I have the tests annotated and the ``paket packages referenced in my project. Running discover tests creates some noise on the output and ceases with:
[11/14/2017 2:26:04 PM Informational] ------ Discover test started ------
[11/14/2017 2:27:31 PM Error] 'vstest.discoveryengine.x86.exe' WCF communication channel unavailable. Active request will be aborted.
This is on VS 2017 15.4.4
After Upgrading to latest Expecto I was greeted with the following error
2019-04-18 12:20:32 Error] System.MissingMethodException: Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption`1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpOption`1<System.String>, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1<Int32>, Boolean, Boolean, Boolean)'.
at Execution.ExecuteProxy.ExecuteTests()
at Execution.ExecuteProxy.ExecuteTests()
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](Unit unitVar)
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.FSharp.Control.AsyncResult`1.Commit()
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation)
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at Execution.ExpectoTestExecutor.runAllExecutors()
at Execution.ExpectoTestExecutor.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestExecutor-RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
https://www.nuget.org/packages/Expecto/8.10.0
Downgrading to < 8.10
(= 8.9.1) helped
using VS2017
Expecto.VisualStudio.TestAdapter 5.0.1
VS 2017 15.5.2
Test with https://github.com/jackfoxy/PersonalServer master commit 36901bf
Test window loads with tests successfully, but running any test throws:
System.MissingMethodException: Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption`1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1<Int32>, Boolean)'.
at Execution.ExecuteProxy.ExecuteTests()
at Execution.ExecuteProxy.ExecuteTests()
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](Unit unitVar)
at [email protected](AsyncParams`1 args)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a](CancellationToken token, FSharpAsync`1 computation)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at Execution.ExpectoTestExecutor.runAllExecutors()
at Execution.ExpectoTestExecutor.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestExecutor-RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
I think the problem might be a missing reference to Microsoft.VisualStudio.TestPlatform.ObjectModel 11.0.0.0
I'm trying to use the test adaptor as it'd be great to use Expecto more. I don't seem to be able to use the test
to create simple cases.
open Expecto
[<Tests>]
let tests =
testList "samples" [
testCase "universe exists" <| fun _ ->
let subject = true
Expect.isTrue subject "I compute, therefore I am."
test "A simple test" {
let subject = "Hello World"
Expect.equal subject "Hello World" "The strings should equal"
}
testCase "After a simple test" <| fun _ ->
let subject = true
Expect.isTrue subject "Not seen."
]
[<EntryPoint>]
let main args =
runTestsWithArgs defaultConfig args tests
Leads to the the simple test
and subsequent testCase
not being displayed.
The tests are being run from the log though:
[2017-11-08 16:56:11 Informational] ------ Run test started ------
[2017-11-08 16:56:12 Informational] Running all tests (9999.0.0.0)
[2017-11-08 16:56:12 Informational] Creating test host for #####\Testy\Testy\bin\Debug\Testy.exe
[2017-11-08 16:56:12 Informational] Executing tests in assembly #####\Testy\Testy\bin\Debug\Testy.exe
[2017-11-08 16:56:12 Informational] Executing all tests in #####\Testy\Testy\bin\Debug\Testy.exe
[2017-11-08 16:56:12 Informational] All tests: 3
[2017-11-08 16:56:12 Informational] Number of tests included: 3
[2017-11-08 16:56:12 Informational] starting 'samples/universe exists'
[2017-11-08 16:56:12 Informational] starting 'samples/After a simple test'
[2017-11-08 16:56:12 Informational] starting 'samples/A simple test'
[2017-11-08 16:56:12 Informational] summary {results =
[({name = "samples/universe exists";
test = Sync <fun:tests@7>;
state = Normal;
focusOn = false;
sequenced = InParallel;}, {result = Passed;
count = 1;
meanDuration = 3.0;
maxDuration = 3.0;
totalVariance = 0.0;});
({name = "samples/A simple test";
test = Sync <fun:tests@12-1>;
state = Normal;
focusOn = false;
sequenced = InParallel;}, {result = Passed;
count = 1;
meanDuration = 5.0;
maxDuration = 5.0;
totalVariance = 0.0;});
({name = "samples/After a simple test";
test = Sync <fun:tests@16-34>;
state = Normal;
focusOn = false;
sequenced = InParallel;}, {result = Passed;
count = 1;
meanDuration = 3.0;
maxDuration = 3.0;
totalVariance = 0.0;})];
duration = 00:00:00.1374515;
maxMemory = 0L;
memoryLimit = 0L;
timedOut = [];}
[2017-11-08 16:56:12 Error] Test adapter sent back a result for an unknown test case. Ignoring result for 'samples/After a simple test'.
[2017-11-08 16:56:12 Error] Test adapter sent back a result for an unknown test case. Ignoring result for 'samples/A simple test'.
[2017-11-08 16:56:12 Informational] ========== Run test finished: 1 run (0:00:01.021702) ==========
I tried building from master but had the same missing tests:
Tests are discovered, but an unexpected error occurs when trying to run them.
The tests run fine from the command line.
Adapter was working fairly recently, but started doing this instead after I added some new tests. Removing the tests again did not restore test-running behavior.
[2/14/2018 11:37:19 AM Informational] ------ Load Playlist started ------
[2/14/2018 11:37:19 AM Informational] ========== Load Playlist finished (0:00:00.0110259) ==========
[2/14/2018 11:37:20 AM Informational] ------ Discover test started ------
[2/14/2018 11:37:23 AM Informational] ========== Discover test finished: 2 found (0:00:02.9418203) ==========
[2/14/2018 11:37:31 AM Informational] ------ Run test started ------
[2/14/2018 11:37:32 AM Informational] Running all tests (9999.0.0.0)
[2/14/2018 11:37:32 AM Informational] Creating test host for C:\Code\pos-mapping-service\PosMappingService.Data\tests\bin\Debug\PosMappingService.Data.Tests.exe
[2/14/2018 11:37:32 AM Informational] Creating test host for C:\Code\pos-mapping-service\PosMappingService.Web\tests\bin\Debug\PosMappingService.Web.Tests.exe
[2/14/2018 11:37:33 AM Informational] Executing tests in assembly C:\Code\pos-mapping-service\PosMappingService.Web\tests\bin\Debug\PosMappingService.Web.Tests.exe
[2/14/2018 11:37:33 AM Informational] Executing tests in assembly C:\Code\pos-mapping-service\PosMappingService.Data\tests\bin\Debug\PosMappingService.Data.Tests.exe
[2/14/2018 11:37:33 AM Error] System.MissingMethodException: Method not found: 'Boolean ExpectoConfig.get_allowDuplicateNames()'.
at Execution.ExecuteProxy.ExecuteTests()
at Execution.ExecuteProxy.ExecuteTests()
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](Unit unitVar)
at [email protected](AsyncParams`1 args)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a](CancellationToken token, FSharpAsync`1 computation)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at Execution.ExpectoTestExecutor.runAllExecutors()
at Execution.ExpectoTestExecutor.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestExecutor-RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
[2/14/2018 11:37:33 AM Warning] No test is available in C:\Code\pos-mapping-service\PosMappingService.Data\tests\bin\Debug\PosMappingService.Data.Tests.exe C:\Code\pos-mapping-service\PosMappingService.Web\tests\bin\Debug\PosMappingService.Web.Tests.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[2/14/2018 11:37:33 AM Informational] ========== Run test finished: 0 run (0:00:01.5817122) ==========
When you double click on a test case in the Test Explorer, Visual Studio 2015 navigates to that test case. This no longer works in 2017. Instead, the following error is shown on the status bar: "Cannot open the following file: [...]."
Hi,
I addedd it through nuget Expecto.VisualStudio.TestAdapter version_in_path: true
paket install
,
This installs Expecto.VisualStudio.TestAdapter (1.0.0-alpha005) - version_in_path: true
and then restart Visual Studio.
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01055
I can open Test-Explorer bun none of my Expecto tests are discovered.
It's not that I really wonder about something in Visual Studio is not working,
but it would be nice if it would.
Reproducible in the "testadapter" branch of https://github.com/jackfoxy/personalServer
Visual Studio test discovery results in message (See output window, Tests):
'vstest.discoveryengine.x86.exe' WCF communication channel unavailable. Active request will be aborted.
Cause: appears to be problem with passing types in the FsCheckConfig.arbitrary field
Reproduction steps:
File: PersonalServer\tests\PersonalServer.Tests\DomainTypes.fs
At top of file is FsCheckConfig binding both with and without setting arbitrary list. Setting the list causes discovery to fail.
It seems like this one has popped up and been fixed before.
Executing tests in assembly E:\GitRepos\DependentTypes\tests\DomainLib.Tests\bin\Debug\net472\DomainLib.Tests.exe
[9/30/2018 12:28:16 PM Error] System.MissingMethodException: Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption`1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpOption`1<System.String>, Microsoft.FSharp.Core.FSharpFunc`2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1<Int32>, Boolean, Boolean)'.
at Execution.ExecuteProxy.ExecuteTests()
at Execution.ExecuteProxy.ExecuteTests()
at <StartupCode$Expecto-VisualStudio-TestAdapter>[email protected](Unit unitVar)
at [email protected](AsyncParams`1 args)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a](CancellationToken token, FSharpAsync`1 computation)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at Execution.ExpectoTestExecutor.runAllExecutors()
at Execution.ExpectoTestExecutor.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestExecutor-RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
building with dotnet\sdk\2.1.500-preview-009297
test exe is net472
Expecto adapter version 9
VS 15.9.0 Preview 2.0 or VS 15.8.5
Reproduction steps:
clone this commit of DependentTypes
jackfoxy/DependentTypes@6474cf9
Do test discovery and run all tests.
I need to coordinate a release for haf/expecto#224. Can you let me know when you would be in a position to do a joint release.
To reproduce, use my project https://github.com/jackfoxy/PSlogger
Checkout initial commit in master branch. (I will be making more commits, and the initial commit is quite simple, with only one test in one test list.)
Attempting test discovery results in:
[8/24/2017 12:35:06 PM Informational] ------ Discover test started ------
[8/24/2017 12:35:07 PM Error] System.Reflection.TargetParameterCountException: Parameter count mismatch.
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at [email protected](a focusedState)
at Microsoft.FSharp.Core.OptionModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpOption`1 option)
at Expecto.Impl.testFromMember(MemberInfo mi)
at [email protected](MemberInfo mi)
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@165.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
at [email protected](Type t)
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@165.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
at Expecto.Impl.testFromAssemblyWithFilter(FSharpFunc`2 typeFilter, Assembly a)
at [email protected](Assembly a)
at Discovery.DiscoverProxy.DiscoverTests(String source)
at Discovery.DiscoverProxy.DiscoverTests(String source)
at Discovery.Discoverer.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestDiscoverer-DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
[8/24/2017 12:35:07 PM Informational] ========== Discover test finished: 0 found (0:00:00.7190687) ==========
Error Unable to resolve dependencies. 'Newtonsoft.Json 11.0.2' is not compatible with 'Expecto.VisualStudio.TestAdapter 10.0.1 constraint: Newtonsoft.Json (>= 10.0.0 && < 11.0.0)'.
Hi, would it be possible to add support for more recent versions of Newtonsoft.Json to the nuget dependencies? 11.X, which came out last February, and perhaps the more recent 12.X?
https://github.com/JamesNK/Newtonsoft.Json/releases
Cheers
Having this code:
open Expecto
open System
open System.Threading
open System.IO
[<Tests>]
let tests =
testList "Simple tests" [
test "Simple" { Expect.containsAll [0; 1; 3; 2] [1; 2] "foo" }
testCase "One" <| fun _ -> Expect.equal (1 + 1) 2 (sprintf "%d + %d = %d" 1 1 2)
test "Perf" {
Expect.isFasterThan (fun () -> Thread.Sleep 90) (fun () -> Thread.Sleep 100) "Perf"
}
test "Perf" {
Expect.isFasterThan
<| fun _ -> [1..1000] |> List.sortDescending |> ignore
<| fun _ -> [|1..1000|] |> Array.sortDescending |> ignore
<| "Sorting lists is faster than sorting arrays?"
}
test "t" {
Expect.throwsT<FileNotFoundException>
<| fun _ -> raise (FileNotFoundException())
<| "wow"
}
]
[<EntryPoint>]
let main argv =
runTestsWithArgs defaultConfig argv tests |> ignore
Console.ReadKey() |> ignore
0
The result is somewhat confusing:
after running a single test, it vanishes
[9/13/2018 1:34:16 PM Informational] ------ Discover test started ------
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/unfocused list/skipped' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/unfocused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Informational] ========== Discover test finished: 8 found (0:00:01.5445998) ==========
[9/13/2018 1:34:28 PM Informational] ------ Discover test started ------
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/unfocused list/skipped' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/unfocused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Informational] ========== Discover test finished: 8 found (0:00:00.6426964) ==========
[9/13/2018 1:34:29 PM Informational] ------ Run test started ------
[9/13/2018 1:34:29 PM Informational] Running selected tests
[9/13/2018 1:34:29 PM Informational] Executing tests in assembly C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe
[9/13/2018 1:34:30 PM Informational] Executing tests from: C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe. 1 tests (unfocused list/focused list/will run)
[9/13/2018 1:34:30 PM Informational] All tests: 8
[9/13/2018 1:34:30 PM Informational] Number of tests included: 3
[9/13/2018 1:34:30 PM Informational] ========== Run test finished: 0 run (0:00:00.6765898) ==========
[9/13/2018 1:37:09 PM Informational] ------ Discover test started ------
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/unfocused list/skipped' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/unfocused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Informational] ========== Discover test finished: 8 found (0:00:00.9541923) ==========
[9/13/2018 1:39:03 PM Informational] ------ Run test started ------
[9/13/2018 1:39:03 PM Informational] Running selected tests
[9/13/2018 1:39:04 PM Informational] Executing tests in assembly C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe
[9/13/2018 1:39:04 PM Informational] Executing tests from: C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe. 1 tests (unfocused list/focused list/will run)
[9/13/2018 1:39:04 PM Informational] All tests: 8
[9/13/2018 1:39:04 PM Informational] Number of tests included: 3
[9/13/2018 1:39:04 PM Informational] ========== Run test finished: 0 run (0:00:00.4897678) ==========
I have only two files after creating a new project targeting 4.6.2
module ConversionsTests
open Expecto
[<Tests>]
let focusedTests =
testList "unfocused list" [
ftestList "focused list" [
testCase "will run" <| fun () -> Expect.equal (2+2) 4 "2+2"
ftestCase "will run" <| fun () -> Expect.equal (2+2) 4 "2+2"
test "will run" { Expect.equal (2+2) 4 "2+2" }
]
testList "unfocused list" [
testCase "skipped" <| fun () -> Expect.equal (2+2) 1 "2+2?"
ftestCase "will run" <| fun () -> Expect.equal (2+2) 4 "2+2"
test "skipped" { Expect.equal (2+2) 1 "2+2?" }
ftest "will run" { Expect.equal (2+2) 4 "2+2" }
]
testCase "skipped" <| fun () -> Expect.equal (2+2) 1 "2+2?"
]
and Program.fs
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open System
open Expecto
let tests =
test "A simple test" {
let subject = "Hello World"
Expect.equal subject "Hello World" "The strings should equal"
}
[<EntryPoint>]
let main args =
let result = runTestsWithArgs defaultConfig args tests
Console.ReadLine() |> ignore
result
if I rebuild the test project the test reappears.
Hello,
thanks for offering the software,
I followed the installation instructions but VS can't find my expecto tests,
It Ok that it is not working,
but it would be helpul to have the requirements in the README.
This is the message i got
[4/20/2019 11:58:47 PM Informational] Executing all tests in project(s): checkerTests
[4/20/2019 11:58:47 PM Informational] No tests found to run.
here is my paket setup
23> Get-Content ..\..\paket.dependencies
source https://www.nuget.org/api/v2
nuget Expecto.FsCheck
nuget Expecto.VisualStudio.TestAdapter version_in_path: true
nuget Argu
nuget Unquote
nuget FSharp.Core
group Build
source https://api.nuget.org/v3/index.json
nuget FAKE
24> Get-Content .\paket.references
Expecto.FsCheck
Unquote
Expecto.VisualStudio.TestAdapter
25> dir
Verzeichnis: C:\scripts2\checker\src\checkerTests
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 20.04.2019 12:05 bin
d----- 20.04.2019 23:43 obj
-a---- 20.04.2019 11:48 574 checkerTests.fsproj
-a---- 20.04.2019 11:48 402 fileTests.fs
-a---- 20.04.2019 11:48 119 Main.fs
-a---- 20.04.2019 12:42 60 paket.references
-a---- 20.04.2019 12:04 409 regexTests.fs
-a---- 20.04.2019 11:48 405 subtitleTests.fs
26> ..\..\.paket\paket.exe install
Paket version 5.203.2
Skipping resolver for group Build since it is already up-to-date
Skipping resolver for group Main since it is already up-to-date
C:\scripts2\checker\paket.lock is already up-to-date
Installing into projects:
- Creating model and downloading packages.
- Installing for projects
- src/check/paket.references -> src/check/check.fsproj
- src/checker/paket.references -> src/checker/checker.fsproj
- src/checkerTests/paket.references -> src/checkerTests/checkerTests.fsproj
Performance:
- Disk IO: 53 milliseconds
- Runtime: 1 second
27> ..\..\.paket\paket.exe show-installed-packages
Paket version 5.203.2
Build FAKE - 5.8.4
Main Argu - 5.2
Main Expecto.FsCheck - 8.10.1
Main Expecto.VisualStudio.TestAdapter - 10.0.2
Main FSharp.Core - 4.6.2
Main Unquote - 4.0
Performance:
- Runtime: 573 milliseconds
28> ..\..\.paket\paket.exe --version
Paket version 5.203.2
# vs studio verion info
Microsoft Visual Studio Enterprise 2019
Version 16.0.2
VisualStudio.16.Release/16.0.2+28803.202
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Enterprise
NuGet Package Manager 5.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Can I check what happens with netstandard assemblies with tests that are used in an entrypoint netcoreapp?
It looks like you are running tests using the adapters app?
If you look at the story here for xunit it gets complicated:
https://twitter.com/ExpectoIO/status/953194299872735233
It seem that as soon as one FSCheck (testProperty
) case is used no tests are found in the assembly by visual studio anymore.
That what I get in Output:
------ Discover test started ------
System.MissingMethodException: Method not found: "Microsoft.FSharp.Core.FSharpFunc`2<Expecto.Test,System.Collections.Generic.IEnumerable`1<System.Tuple`3<System.String,Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit>,Expecto.FocusState>>> Expecto.TestModule.get_toTestCodeList()".
в Discovery.DiscoverProxy.DiscoverTests(String source)
в Discovery.DiscoverProxy.DiscoverTests(String source)
в Discovery.Discoverer.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestDiscoverer-DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
========== Discover test finished: 0 found (0:00:00,1572098) ==========
Couldn't figured out by myself how to solve the problem. :c
You need to use nuget package manager however most F# projects will want to use paket.
Is it possible to make this not require nuget package manager?
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.