If your module relies on a root context property, you should think to create a c++ Plugin for QML using QQmlEngineExtensionPlugin
Creating C++ Plugins for QML
If you take a look at the implementation you will need to reimplement
the following function:
void initializeEngine(QQmlEngine *engine, const char *uri) override;
As the documentation says:
Initializes the extension from the uri using the engine. Here an application plugin might, for example, expose some data or objects to QML, as context properties on the engine's root context.
In this function you can put your required root context property
void initializeEngine(QQmlEngine *engine, const char *uri) override
{
MyObject* object = new MyObject(engine->rootContext());
engine->rootContext()->setContextProperty("myProperty", object);
}
After that, you just need to import your QML module in your QML file, where you TestCase is defined and you won't need to use any main functions to add this
object as root context property.