WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.17' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1714489653.8050489425659179687500', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)


Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372
{"id":908,"date":"2012-01-15T10:40:55","date_gmt":"2012-01-15T09:40:55","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=908"},"modified":"2012-01-16T15:44:12","modified_gmt":"2012-01-16T14:44:12","slug":"coded-ui-tests-wpf-utilities","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2012\/01\/15\/coded-ui-tests-wpf-utilities\/","title":{"rendered":"Coded UI Tests : WPF Utilities"},"content":{"rendered":"

\"\"I played a lot with Coded UI Tests API on WPF applications these last weeks. <\/p>\n

It turned out that this is a really powerful framework available to use but that we need to write a lot of code ourselves even for simple things. <\/p>\n

You may already know the coded ui test utilities of Gautam Goenka available on his blog<\/a>. <\/p>\n

On this blog post, I want to introduce a set of complementary helper methods that you can use in your project.<\/strong> The links to the binaries\/sources are at the end of the post.<\/p>\n

Here is a list of the available features :<\/strong><\/p>\n

    \n
  1. List, Tree and Menu emptiness tests as User extension methods.<\/li>\n
  2. Helper to get all the AutomationIds of a control collection.<\/li>\n
  3. Helper to get all the children control of a specific type.<\/li>\n
  4. Easier set text syntax with fallback method: youpi !<\/li>\n
  5. Easier set value syntax.<\/li>\n
  6. Easier expand and collapse syntax.<\/li>\n
  7. Easier selection syntax.<\/li>\n
  8. Easier invoke syntax.<\/li>\n<\/ol>\n

    <\/p>\n

    Features, code sample and comments<\/h4>\n

    List, Tree and Menu emptiness tests as User extension methods<\/h5>\n

    It’s always useful to know if a listbox is empty or not. Now you can use these simple methods.
    \n[csharp]
    \n\/\/ WpfTree treeView = … ;<\/p>\n

    \/\/Tell me if you are empty my dear
    \nbool isEmpty = treeView.IsEmpty();
    \nAssert.IsTrue(isEmpty);
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Helper to get all the AutomationIds of a control children<\/h5>\n

    Sometimes you store information trough AutomationIds. This method will help you to retrive them in a simple way.
    \n[csharp]
    \n\/\/ WpfControl control= … ;<\/p>\n

    \/\/Rertrieve the ids
    \nList<string> idsOfChildren = control.GetChildrenAutomationIds();
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Helper to get all the children control of a specific type<\/h5>\n

    This is a recursive method which can helps you in several scenarii. Be sure to notice that there is an override which takes a boolean as a parameter. If it sets to false, the method will return ALL the children and not only the direct one.<\/p>\n

    Also, be sure to understand that you won’t be able to call the Find method on these controls as they do not have defined search properties.<\/strong><\/p>\n

    [csharp]
    \n\/\/ WpfControl control= … ;<\/p>\n

    \/\/Get only the direct children
    \nList<WpfEdit> children= control.GetChildren<WpfEdit>();<\/p>\n

    foreach(WpfEdit edit in children) SomethingCool();<\/p>\n

    \/\/Get all the children in the tree below the control
    \nList<WpfEdit> children= control.GetChildren<WpfEdit>(onlyDirectChildren: false);<\/p>\n

    foreach(WpfEdit edit in children) SomethingCoolToo();
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Easier set text syntax with fallback method: youpi !<\/h5>\n

    I found out trying to set the text of a TextBox that you can end up waiting eternity for the text being really set.<\/strong><\/p>\n

    I do so tried to create an helper method which can be faster using the automation pattern. I then try to use the value pattern but oddly, it wasn’t available on the TextBox automation peer. <\/p>\n

    I finally find on a MSDN code sample comments that<\/a> “Elements that support TextPattern do not support ValuePattern and TextPattern does not support setting the text of multi-line edit or document controls”. So if the control implements the TextPattern, you have to use a fallback method which is in fact simulate keyboard inputs. <\/strong><\/p>\n

    The helper method just do that :<\/p>\n

    [csharp]
    \n\/\/WpfControl control = …;<\/p>\n

    \/\/Set the text
    \nbool isTextSet= control.TrySetText("I love Coded UI tests");
    \nAssert.IsTrue(isTextSet);
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Easier set value syntax<\/h5>\n

    Testing if a control implements a pattern and then trying to call it represents a lot of code line.
    \nWith this helper you just have one single line method call.
    \n[csharp]
    \n\/\/WpfControl control = …;<\/p>\n

    \/\/Set the value
    \nbool isValueSet= control.TrySetValue("I want to set this value.");
    \nAssert.IsTrue(isValueSet);
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Easier expand and collapse syntax<\/h5>\n

    Same as the previous, one single line to collapse\/expand a control. If the control does not implements the pattern, the method will just returns false.
    \n[csharp]
    \n\/\/WpfControl control = …;<\/p>\n

    \/\/Expanding
    \nbool isExanpded = control.TryExpand();
    \nAssert.IsTrue(isExanpded);<\/p>\n

    \/\/Collapsing
    \nbool isCollapsed = control.TryCollapse();
    \nAssert.IsTrue(isCollapsed);
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Easier selection syntax<\/h5>\n

    Select a control in one line of code !
    \n[csharp]
    \n\/\/WpfControl control = …;<\/p>\n

    \/\/Select the control
    \nbool isSelected = control.TrySelect();
    \nAssert.IsTrue(isSelected);
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Easier Invoke syntax<\/h5>\n

    Instead of simulate a mouse click, you can now use this method which will use the invoke pattern even if the control is hided.
    \n[csharp]
    \n\/\/WpfControl control = …;<\/p>\n

    \/\/Invoke
    \nbool isInvoked = control.TryInvoke();
    \nAssert.IsTrue(isInvoked);
    \n[\/csharp]<\/p>\n

    <\/p>\n

    Were are the binaries ?<\/h4>\n

    The binaries and the, well commented, soure code can be found at this adress : https:\/\/www.dropbox.com\/s\/gmpybsviirm3bqd#view:list<\/a><\/p>\n

    Don’t forget to support me by registering to Dropbox using this link<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"

    I played a lot with Coded UI Tests API on WPF applications these last weeks. It turned out that this is a really powerful framework available to use but that we need to write a…<\/p>\n","protected":false},"author":3,"featured_media":997,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/908"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=908"}],"version-history":[{"count":34,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/908\/revisions"}],"predecessor-version":[{"id":998,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/908\/revisions\/998"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media\/997"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=908"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}