Why does 'uses unit' disappear when I had a new unit ?

Posted by TridenT on Stack Overflow See other posts from Stack Overflow or by TridenT
Published on 2010-03-31T17:57:57Z Indexed on 2010/03/31 18:23 UTC
Read the original article Hit count: 378

Filed under:
|

I have a Unit test project for my Application using DUnit framework. This project have a unit surrounded by a $IFDEF to output test-results in a xml file instead of the gui or just command line. XML_OUTPUT define is enabled by switching the Build configuration.

program DelphiCodeToDoc_Tests;

uses
  TestFramework,
  TextTestRunner,
  Sysutils,
  Forms,
  GUITestRunner,
{$IFDEF XML_OUTPUT}
  XmlTestRunner2 in 'DUnit_addon\XmlTestRunner2.pas',
{$ENDIF}
  DCTDSetupTests in 'IntegrationTests\DCTDSetupTests.pas',
  ...

This works perfectly. The issue starts when I'm adding a new unit to this project from the IDE (a new unit with 'File>New>Unit').

The Test project is now :

uses
  TestFramework,
  TextTestRunner,
  Sysutils,
  Forms,
  GUITestRunner,
  DCTDSetupTests in 'IntegrationTests\DCTDSetupTests.pas',
  ...
  MyNewUnit in 'IntegrationTests\MyNewUnit.pas';

As you see, the test XML_OUTPUT has disappeared ... Each time I'm adding a unit, Delphi IDE deletes this test.

Do you know why and how I can avoid it ?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about dunit