Hello Developers,
In 2018 I start to program in Revit API environment. It was completely new to me, so I had to get familiar with the API and its peculiarities. I found the blog of @jeremytammik , which helped me a lot.
We insourced an addin, which was developed by an external company. The hole code lives in an assembly which references the Revit API. Then I realized, testing is hard. I refactured the code, that it was as much as possible independent from the Revit API. This Code was testable as I knew it, tests run on Contiguous Integration. But a lot of Code lasts on the Project referenced to Revit API.
I asked google what to do, but apparently there is not THE way how you solve this problem.
There is some stuff around (ex. RevitTestFramework) which seems cool, but I was not happy with it. At least all I found uses NUnit 2.6. But all my Revit independent Code is tested by the NUnit 3.x. The build server doesn’t like the mix.
As result, I started to write my own TestRunner using NUnit 3. It is far away from perfect, nevertheless I would like to share it with the community.
Please have a look at https://github.com/geberit/Revit.TestRunner
Features so far:
* Using NUnit 3
* No reference to Revit.TestRunner needed in test assembly
* Support of NUnit attributes SetUp and TearDown
* Injection of API objects in test method
* Works as an addin with GUI
* Installation script for libraries
* Post build event in VS project to place addin file
Feedback welcome
Tobias - Geberit Verwaltungs AG
Hi!
Nice work!
I've experimented with RevitTestFramework back in the days and found it interesting when I tested it. It used revit journals to start revit automatically and run the test but it often crashed for some reason. I would be great to get this to work in a CI-workflow.
Have you investigated the possibility to get this automated with Forge (https://forge.autodesk.com/blog/design-automation-revit-public-beta-here)?
Dear Tobias,
Thank you for your appreciation.
At first glance, this looks utterly beautiful!
I will give it a go asap!
Thank you ever so much for sharing this!
I will very gladly share it on the blog as well, if I may.
Thank you!
Cheers,
Jeremy
Hi Josy
Thanks! No I haven’t investigated with Forge at this time. But I think it could be a very cool solution, especially our build servers are build agents in azure where we don’t have any access to install something (ex. Revit).
tobias
Hi Jeremy
Would be great if you share it on your blog!
I feel honored, thanks a lot.
Cheers tobias
Cool!
How do you like it?
https://thebuildingcoder.typepad.com/blog/2019/10/testrunner-run-unit-tests-in-revit.html
All thanks to you!
You English is perfectly fine, very minor corrections only!
Can't find what you're looking for? Ask the community or share your knowledge.