dunit

How can I test private methods with DUnit?

狂风中的少年 提交于 2020-01-21 02:41:05
问题 I have a class that I am unit testing into with DUnit. It has a number of methods some public methods and private methods. type TAuth = class(TDataModule) private procedure PrivateMethod; public procedure PublicMethod; end; In order to write a unit test for this class I have to make all the methods public. Is there a different way to declare the private methods so that I can still test them but they are not public? 回答1: You don't need to make them public. Protected will do. Then you can

Delphi 2007 Version Info missing from Exe

☆樱花仙子☆ 提交于 2019-12-23 02:59:07
问题 I have a Delphi 2007 project and I'm trying to set the Project->Options->'Version Info'. I enter the values into the form and save the project. However, when I build, the generated exe doesn't contain the Version Info that I entered. In fact, it only contains the File Version, Language and Product Version - none of the other values like Internal name, Product name etc... I noticed that the values do not get saved to the .dproj file. So I tried entering them manually into the xml of said file,

How to start unit-test old and new code?

。_饼干妹妹 提交于 2019-12-20 11:36:29
问题 I admit that I have almost none experience of unittesting. I did a try with DUnit a while ago but gave up because there was so many dependencies between classes in my application. It is a rather big (about 1.5 million source lines) Delphi application and we are a team that maintain it. The testing for now is done by one person that use it before release and report bugs. I have also set up some GUI-tests in TestComplete 6, but it often fails because of changes in the application. Bold for

Delphi 7, DUnit and FastMM reporting Strings incorrectly

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 14:48:59
问题 I'm using DUnit and FastMM to catch unfinalized memory blocks but there seems to be a Bug. I dunno if its in FastMM, DUnit or in Delphi itself, but here goes: When my Test Case has internal strings, the test fails with memory leaks. If I run the same test again without closing the DUnit GUI, the test passes OK. The same occours with DUnit GUI Testing, I believe for the same reason. There are no Leaks in my app, the proof is that FastMM doesn't generate the leak report in those cases. Question

(How) Can I use FutureWindows with standard file open dialogs?

你说的曾经没有我的故事 提交于 2019-12-10 14:49:21
问题 I've been trying to use tomazy's FutureWindows infrastructure (see his answer at Delphi GUI Testing and Modal Forms or the home of the tool at https://github.com/tomazy/DelphiUtils), but would like to know if and how can it be used with standard Windows file open dialogs? They don't seem to be inheriting from TControl, which the FutureWindows infra seems to assume (unless I've misunderstood it). What I'd like to do is basically to just select a file in an OpenFileDialog which is opened

HTTP server for unit tests in Delphi

前提是你 提交于 2019-12-10 03:49:06
问题 I need to test some HTTP components in my Delphi app. I use DUnit and want to add some automation into testing. So my testing code need to start the local HTTP server, configure it (for example, prepare for connection break in 3 seconds, or to simulate low bandwidth, or to ask for login/password etc), run my unit-tests and close HTTP server. Are there some HTTP servers available exactly for Delphi/DUnit? I know that Mozilla team have such server, but it's not too easy to integrate it into

DUnit: How to run tests?

核能气质少年 提交于 2019-12-10 02:56:13
问题 How do i run TestCase 's from the IDE? i created a new project, with a single, simple, form: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) private public end; var Form1: TForm1; implementation {$R *.DFM} end. Now i'll add a test case to check that pushing Button1 does what it should: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type

In a Dunit project and exe version info is disabled, how do I get it back?

℡╲_俬逩灬. 提交于 2019-12-08 17:02:23
问题 Why cant I set a version info in a Dunit Test projet? The checkbox is disabled for this projetct, but not for other projects. See the screenshot: 回答1: You may be missing the {$R *.res} directive in your test project's source. It needs to be in the .dpr or you won't be able to use this feature in the project options. It should be there by default but occasionally it can get screwed up when adding or removing a unit from a project. When this happens it will look like: $R *.res} // notice the

How can I disable DUnit tests by name programmatically?

一世执手 提交于 2019-12-07 16:26:37
问题 For integration tests, I created a DUnit test suite which runs once for every version of a third party component (a message broker). Unfortunately, some tests always fail because of known bugs in some versions of the tested component. This means the test suites will never complete with 100%. For automated tests however, a 100% success score is required. DUnit does not offer a ready-made method to disable tests in a test suite by name. 回答1: I wrote a procedure which takes a test suite and a

How can I enable the memory leak tracking with FastMM in DUnit?

主宰稳场 提交于 2019-12-06 18:40:44
问题 In the GUI test runner, the menu items for memory leak checking are inactive (grayed out). Is there a special switch I have not found yet to activate them? Using DUnit 9.4 (from Delphi 2009 or from the sourceforge Subversion repository) and FastMM4.92 回答1: You have to build your DUnit GUI-testrunner with the FASTMM and ManualLeakReportingControl directive. This will enable the memoryleak items (Take a look in GUITestRunner.pas). 来源: https://stackoverflow.com/questions/685904/how-can-i-enable