Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.

Steps to create a dll object repository to be used in various scripts in SilkTest Workbench

Steps to create a dll object repository to be used in various scripts in SilkTest Workbench

Steps to create VB.NET class library for use with Silk4NET or SilkTest Workbench:

1) Create a .NET 3.5 Framework Visual Studio Class Library project and name it ObjectMap.
2) Open the *.vb project file if it is not already open (by default it should be called Class1.vb, you can rename this classname to Decl.vb).
3) Add the SilkTest.Ntf library to the project from the following location:
C:\Program Files (x86)\Silk\SilkTest\ng\NTF

          a) From Project | Add Reference
          b) Select the Browse tab and browser to the above location
          c) Add the file SilkTest.Ntf.dll

4) Using the Imports statement add references to SilkTest.Ntf and SilkTest.Ntf.XBrowser

for example:

     Imports SilkTest.Ntf
     Imports SilkTest.Ntf.XBrowser

     Public Class Decl
     ...

5) Create the necessary class functions to instantiate the objects that will be used for testing.

for example:

     Imports SilkTest.Ntf
     Imports SilkTest.Ntf.XBrowser

     Public Class Decl
          ' instantiate the Desktop class
          Private ReadOnly _desktop As Desktop = Agent.Desktop

          ' functions to instantiate browser objects
          Public Function getBrowserApplication() As BrowserApplication
               Return _desktop.BrowserApplication()
          End Function

          Public Function getBrowserWindow() As BrowserWindow
               Return getBrowserApplication().BrowserWindow()
          End Function

          Public Function getGoogleSearchField() As DomTextField
               Return getBrowserWindow().DomTextField("//INPUT[@id='gbqfq']")
          End Function

          Public Function getGoogleSearchButton() As DomButton
               Return getBrowserWindow().DomButton("//BUTTON[@id='gbqfb']")
          End Function

          Public Function getMFLink() As DomLink
               Return getBrowserWindow().DomLink("//A[@textContents='Application Moderniz*']")
          End Function

          Public Function getSupportLink() As DomLink
               Return getBrowserWindow().DomLink("//A[@textContents='Support'][2]")
          End Function

          Public Function getKBSupportLink() As DomLink
               Return getBrowserWindow().DomLink("//A[@textContents='Knowledge Base']")
          End Function

          Public Function getKBLink() As DomLink
               Return getBrowserWindow().DomLink("//A[@textContents='kb.microfocus.com']")
          End Function
     End Class

6) Change the build configuration from Debug to Release
7) Build the solution, this should create a dll file at the following location:
<project_path>\ObjectMap\ObjectMap\bin\Release

Now you should be able to add a reference to this dll in a Silk4NET or a Silk Test Workbench VB.NET script.

Ensure that in which ever IDE is used that you instantiate this Class Libary, for example:

     ' instantiate class library
     Dim _decl As New ObjectMap.Decl

You will then be able to refer to the functions in the class library as follows:

     Imports SilkTest.Ntf
     Imports SilkTest.Ntf.XBrowser
     Imports ObjectMap

     Public Module Main
          'Dim _desktop As Desktop = Agent.Desktop

          ' instantiate class library
          Dim _decl As New ObjectMap.Decl

          Public Sub Main()
               With _decl.getBrowserApplication()
                    With _decl.getBrowserWindow()
                         _decl.getGoogleSearchField().SetText("micro focus")
                         _decl.getGoogleSearchButton().Click(MouseButton.Left, New Point(30, 11))
                         _decl.getMFLink().Click(MouseButton.Left, New Point(147, 9))
                         _decl.getSupportLink().MouseMove(New Point(50, 8))
                         _decl.getKBSupportLink().Click(MouseButton.Left, New Point(52, 16))
                         _decl.getKBLink().Click(MouseButton.Left, New Point(83, 12))
                    End With
               End With
          End Sub
     End Module

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2012-11-28 06:18
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.