Deprecated: Function create_function() is deprecated in /home/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php on line 258

Warning: Cannot modify header information - headers already sent by (output started at /home/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/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/qualit96/public_html/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php:258) in /home/qualit96/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1372
{"id":13802,"date":"2018-03-14T20:10:12","date_gmt":"2018-03-14T15:10:12","guid":{"rendered":"http:\/\/quality-spectrum.com\/?p=13802"},"modified":"2019-11-20T21:00:03","modified_gmt":"2019-11-20T16:00:03","slug":"reducing-ui-automation-problems-to-debug","status":"publish","type":"post","link":"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/","title":{"rendered":"Reducing UI Automation Problems to Debug"},"content":{"rendered":"

How much time would you guess an average programmer spends on debugging code? The few studies I\u2019ve looked at estimate around 50% of the time. This is a great insight to improve one\u2019s efficiency. If extra thought is put into while writing the feature \/ script the first time, it can have a many times fold reduction in the time spent on debugging problems. Secondly if we get better at debugging, that too can have a large impact on a programmer\u2019s productivity<\/p>\n

In this article, with reference to UI automation, I\u2019ll briefly go over how to avoid having to debug more problems in the first place. Then some tips on debugging to increase the speed and effectiveness of fixes from my experience.<\/p>\n

Before we talk about how to debug, let\u2019s take a step back and discuss how to reduce the number of times we have to debug problems in the first place. With reference to UI automation problems, how to reduce flakiness, to manage maintenance time and debug lesser number of problems. Apart from flakiness, there are a few other common factors as well causing issues, being discussed further on.<\/p>\n

Avoiding flakiness<\/h2>\n

It is impossible to write a piece of code that would not have any problem ever, therefore debugging is inevitable. However, if a program is written with the deliberate intention to fix issues while the \u2018imminent\u2019 debug exercise, you and your team are in for a long and bumpy road. It\u2019s far better to spend extra time thinking over the algorithm and architectural impact \/ update instead of jumping right onto the implementation.<\/p>\n

Here are a few general tips on reducing \u2018inherent\u2019 flakiness and coding problems down the road.<\/p>\n

Code complexity<\/h2>\n

Luckily, I started my career on safety critical devices. One of the practices I picked from there was code complexity. A concept I don\u2019t see a lot of software development teams these days.<\/p>\n

\u201cCyclomatic Complexity\u201d is a software metric used to identify the complexity of a piece of code developed by Thomas J. McCabe, Sr in 1976 [1]<\/u><\/strong><\/a>. Using this (and other metrics) the complexity is calculated with the intent of requiring the code to be less than a specific benchmark value (for firmware written for embedded \/ IoT devices the benchmark is 30).<\/p>\n

The premise of the concept is, once the code goes above a certain threshold, the software is more prone to defects [1]<\/u> <\/strong><\/a>and can go into unknown states, therefore should limit the amount of complexity we add to our code. Going into the details of it would require a separate article, to summarize on reducing it, as the number of decisions increase within a method, break into multiple methods \/ classes \/ modules to reduce the complexity.<\/p>\n

Framework design principles<\/h2>\n

Quality is built into the design, cannot be painted on a product once it\u2019s developed. The same goes for automation code, if you don\u2019t have a carefully thought framework developed, there is no way you can have a stable automation run. Adding bandages on deeply infected wounds does not solve the problem, the root cause must be fixed.<\/p>\n

Pillars of framework design<\/h3>\n

In my experience, there are four \u201cpillars of automation framework design\u201d to be followed, specifically for UI automation projects which are maintainability, reusability, scalability and robustness. This is a very extensive and important subject. To get started you can go over all four pillars brief description in this article<\/strong><\/a>. Following best practices while architecting helps in reducing the number of issues we would see and must debug.<\/p>\n

Mostly flakiness in automated scripts is a direct result of poor architectural framework design. You can either face a problem learn from the mistakes and then correct them, or learn from other\u2019s experience and avoid introducing a problem. Best to learn from other\u2019s mistakes.<\/p>\n

Environment stability<\/h3>\n

An automation environment can include a lot of things, while all components of an environment are important, referring the few having the most impact on flakiness here.<\/p>\n

Test data<\/h3>\n

Pre-requisite test data is the most common reason of flakiness. Talking about test data under the test environment might be debatable, however the wrong test data management process (or the absence of one) can create havoc on your results. You can read more on the subject from this article<\/u><\/strong><\/a> written for TEST Magazine.<\/p>\n

Environment Setup<\/h3>\n

Setting the environment (especially in cases where you might be orchestrating one on the fly) for the AUT and automation can save lots of debugging time waste. Examples include setting browsers to use with settings like unblocking popups, clearing cache, browser restore settings, autocomplete features and more. OS settings like opening required ports \/ firewall settings, any installations needed might be as well.<\/p>\n

Patching<\/h3>\n

The patching and deployment process of your AUT. While this might not strictly come under the automation team\u2019s \u2018dominion\u2019, but can have a great impact on automation test runs. Errors in patching can happen especially where the process is not seasoned enough.<\/p>\n

Tools \/ Libraries<\/h3>\n

Tools and dependencies used for automation also need to be vetted. I\u2019ve seen tool\u2019s \/ library\u2019s bugs causing problems. For instance, tools crashing or giving unexpected errors. It\u2019s best to test for such possible issues during the selection process and test scalability of solutions to be used.<\/p>\n

Selection of scenarios to automate<\/h2>\n

Some tests are inherently going to cause problems during execution and be hard to maintain. Such tests are best not automated. This again is a separate subject on selection of tools to automate, here we\u2019ll mention only a few important ones.<\/p>\n

Features expected to go through major change can be put off until the feature is reasonably agreed upon and implemented. In case of rapid changes specifically around UI elements can cost more in maintenance than doing it manually the first few iterations.<\/p>\n

We talked about code complexity, AUT features can be complex as well which would also create similar problems to complex code. A very long test, or lots of different features being tested in one flow, or an inherently single complex feature can all have this effect. In many cases such scenarios can be broken down into multiple smaller cases reducing the complexity. In cases where that\u2019s not possible, might be best not to automate such scenarios, or have a strong strategy to do it.<\/p>\n

Debugging will live on<\/h2>\n

Taking all precautions to reduce code complexity and automate less complex features, following design principles, environment stability and choosing the right scenarios to automate might all reduce the number of problems you\u2019d have to debug, but will never reach the point where no maintenance or debugging would be needed. In the next post will go over tips on how to efficiently debug problems without growing a fat tumor worrying about fixing broken code.<\/p>\n<\/div>

<\/div><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":3,"featured_media":13803,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[54],"tags":[],"yoast_head":"\nReducing UI Automation Problems to Debug - Quality Spectrum<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Reducing UI Automation Problems to Debug - Quality Spectrum\" \/>\n<meta property=\"og:url\" content=\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/\" \/>\n<meta property=\"og:site_name\" content=\"Quality Spectrum\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-14T15:10:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-20T16:00:03+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/quality-spectrum.com\/wp-content\/uploads\/2018\/03\/kristian-gonzalez-308188-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1600\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@aali_khalid\" \/>\n<meta name=\"twitter:site\" content=\"@aali_khalid\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"http:\/\/quality-spectrum.com\/#organization\",\"name\":\"Quality Spectrum\",\"url\":\"http:\/\/quality-spectrum.com\/\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/alikhalid\/\",\"https:\/\/www.youtube.com\/c\/QualitySpectrum\",\"https:\/\/twitter.com\/aali_khalid\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/quality-spectrum.com\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/quality-spectrum.com\/wp-content\/uploads\/2019\/11\/QS-logo-mobile-e1574510459832.png\",\"width\":40,\"height\":40,\"caption\":\"Quality Spectrum\"},\"image\":{\"@id\":\"http:\/\/quality-spectrum.com\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/quality-spectrum.com\/#website\",\"url\":\"http:\/\/quality-spectrum.com\/\",\"name\":\"Quality Spectrum\",\"description\":\"Redefining software quality\",\"publisher\":{\"@id\":\"http:\/\/quality-spectrum.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"http:\/\/quality-spectrum.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/quality-spectrum.com\/wp-content\/uploads\/2018\/03\/kristian-gonzalez-308188-unsplash.jpg\",\"width\":2400,\"height\":1600},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#webpage\",\"url\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/\",\"name\":\"Reducing UI Automation Problems to Debug - Quality Spectrum\",\"isPartOf\":{\"@id\":\"http:\/\/quality-spectrum.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#primaryimage\"},\"datePublished\":\"2018-03-14T15:10:12+00:00\",\"dateModified\":\"2019-11-20T16:00:03+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/\"]}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#webpage\"},\"author\":{\"@id\":\"http:\/\/quality-spectrum.com\/#\/schema\/person\/4805a00d7139e111ea9430e17cc8f28c\"},\"headline\":\"Reducing UI Automation Problems to Debug\",\"datePublished\":\"2018-03-14T15:10:12+00:00\",\"dateModified\":\"2019-11-20T16:00:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/quality-spectrum.com\/#organization\"},\"image\":{\"@id\":\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#primaryimage\"},\"articleSection\":\"UI Automation\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/quality-spectrum.com\/reducing-ui-automation-problems-to-debug\/#respond\"]}]},{\"@type\":[\"Person\"],\"@id\":\"http:\/\/quality-spectrum.com\/#\/schema\/person\/4805a00d7139e111ea9430e17cc8f28c\",\"name\":\"Ali Khalid\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/quality-spectrum.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/70cbf539f218f275a77959dd2e56bddb?s=96&d=mm&r=g\",\"caption\":\"Ali Khalid\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/posts\/13802"}],"collection":[{"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/comments?post=13802"}],"version-history":[{"count":2,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/posts\/13802\/revisions"}],"predecessor-version":[{"id":13805,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/posts\/13802\/revisions\/13805"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/media\/13803"}],"wp:attachment":[{"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/media?parent=13802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/categories?post=13802"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/quality-spectrum.com\/wp-json\/wp\/v2\/tags?post=13802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}