IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • 3 replies
  • Latest Post - ‏2012-11-14T15:05:30Z by Sean_lee_loy
Sean_lee_loy
Sean_lee_loy
5 Posts

Pinned topic Accessing methods from one VB .NET RFT script diff folder

‏2012-07-12T14:43:42Z |
Hi I'm trying to create RFT scripts with their own objects maps and call custom methods.

I can do this if I create them in the same folder, i.e. Script1.vbs contains method I wrote testLogin which Script2.vbs instantiates the class Script1 that contains the public method testLogin

Directory structure:
<PROJECT>
|-Script1
|-Script2
|-wrappers
|-Script1
code below: works

Public Class Script2
Inherits Script2Helper
Public Function TestMain(ByVal args() As Object) As Object
Dim script2 As Script1 = New Script1
script2.testLogin()
Return Nothing
End Function
End Class

However I tried and created same Script1.vbs under a "wrappers" folder and referenced the correct Namespace
but it gives the following error during compilation:
Error message:
[
C:\Users\sean.lee-loy\Documents\Visual Studio 2005\Projects\OLISTEST\OLISTEST\Script2.vb(29,0): Type 'wrappers.Script1' is not defined.
]

Public Class Script2
Inherits Script2Helper
Public Function TestMain(ByVal args() As Object) As Object
Dim script2 As wrappers.Script1 = New wrappers.Script1
script2.testLogin()
Return Nothing
End Function
End Class

I even tried importing Namespace and still gave the same error.
In Java, this referencing of methods in other RFT scripts contained in different folders (packages) works.

code for Script1 in "wrappers" folder: which is essentially the same as the one in the root folder just without Namespace declaration.

Namespace wrappers

Public Class Script1
Inherits Script1Helper
'Script Name : Script1
'Generated : Jul 12, 2012 10:36:08 AM
'Description : Functional Test Script
'Original Host : Windows 7 x86 6.1 build 7601 Service Pack 1
'since 2012/07/12
'author sean.lee-loy
Public Function TestMain(ByVal args() As Object) As Object
' TODO Insert code here
Return Nothing
End Function

Public Function testLogin() As Object
StartApp("iexplore")
Link_Facilities().WaitForExistence()
Link_Facilities().Click()
Return Nothing
End Function
End Class
End Namespace
Updated on 2012-11-14T15:05:30Z at 2012-11-14T15:05:30Z by Sean_lee_loy
  • Sean_lee_loy
    Sean_lee_loy
    5 Posts

    Re: Accessing methods from one VB .NET RFT script diff folder

    ‏2012-07-12T15:08:01Z  
    I found an old thread in 2008: which says RFT has problems resolving Namespaces is this still an issue in RFT 8.2.2?

    4. Namespaces defined in your RFT project don't quite work right. I found this is related to number 3 above. The problem is that the IDE behaves as if the project is developed under a root namespace with the same name as the project. Therefore, any new namespaces defined within the project are treated as children of that root namespace. The compiler, on the other hand, does not actually use the /rootnamespace switch (and there is no way within the IDE to specify that it should) and therefore all namespaces defined in the project are compiled as their own root. This causes problems when trying to use "Imports" lines for namespaces defined within the project. For example, say I have an RFT project named "Bob", and within it I have a utility class that defines a the new namespace "Frank". If I want my script to access that utility class I would put the following line in the header of the script:

    Imports Bob.Frank

    As far as the IDE is conserned, this is correct and no errors are detected at design-time. However when you compile this script, you get errors because as far as the compiler is concerned there is no "Bob" namespace. If you change the line to this:

    Imports Frank

    It will compile with no problems, however the IDE will now throw a fit and report a bunch of design-time errors, and you will get no intellisense support for that namespace.
  • SystemAdmin
    SystemAdmin
    16727 Posts

    Re: Accessing methods from one VB .NET RFT script diff folder

    ‏2012-10-21T13:37:21Z  
    I found an old thread in 2008: which says RFT has problems resolving Namespaces is this still an issue in RFT 8.2.2?

    4. Namespaces defined in your RFT project don't quite work right. I found this is related to number 3 above. The problem is that the IDE behaves as if the project is developed under a root namespace with the same name as the project. Therefore, any new namespaces defined within the project are treated as children of that root namespace. The compiler, on the other hand, does not actually use the /rootnamespace switch (and there is no way within the IDE to specify that it should) and therefore all namespaces defined in the project are compiled as their own root. This causes problems when trying to use "Imports" lines for namespaces defined within the project. For example, say I have an RFT project named "Bob", and within it I have a utility class that defines a the new namespace "Frank". If I want my script to access that utility class I would put the following line in the header of the script:

    Imports Bob.Frank

    As far as the IDE is conserned, this is correct and no errors are detected at design-time. However when you compile this script, you get errors because as far as the compiler is concerned there is no "Bob" namespace. If you change the line to this:

    Imports Frank

    It will compile with no problems, however the IDE will now throw a fit and report a bunch of design-time errors, and you will get no intellisense support for that namespace.
    How do you resolve this namespace issue? Can someone from IBM respond?
  • Sean_lee_loy
    Sean_lee_loy
    5 Posts

    Re: Accessing methods from one VB .NET RFT script diff folder

    ‏2012-11-14T15:05:30Z  
    How do you resolve this namespace issue? Can someone from IBM respond?
    This still seems to be a problem, As a result I had to put everything all scripts in the same folder.