DynamoDS / RevitTestFramework

Unit Testing on Revit
124 stars 81 forks source link

DO NOT MERGE: Enable transaction and run the test cases when the application is idle #3

Closed Randy-Ma closed 10 years ago

Randy-Ma commented 10 years ago

@ikeough

This submission enables transaction and also run the test cases when the application is idle. Originally the application along with the test cases are running in the main thread. As a result, the test environment is not the same as the environment when the application is used. This causes the possibility that the tests are not catching some issues in the application. Also in the case that the transaction manager is not used, a small warning or error that happens will block the test. There is a known issue for this: MAGN-4163.

This submission runs the test cases when the application is idle. A watching thread is started to monitor whether the test cases are completed. If so, it will shutdown the application. To prevent the application to be closed by the journaling script, the part which is to close the application is removed.

Currently System.Windows.Application.Current.Shutdown() is used to close the application. This is not perfect. But until a better API is found, this is the only choice.

ikeough commented 10 years ago

@Randy-Ma Very excited to get the first pull request for RTF!

Randy-Ma commented 10 years ago

@ikeough

You are right that the outer process will kill the one with a dialog. For the second one, System.Windows.Application.Current.Shutdown() will cause a hard shutdown. That is why I am saying it is not so good.

There are actually some APIs to shutdown Revit nicely but the problem is that it only works in the main thread. But I can not do this in the main thread because at that time I can not ensure the idle tasks are done.

Randy-Ma commented 10 years ago

@ikeough

I need some more considerations about this. Maybe for now I will just make transactions work.