How to create unit testing for AutoCAD add-in?

How to create unit testing for AutoCAD add-in?

info
Contributor Contributor
1,948 Views
2 Replies
Message 1 of 3

How to create unit testing for AutoCAD add-in?

info
Contributor
Contributor

Hi,

We are trying to implement the Unit test to our AutoCAD plugin with Gallio.
We are using the following document to achieve this
https://studylib.net/doc/9727932/automated-testing-with-the-autocad-%C2%AE-.net-api
But we are still not able to create the unit test for AutoCAD add-in.

We have attached the word document with error detail and sample code file that we have used. Please guide us, if we miss anything.

Is there any other way to achieve this?

 

0 Likes
1,949 Views
2 Replies
Replies (2)
Message 2 of 3

Norman_Yuan
Mentor
Mentor

You did not mention your test project setup, so the error message you provided does not help very much here, but it seems to me, if the the code being tested refers to any AutoCAD .NET API, the test project must be hosted and run in the AutoCAD process (thus, the test is really not a "unit test", but a "integration test"). For AutoCAD add-in, only the code that have nothing to do with AutoCAD can be unit-tested, which makes the add-in coding quite difficult, tedious, sometimes not worth it. To test any method that touches AutoCAD .NET API, one can only do integration test (i.e. the test code must be loaded into AutoCAD as a "testing add-in" and run inside AutoCAD).

 

No sure if you have already read this vey helpful/informative article:

 

https://studylib.net/doc/9727932/automated-testing-with-the-autocad-%C2%AE-.net-api 

 

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3

CADbloke
Advocate
Advocate

Have a look at https://github.com/CADbloke/CADtest - I wrote it years ago and haven’t used it much lately but it should give you an idea of how to make it work, or just use it. 

- - - - - - -
working on all sorts of things including www.tvCAD.tv & www.CADreplace.com