specklesystems / xUnitRevit

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

How to get it running? #37

Closed andreaslennartz closed 6 months ago

andreaslennartz commented 7 months ago

Hi Team,

thanks for creating and sharing the xunit test runner framework for Revit. I think I followed each step in your documentation as described. (Though I still feel that some things are missing in the instructions). However, the add-in is installed, it shows up in Revit, and I am also able to build the sample test project. In Revit, the main window of the Test Runner add-in opens up, but unfortunately, I am not able to do something meaningful here. I tried to add different test assemblies, but nothing happened. It basically stays blank. I went through the past issues, and I tried it with previous versions of the test runner and xunit, but without success. Any ideas what I could be doing wrong?

Also, I have another question: Is it possible to run a test in "Debug" mode? So that I could set a breakpoint in Visual Studio when running a test, and that the breakpoint would be hit?

Thanks for your support,

Andreas

agnBIM commented 7 months ago

Hi Andreas, you could attach to the Revit process, with your VS. You will then hit a breakpoint when running a test. That wont help you if your tests are not discovered. If thats your problem, you could attach to the process from the xUnitRevit project in VS, but in my experience you get stuck there in decompiled code from xunit itself. Did you try and older version of xunit, as suggested here: #33? Good Luck, Gerrit

Mehdi-Lucas commented 6 months ago

Hi @andreaslennartz, as suggested by @agnBIM you can use an older version or there is a way to use the newest version that I just posted here .

Hope this helps you :)

andreaslennartz commented 6 months ago

@agnBIM @Mehdi-Lucas Thanks a lot for your suggestions. I actually tried it again using the update version provided by @Mehdi-Lucas . Here are the steps that I need to do - perhaps anyone can spot what I did wrong?

image

Whatever I do, it seems that the "Open" button in the UI has no effect. I can't see any exception message nor does something happen. Any ideas what I am doing wrong or what am I missing?

Mehdi-Lucas commented 6 months ago

@andreaslennartz Based on what you've written, it seems likely that step 2 is causing the issue. If you clone the speckle.xunit.runner.wpf from the Speckle repository, it includes version 2.4, which can lead to uncompatibility with the newer version.

My repo xUnitRevit should reference an updated speckle.xunit.runner.wpf here https://github.com/Mehdi-Lucas/speckle.xunit.runner.wpf but noramlly you shouldn't even have to clone the second repo. Once you got xUnitRevit from my updated repo everything should be referenced correctly and set up for a smooth build.

In visual studio Ensure that all your repositories are referencing the updated version (2.7.0) everywhere (even for speckle.xunit.runner.wpf).

Two other individuals have confirmed success by following this approach today. Just some had trouble with the autocopy after the build so In case the built files aren't copied automatically to the Revit Addin folder, you might need to do it manually.

teocomi commented 6 months ago

Hey guys, sorry we're a bit silent here - we're in the midst of a release and will try to provide some support soon!

PS Thanks @Mehdi-Lucas for the helpful comments

andreaslennartz commented 6 months ago

@Mehdi-Lucas Yes, you were right - Step 2 was the issue. Thanks for pointing this out, and also providing such a detailled description! Now it worked directly as expected, even with the SampleLibrary project. Awesome! I attached the debugger to the WPF window, and I was even able to debug into the tests itself, which is great.

I have one additional question: Is there are way to load and run the tests via command line (e.g. dotnet test or something else) while Revit is open? I know that the Revit API only can be accessed if Revit is running , so the question is if there is a way to get some test automation set up using this project?

Thanks for your support, I appreciate your time!

Mehdi-Lucas commented 6 months ago

@andreaslennartz Awesome, I'm glad to hear that it's working for you now. Happy testing!

@teocomi Sure, understandable and there is no rush. if it can help you guys I can open a PR to update everything to xunit 2.7.0 (unless you want to stay on 2.4 for some reason). This way, individuals starting with this tool, who likely build their test libraries using the latest xunit version, won't be confused by any issues.

teocomi commented 6 months ago

Thanks for the offer! I'll defer to @connorivy and @BovineOx :)