i want to execute a unit test running under Continua. The unit test is part of a group file (.groupproj). It gets compiled successfully. It also executes, but never stops.
I’d expect the Continua action to pass “-exit:continue”, but that does not happen obviously. There is no command line argument in the action either, that i could configure. Adding an option file is overkill.
Adding a define CI as suggested here is overkill too:
I would need to restructure a running system, removing the unit test of the project file and instead add an explicit action with continua.
There must be something smarter, right?
Can you show your dpr? Without seeing what you have it’s impossible to know exactly what is going on.
We don’t pass --exit - that is something we probably should do, I guess we just assume people would define CI when compiling the project. How are you compiling it, FinalBuilder or MSBuild?
Also what version of Delphi and DUnitX - are you using the DUnitX bundled with your delphi version or from github?
i use Finalbuilder’s MSBuild action. I could not find an easy way to pass the “CI” define for it. Switching to the Delphi Build Action is not an option, as it requires a different approach for the entity of the script.
The system under test is compiled with Delphi 10.4.1 and DUnitX is provided by that Delphi installation.
The code is generated by DUnitX’s Wizard.
runner : ITestRunner;
results : IRunResults;
logger : ITestLogger;
nunitLogger : ITestLogger;
ReportMemoryLeaksOnShutdown := True;
//Check command line options, will exit if invalid
//Create the test runner
runner := TDUnitX.CreateRunner;
//Tell the runner to use RTTI to find Fixtures
runner.UseRTTI := True;
//tell the runner how we will log things
//Log to the console window
logger := TDUnitXConsoleLogger.Create(true);
//Generate an NUnit compatible XML File
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
results := runner.Execute;
if not results.AllPassed then
System.ExitCode := EXIT_ERRORS;
//We don't want this happening when running under CI.
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
System.Write('Done.. press <Enter> key to quit.');
on E: Exception do
System.Writeln(E.ClassName, ': ', E.Message);
i’ve come up with a solution by introducing an include-file, that controls the compiler defines for the different environments. This way i can also configure TestInsight as a test runner for local development. The Unit-Test is now up and running. The results are integrated with Continua, which looks very nice.
Still, i suggest, that the Continua DUnitX action should pass the “exit” parameter. This should be no big deal and helps running unit tests out of the box.
The next update to Continua CI will have the exit parameter (I saw a commit for it yesterday) .
As for adding compiler defines with MSBuild, you can add them via the DCC_Define property
$$(DCC_Define) is so that we are adding to the defines in the project rather than replacing them - the double $ is to stop FB treating it as a variable that needs to be expanded.
thanks a lot for your clarification. Knowing how to handle the MS Build action is of value.