-1

I want to make wp7 app GUI testing tool!!!

wp7 emulator running on the app I want to get the UIElement.

Did you get access to the runtime UIElement?

wp7 emulator Run-time access to samples or Tip and Open source let me know.

Ash Burlaczenko
  • 24,778
  • 15
  • 68
  • 99
  • possible duplicate of [How do I write automated tests for the UI of a Windows Phone 7 application?](http://stackoverflow.com/questions/3831854/how-do-i-write-automated-tests-for-the-ui-of-a-windows-phone-7-application) – Richard Szalay Jan 18 '12 at 07:39
  • Not an appropriate answer. Applications running in the emulator, I want to obtain a UIElement. – 김현진 Jan 18 '12 at 11:04
  • The closest you're going to get to AutomationElement is to automate it from outside the application. – Richard Szalay Jan 18 '12 at 11:46
  • I want to communicate Desktop and Windows Phone 7. – 김현진 Jan 19 '12 at 01:51

1 Answers1

0

I don't know of any dedicated tool for WP7. You can use Linq-to-VisualTree to inspect the visual tree at runtime. As a debug visualisation aid, the following Linq query will output teh visual tree:

string tree = this.DescendantsAndSelf().Aggregate("",
    (bc, n) => bc + n.Ancestors().Aggregate("", (ac, m) => (m.ElementsAfterSelf().Any() ? "| " : "  ") + ac,
    ac => ac + (n.ElementsAfterSelf().Any() ? "+-" : "\\-")) + n.GetType().Name + "\n");

Producing for example:

\-MainPage
  \-Grid
    +-TextBox
    | \-Grid
    |   +-Border
    |   | \-Grid
    |   |   +-Border
    |   |   \-Border
    |   |     \-ScrollViewer
    |   |       \-Border
    |   |         \-Grid
    |   |           +-ScrollContentPresenter
    |   |           | \-TextBoxView
    |   |           +-Rectangle
    |   |           +-ScrollBar
    |   |           \-ScrollBar
    |   +-Border
    |   +-Border
    |   \-Border
    |     \-Grid
    |       +-Path
    |       \-Path
    \-StackPanel
      +-TextBox
      | \-Grid
      |   +-Border
      |   | \-Grid
      |   |   +-Border
      |   |   \-Border
      |   |     \-ScrollViewer
      |   |       \-Border
      |   |         \-Grid
      |   |           +-ScrollContentPresenter
      |   |           | \-TextBoxView
      |   |           +-Rectangle
      |   |           +-ScrollBar
      |   |           \-ScrollBar
      |   +-Border
      |   +-Border
      |   \-Border
      |     \-Grid
      |       +-Path
      |       \-Path
      \-Grid
        +-TextBox
        | \-Grid
        |   +-Border
        |   | \-Grid
        |   |   +-Border
        |   |   \-Border
        |   |     \-ScrollViewer
        |   |       \-Border
        |   |         \-Grid
        |   |           +-ScrollContentPresenter
        |   |           | \-TextBoxView
        |   |           +-Rectangle
        |   |           +-ScrollBar
        |   |           \-ScrollBar
        |   +-Border
        |   +-Border
        |   \-Border
        |     \-Grid
        |       +-Path
        |       \-Path
        \-StackPanel
          \-TextBox
            \-Grid
              +-Border
              | \-Grid
              |   +-Border
              |   \-Border
              |     \-ScrollViewer
              |       \-Border
              |         \-Grid
              |           +-ScrollContentPresenter
              |           | \-TextBoxView
              |           +-Rectangle
              |           +-ScrollBar
              |           \-ScrollBar
              +-Border
              +-Border
              \-Border
                \-Grid
                  +-Path
                  \-Path

You might be able to use this to create your own tool.

ColinE
  • 68,894
  • 15
  • 164
  • 232