specklesystems / xUnitRevit

xUnit runner for Revit
https://speckle.systems/blog/xunitrevit/
MIT License
114 stars 40 forks source link

No test show up after loading a test assembly #33

Open andrsbtrg opened 1 year ago

andrsbtrg commented 1 year ago

Prerequisites

What package are you referring to?

xUnitRevit

Describe the bug

I was hoping that you could help me with this issue: I cloned and built xUnitRevit the add-in for Revit 2022 I tried to create a sample test assembly to load on the plug in and run.

The bug is: I can load the .dll inside xUniRevit but I see no test cases.

I tried with the SampleLibrary provided in the repo, as well with creating a new project tagetting .NET Framework 4.8 and basically copying one test inside a class.

image

To Reproduce

Launch Revit

(No document is open)

Go to Add-ins tab, launch Test Runner

Assembly -> Open -> Go to \xUnitRevit\SampleLibrary\bin\Debug\SampleLibrary.dll

Expected behavior

Some test cases would show on the window.

Screenshots

System Info

If applicable, please fill in the below details - they help a lot!

Desktop (please complete the following information):

Additional context

Proposed Solution (if any)

Optional: Affected Projects

PhanCongVuDuc commented 10 months ago

me too, but nobody support it

teocomi commented 10 months ago

This usually happens if some unnecessary dlls end up in the library folder (eg the RevitAPI.dll) @connorivy might have more insights!

agnBIM commented 8 months ago

This could also be due to the newest nuget version of xunit. I experienced the same behaviour when using the nuget package 2.5.3 of xunit.

There is probably some bug while discovering tests by the xunitRevitRunner with the newer versions.

Switching back to 2.4.2 solves the problem.

Mehdi-Lucas commented 7 months ago

Thanks, @agnBIM, for the helpful tip! Upon further investigation, I delved deeper into resolving the compatibility issue with the latest version of xUnit. It turned out that the problem didn't lie in the newest xUnit version itself. Instead, it occur when different versions of xUnit were utilized within both the Addin and the user tests library.

To overcome this, I updated all xUnit package references to the latest version (2.7.0 as of today) in my local repository (all projects/solutions has to be updated!), which I cloned from here. After updating the references, I rebuilt the solutions to ensure the copy of the new Addin files.

image

Since implementing these changes, everything has been functioning seamlessly. The addin now successfully discovers and displays custom tests libraries referencing xUnit 2.7.0

image

Additionally, I've forked the repository and made the necessary updates to xUnit 2.7.0. Anyone can feel free to clone it and build your addin with if you don't want to do the change yourself : https://github.com/Mehdi-Lucas/xUnitRevit For the rest just follow the same instructions as usual.

I'm relatively new to using this tool, and it's possible that the Speckle team hasn't upgraded to a newer version for a specific reason, possibly due to a bug unknow to me so proceed with caution. I just hope this tool is still supported, it seems pretty usefull.