简体   繁体   English

如何在DUnitX中启用StackTrace?

[英]How to enable StackTrace in DUnitX ?

I have Delphi Seattle in place and I'm using DUnitX as my test framework. 我有Delphi Seattle,我正在使用DUnitX作为我的测试框架。 I noticed that it may have support for stacktrace. 我注意到它可能支持stacktrace。 But I found no example or documentation about it. 但我没有找到关于它的示例或文档。 I found an inc file (DUnitX.Stacktrace.inc) where I can configure what I want to use as stacktrace provider. 我找到了一个inc文件(DUnitX.Stacktrace.inc),我可以在其中配置我想用作st​​acktrace提供程序的内容。 But, as I will not recompile it, because it comes along with Delphi. 但是,因为我不会重新编译它,因为它与Delphi一起出现。

How the best approach to enable it now ? 现在最好的方法是如何启用它? When I have an error on tests setup etc. Will I get by default the stacktrace as well ? 当我在测试设置等方面出错时,我是否会默认获得堆栈跟踪?

Copy the inc file into project folder, apply your changes and include it explicitly: 将inc文件复制到项目文件夹中,应用更改并明确包含它:

{$I DUnitX.Stacktrace.inc}

Actually you don't have to reference it directly (Delphi will search in project folder first anyway). 实际上你不必直接引用它(无论如何,Delphi将首先在项目文件夹中搜索)。 Look at DUnitXTest.dproj for example (comes with Delphi in DUnitX\\Tests folder). 以DUnitXTest.dproj为例(在DUnitX \\ Tests文件夹中附带Delphi)。 But i believe it is better to keep things obvious. 但我相信保持显而易见更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM