C++ Builder 10.3 Rio - Testframework

310 Views Asked by At

It seems that C++ builder 10.3. comes with a new testframework.hpp. The class Assert does not exist any longer.

Can anyone tell me how to use this new framework?

I am desperate because I wrote a lot of code and obviously Rio is not really compatible.

for example the following code line, written in Builder 10.2.3, doesn't work any longer:

Dunitx.Testframework::Assert::IsTrue (result == true);
2

There are 2 best solutions below

0
On

You seem to have found the TestFramework.hpp for DUnit. But it is obvious your code was using DUnitX before. These are similar but incompatible test frameworks.

To get the Dunitx.Testframework.hpp you need, simply add DUnitX.TestFramework.pas to your C++Builder test project (add it in the project manager) and completely re-build your project. The Pascal compiler will generate the necessary .hpp file for you.


But before you do all that, you may want to copy your project to a new folder, and load it from there, just to be sure. That way, the older project will not be modified. Be sure to update all your paths in the project manager and C++ library settings too, if necessary.


If you think DUnit is easier to use (I certainly do), then keep on using that. But you will have to rewrite some parts of your tests. More info can be found in the Delphi help files (and on the web counterpart) and on the DUnit website.

DUnit was the former test framework for Delphi (hence the D), but at some time in the past, it was replaced by the more modern DUnitX. But that uses some Delphi features (like Delphi attributes) that make it harder to use in C++Builder. DUnit is still part of the RAD Studio installation.

1
On

I found the solution in the testframework.hpp - file. The usage is now a lot easier but you will have to know how to handle it. The description in the embaracdero help system is wrong and should be corrected.