Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit.TestRunner - Run UnitTests in Revit

7 REPLIES 7
Reply
Message 1 of 8
tobias.floescher
730 Views, 7 Replies

Revit.TestRunner - Run UnitTests in Revit

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

7 REPLIES 7
Message 2 of 8
josy
in reply to: tobias.floescher

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)?

 

 

Message 3 of 8

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

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 8
tobias.floescher
in reply to: josy

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

Message 5 of 8

Hi Jeremy

 

Would be great if you share it on your blog!

I feel honored, thanks a lot.

 

Cheers tobias

Message 6 of 8

Message 7 of 8

thank you very much, Jeremy.
(also to correct my terrible English ;))

Message 8 of 8

All thanks to you!

 

You English is perfectly fine, very minor corrections only!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community