1

Is it possible to call .NET Invoke method from SilkTest test case? I can call it using DynamicInvoke method, but I don't know what to pass as parameters that would be equal to method delegate.

xx77aBs
  • 4,678
  • 9
  • 53
  • 77

1 Answers1

1

It's not possible to call methods with DynamicInvoke that require arguments that can't be represented by Silk Test's types or offer a simple constructor which can be auto-detected (default constructor, or constructor taking a String argument).

That being said, there might be solutions to your issue:

  • If you have access to the application's code, you can add a method to the UI element that does whatever you intend to do with the Invoke call, and call that wrapper method instead
  • With the upcoming Silk Test 14 release, you have the option to DynamicInvoke arbitrary static methods in you application, which again can be used as a wrapper around Invoke.
  • Also with Silk Test 14, you'll be able to load custom assemblies and call methods there, so if you don't want to pollute your application with functionality for testing, put that in a custom assembly and load it for your tests.
tehlexx
  • 2,821
  • 16
  • 29
  • I need to call method get_Item that has two overloads - one accepts string and another int as paramater. Is it possible to force DynamicInvoke to use int overload - now it always uses string overload and it's not working properly? – xx77aBs Jun 11 '13 at 16:32
  • Make sure that in your test script the parameter is an `Int`, then it should pick the correct overload. – tehlexx Jun 18 '13 at 18:07
  • I've declared the parameter as integer iPar, and then passed it to DynamicInvokeMethods, but it doesn't work (string overload always gets called). – xx77aBs Jun 18 '13 at 18:16