Skip to content

IDriverFactory extension does not yet work correctly #61

@rowo360

Description

@rowo360

Description
I made an attempt to activate a IDriverFactory extension using TestCentric-Gui 2.0.0-beta5 - unfortunately without success. While trying to get it activated, I searched for the missing detail and also looked into the TestCentric source code and log files. Finally I came to the conclusion that there's a gap in the TestCentric agent for this use case, so I raised this bug. But please review my attempt in general, if I'm on the right track.

Overview
The IDriverFactory extension is successfully detected by the TestCentric GUI. It's listed in the extension dialog with the state enabled. However the agent fails to load the IDriverFactory and there's an error message in the GUI while loading a test.
grafik

Exception callstack:
grafik

IDriverFactory implementation

  • The DriverFactory implements interface TestCentric.Engine.Extensibility.IDriverFactory and is basically empty for the start
  • It contains no path in the ExtensionAttribute as proposed by the exception message (because it doesn't make any difference)
  • The resulting assembly is located in a folder 'MyTestCentricAddin'
  • In the TestCentricGUI folder the '*.addin' file is extended with the path to the addin folder
    ../MyTestCentricAddin/*.dll
  • With these steps the new addin is already successfully detected by the TestCentricGUI
  • Next I added also an '*.addin' file for the agent. It's located in the folder:
    TestCentric.Extension.Net462PluggableAgent.2.5.0\tools\agent
    And contains a similar line:
    ../../../MyTestCentricAddin/*.dll

My assumption was that these steps would be sufficient to enable the extension also for the agent.

Observations
I'm adding some observations from analyzing this issue - it might be helpful.
I activated the detailed logging and compared the log file from the agent with the log file from the GUI:

Here's the essential part from the GUI log file:
21:45:39.493 Info [ 1] ServiceManager: Initializing ExtensionService
21:45:39.493 Info [ 1] ExtensionManager: Initializing ExtensionPoints...
21:45:39.493 Info [ 1] ExtensionManager: Assembly: testcentric.engine
21:45:39.493 Info [ 1] ExtensionManager: Assembly: TestCentric.Engine.Api
21:45:39.493 Info [ 1] ExtensionManager: Found Path=/TestCentric/Engine/TypeExtensions/ITestEventListener, Type=TestCentric.Engine.ITestEventListener
21:45:39.493 Info [ 1] ExtensionManager: Found Path=/TestCentric/Engine/TypeExtensions/IService, Type=TestCentric.Engine.Services.IService
21:45:39.493 Info [ 1] ExtensionManager: Found Path=/TestCentric/Engine/TypeExtensions/IAgentLauncher, Type=TestCentric.Engine.Extensibility.IAgentLauncher
21:45:39.493 Info [ 1] ExtensionManager: Found Path=/TestCentric/Engine/TypeExtensions/IDriverFactory,
...

And here's the log file from the agent:
21:45:40.497 Debug [ 5] DriverService: Creating ExtensionManager
21:45:40.497 Debug [ 5] DriverService: Initializing ExtensionManager
21:45:40.497 Info [ 5] ExtensionManager: Initializing ExtensionPoints...
21:45:40.497 Info [ 5] ExtensionManager: Assembly: TestCentric.Agent.Core
21:45:40.497 Info [ 5] ExtensionManager: Found Path=/NUnit/Engine/NUnitV2Driver, Type=TestCentric.Engine.Extensibility.IFrameworkDriver
21:45:40.497 Info [ 5] ExtensionManager: Initializing Extensions...
...

From my point of view the essential difference is the set of assemblies which are used by the ExtensionManager to get the list of available extension points. The GUI uses the assembly TestCentric.Engine.Api whereas the agent only uses the assembly TestCentric.Agent.Core. So overall the agent is not aware of the extension point IDriverFactory and cannot load the extension properly.

I also had a quick look into the code base and noticed the construction of the ExtensionManager here:
TestCentric.Agent.Core\Drivers\DriverService.cs
And yes indeed, here only the TestCentric.Agent.Core assemby is passed in.
As a final step I extended this line by passing in the TestCentric.Engine.Api assembly additionally and by that the extension gets successfuly loaded and also be invoked during test execution.
However I have no clue if this is a suitable fix at all and if it fits into the general concepts, it was just an attempt. But overall I hope that these observations help to narrow down this issue.

Environment

  • TestCentric Version 2.0.0-beta5
  • OS: Windows 11
  • Target Runtime for your test assembly: .NET Framework 4.8

Metadata

Metadata

Assignees

Labels

BugSomething isn't working as expected.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions