haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
663 stars 96 forks source link

No source locations for test theories in the Visual Studio test explorer #487

Open Numpsy opened 3 months ago

Numpsy commented 3 months ago

Hi,

I've seen similar issues with Ionide in the past, and am not really sure if there is an issue in Expecto itself of in the YoloDev test adaptor, but - in reference to https://github.com/YoloDev/YoloDev.Expecto.TestSdk/issues/107#issuecomment-1976249759

If I have an expecto test project with a theory test, and I run if via the Visual Studio (2022) test explorer, then all the test results are shown but there is no source locaion available:

image

I've tried debugging some of Expectos own tests, and I notice that the getLocation function isn't returning anything for test theories, even though the input appears to have the appropriate information inside it: image

I haven't gone any further with debugging than that yet - thought I'd enquire and see what the expected situation is first?

Numpsy commented 3 months ago

As the linked YoloDev issue says, testTasks are also missing source information, but in that case it seems to get to https://github.com/haf/expecto/blob/9fe60dc25d2dedb20f0dfcf4a0358d936b4eb50f/Expecto/Expecto.Impl.fs#L976 as an Async case and exits without trying to get further information

farlee2121 commented 3 months ago

Hmm. I haven't worked with this part of the code base yet. I don't have any prior knowledge to bring to the table here.

Have you found a particular place where getLocation is falling back to SourceLocation.empty for thestTheory? That might give some hints about what's going wrong

Numpsy commented 3 months ago

Looks like it gets to https://github.com/haf/expecto/blob/9fe60dc25d2dedb20f0dfcf4a0358d936b4eb50f/Expecto/Expecto.Impl.fs#L1010 and then getFirstOrDefaultSequencePoint doesn't find any results

farlee2121 commented 3 months ago

The where clause is looking for methodName. Is it looking for the right method name?
That could be a good indicator of what threads to pull on

Numpsy commented 3 months ago

It seems to be looking for 'Invoke': image

It does get into getFirstOrDefaultSequencePoint, but then there are no sequence points found