Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VBS to DLL to QTP
#1
Not Solved
Could you please guide me on how to create DLL from a VBS file. And how such a DLL is associated to test so that I can call the functions in VBS.

Regards.
Reply
#2
Not Solved
Sorry you can't do it that way. You can create Classes in VBS then call the class.function, but they do not compile into DLLs. You need to use Visual Studio 6 or .NET to create dlls then install them as COM components in order to consume them in VBS/QTP. VS.NET does it pretty easily by selecting "Make Assembly COM visible" then registering. There are plenty of Google examples how to do this. You can even use the free Express editions of Visual studio to create and compile the dll files.

Easiest thing to do for QTP is create a VBS file then associate the file with your test/action in settings. You can still use classes.

Code:
'create class
Class TestMe
public sub HelloWorld()
   msgbox "Hello there"
end sub
End Class

'instantiate and consume
dim cltest: set cltest = New TestMe
cltest.HelloWorld

If you still wish to use DLLs then here is how. Create/compile dll using Visual studio. Register as COM component (Resasm.exe, I think...it's part of .NET utilities). Now QTP:
Code:
'if you use a namespace, don't forget to include it namspace.class
dim cltest:set cltest = CreateObject("cltestdll")
cltest.HelloWorld


I hope this helps.
Reply
#3
Not Solved
i have created one dll in C++ in visual studio 2005 for some functionality. I have to use /link it in QTP scripts. How can i do this???

Shall i need to convert it to COM component and install them????
Reply
#4
Not Solved
You can create COM components in VBScript with Windows Scripting Components. It's just a little extra XML. Check them out: http://msdn.microsoft.com/en-us/library/...85%29.aspx
Reply
#5
Not Solved
You need to register the dll in the Global Assembly.

c:\windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe your.dll /codebase

Then you can consume it via VBscript.
Reply
#6
Not Solved

we have created two scripts in vbscript for the ‘remote agent’ and ‘viewscript’. However, we need to place the dll/exe files in QC for custom test types. We are working on the conversion of these vbscript files to dll/exe. Is there any straight way to convert these in DLL or exe for QC 11.0
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  .vbs script error when trying to insert a value in a sapguitable frebuffi 5 6,858 07-18-2013, 03:04 PM
Last Post: Staff
  Running .dll files Aurodeepta 1 2,626 08-22-2012, 03:18 PM
Last Post: sshukla12
  Test COM and ATL DLL objects using VBScripting sree.85 0 2,006 08-16-2012, 01:00 PM
Last Post: sree.85
  Calling dll C# in VBScript nacchio 0 3,152 10-11-2011, 07:32 PM
Last Post: nacchio
Exclamation how to Pass Optional Parameters in VBS? ShrikantBiradar3449 1 8,316 06-13-2011, 03:12 AM
Last Post: Skepsis

Forum Jump:


Users browsing this thread: 2 Guest(s)