1

Is it possible to access .NET properties using SilkTest classic (4Test language)? I need to read value of labels that are shown on System.Windows.Forms.DataVisualization.Charting.Chart control.

I can't use GetProperty or DynamicInvoke because when they return something, 4Test automatically converts it to string. So if I call GetProperty("Legends"), I'll get just Legends.ToString(), not the actual LegendCollection object.

xx77aBs
  • 4,678
  • 9
  • 53
  • 77
  • 1
    You know you can cascade multiple invoke calls, right? So if you want a single `Legend`, you could `.Get` it from the `LegendCollection`. The `Legend`-object then again would be `.ToString`ed, but you could also call another method/property if that would make more sense. – tehlexx May 31 '13 at 04:56
  • @tehlexx: I didn't know that I could do that. Can you please provide me with an example? – xx77aBs May 31 '13 at 09:37
  • 1
    This article (http://community.microfocus.com/borland/test/silk_test/w/wiki/809.testing-custom-controls-with-silk-test.aspx) covers using dynamic invoke as well as cascading invokes to handle custom types like in your case. – tehlexx May 31 '13 at 15:47
  • @tehlexx: Thanks! I've already found the article and solved my problem. Would you like to post this as answer so that I can accept it? – xx77aBs May 31 '13 at 19:41

1 Answers1

1

As described in this article you can use cascading dynamicInvoke-calls to access the elements in the LegendCollection.

You can then also access properties of that element if the default ToString() is not appropriate for you.

tehlexx
  • 2,821
  • 16
  • 29