DUnit: How to run tests?

会有一股神秘感。 提交于 2019-12-05 01:34:55
Brian Frost

I agree with Uwe Raabe, but sometimes it can be useful to have a 'hidden' link within your app to run the DUnit GUI. I use:

TGUITestRunner.runRegisteredTests;

Call this from your button at the DUnit GUI will open for you to manually run and view test output.


For example, if you hold down a special key combination when opening the software's own "Control Panel", you get some advanced entries:

Adding a TestCase to the main project is not the way to go. You should create a separate TestProject (you can have it in the same ProjectGroup as the main project), add a TestCase and run.

I like the idea of having a 'Run DUnit tests' command in the IDE.

It could be implemented by checking for a DUnit project in the same folder, having the same name as the current project:

  • Project1.dpr -> the software under test
  • Project1.Tests.dpr => the DUnit test app

In this case, the IDE should enable the Run DUnit tests command.

  • After executing the tests, a list of all failed tests should be displayed which allows to jump to the source line where a test failed.

  • If tests caused memory leaks, a list of all leaks should be displayed which allows to jump to the source line where the memory leak has been created

(DUnit can be configured to detect memory leaks and fail tests when one has been found)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!