There are two steps to adding and using a .NET dll to your automated suite. First you must add a reference that tells your script where to find the dll and second you need to call the method in your .NET dll. Read on or download the PDF at the bottom of this post. It is real simple!
Adding a reference to TestComplete for your DLL
1. Launch your Project Suite.
2. Right click on your Project and choose Edit >> Properties.
3. Click on “CLR Bridge”.
4. Click on the Browse Files button and locate your file.
5. Select your file and click the Open button.
6. Notice that the file is now listed in the Selected Components, like below:
7. Set your preferred architecture and apartment models.
Referencing your DLL through C# scripting
Add a line to your C# script with the following components:
Str = dotNET[“AutomationHelpers”][“UninstallProgram”][”FindAndUninstallProgram”](product);
1. Str would be the return value of the function you are calling and it is optional.
2. dotNET tells TestComplete that you are calling a .NET dll.
3. [“AutomationHelpers”] would be the namespace value in your dll.
4. [“UninstallProgram”] would be the class name in your dll.
5. [“FindAndUninstallProgram”] would be the function name you wish to call.
6. (product) is your parameter list for the function you are calling.
Adding a DOTNET DLL to TestComplete Projects
Related posts: