Rational Functional Tester - How to call C# Code through RFT VB Script
prakash s chauhan 27000140Y5 Visits (10140)
This can be done with two simple steps(*)
Here is the C# class with a public method in a C# class library
public class CommonCode
public string GetTheTime()
The DLL that is generated out of the above project is placed in the "Customization" folder.
Now RFT VB project has reference to the above Class Library we just need to call it. Here is my RFT script calling the above method of C# class.
------------ RFT Script--------
Public Class Script1
'Script Name : Script1
Public Function TestMain(ByVal args() As Object) As Object
Dim comm As New MyUl
LogInfo("The time now is " + comm.GetTheTime()) ' Adding current time to the playback log
And that is it. RFT script will call the C# code and print the string (the current time) to the playback log.
In case you run into problem where RFT can't find the above DLL during script execution , refer to the instructions as metioned in following link: