Uwe Raabe 2063 Posted August 13, 2022 The current implementation of one overload of TTestDataProvider.GetProvider looks like this: class function TestDataProviderManager.GetProvider(const AClass: TTestDataProviderClass) : ITestDataProvider; var key : string; begin result := nil; if (FList.ContainsValue(AClass)) then begin for key in flist.keys do begin if (flist[key] = AClass) then begin result := TTestDataProviderClass(flist[key]).Create; break; end; end; end; end; Is there any reason why that cannot be written as: class function TestDataProviderManager.GetProvider(const AClass: TTestDataProviderClass) : ITestDataProvider; begin result := AClass.Create; end; With that one could avoid registering the provider. The reasoning for my question is, that I have a base provider class and several derived classes to overcome the lack of ability to parametrize a data provider instance. All these derived classes are local to one test unit and I would like all of them to have the same class name. Unfortunately the registration requires me to give distinct names for them and you know - naming is hard. Just declaring the derived class and use that in a TestCaseProvider attribute would simplify this a lot. Concrete: TTestDataFilesProvider provides a list of files, but requires the path and search pattern as parameters. Now I derive individual classes (with fixed values) immediately before they are used. Share this post Link to post