santiago 36 Posted January 31, 2020 Hello, In DUnit we make heavy use of dynamic Tests. For example, we have a test that loads a file from disk and performs some actions. All of the files are kept in a directory. The TestSuite is built at runtime by searching for all relevant files. For each file a Test is displayed in the Test Runner. This is very handy when you want to test/debug just one specific file. The alternative would be to have a single Test, such as TestAllFilesOfTypeXx... But then it is not straightforward at all to troubleshoot a specific case. Share this post Link to post
Stefan Glienke 2009 Posted February 3, 2020 Yes but the real question is: why do you want to switch to DUnitX when you have working DUnit tests already? 1 Share this post Link to post
santiago 36 Posted February 3, 2020 @Stefan Glienke These are the main pain points with DUnit: Viewer has no filter functionality. When you have hundreds of tests, you have to scroll until you find the test you would like to execute. Viewer is not DPI aware. Seems to be no longer mantained. Lack of test categories. We would like to be able to specify which test categories to run. Normally you don't want to run all test while developing. DUnitX seems to already have most features. Its open source, so I will take a look at how involved it would be to extend the viewer to show the tests grouped by category. Could you please give me a hint on how to dynamically create a Test in DUnitX? It is sufficient if you mention which class(es) I should look at. That would be a great headstart. Once I have that figured out I can look into the viewer issue. Thank you!! 1 Share this post Link to post
David Heffernan 2347 Posted February 3, 2020 You can change viewer. You don't need to change the test framework in order to use a different viewer. Share this post Link to post
Stompie 2 Posted August 4, 2020 Hi @santiago, did you ever get this working in DUnitX? Would you mind sharing some of your DUnit(X) code, I have a similar situation where a dynamic test for each subfolder would be better, compared to 1 test: TestAllSubFoldersOf Share this post Link to post
santiago 36 Posted August 4, 2020 Hello @Stompie, unfortunately I have not been able to look further into this. Let me know if you get that to work. Eventually, at some point in time I will have to pick this up. Share this post Link to post
Vincent Parrett 754 Posted August 5, 2020 (edited) You can do dynamic test creation in DUnitX by creating a TestCaseProvider https://github.com/VSoftTechnologies/DUnitX/blob/master/Examples/ProviderExample.pas https://github.com/VSoftTechnologies/DUnitX/blob/master/TestCaseProvider.md I just pushed a small change that makes it easier to create unique test case names. Note - this won't resolve the debugging one case at a time issue though, unless you modify how your TestCaseProvider somehow. Edited August 5, 2020 by Vincent Parrett added note 2 Share this post Link to post
santiago 36 Posted August 5, 2020 @Vincent Parrett Great! I took a quick look and it seems to be exactly what I was needing. I hope I can get back to working on this soon. Thx! Share this post Link to post