{"componentChunkName":"component---node-modules-gatsby-theme-medium-to-own-blog-src-templates-blog-post-js","path":"/aop-nunit-and-selenium-clever-screenshots-of-failures/","result":{"data":{"site":{"siteMetadata":{"siteUrl":"https://javame.netlify.app","githubUrl":"https://github.com/aterreno/blog"}},"mdx":{"fields":{"slug":"/aop-nunit-and-selenium-clever-screenshots-of-failures/"},"excerpt":"Last week I did struggle finding out why a test was failing only on our Cruise box, only in the Cruise build. I wanted to get a screenshot…","timeToRead":1,"frontmatter":{"title":"AOP, NUnit and Selenium: clever screenshots of failures","description":"","categories":[],"date":"February 07, 2010","canonical_link":"https://javame.netlify.app//aop-nunit-and-selenium-clever-screenshots-of-failures-839dfed450e2"},"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"AOP, NUnit and Selenium: clever screenshots of failures\",\n  \"description\": \"\",\n  \"date\": \"2010-02-07T00:00:00.000Z\",\n  \"categories\": [],\n  \"published\": true,\n  \"canonical_link\": \"https://javame.netlify.app//aop-nunit-and-selenium-clever-screenshots-of-failures-839dfed450e2\",\n  \"redirect_from\": [\"/aop-nunit-and-selenium-clever-screenshots-of-failures-839dfed450e2\"]\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Last week I did struggle finding out why a test was failing only on our Cruise box, only in the Cruise build.\"), mdx(\"p\", null, \"I wanted to get a screenshot of each failing tests, and I think I found a clever solution: aop.\"), mdx(\"p\", null, \"We already use \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://www.postsharp.org/\",\n    \"target\": \"_blank\",\n    \"rel\": \"nofollow noopener noreferrer\"\n  }), \"PostSharp\"), \" on our code base for logging, transaction demarcation and hibernate session support, so I wrote a simple annotation for our acceptance tests:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"using System;\\nusing PostSharp.Laos;\\n\\nnamespace Web.UI.AcceptanceTests\\n{\\n        [Serializable]\\n        public class ScreenCaptureAttribute : OnExceptionAspect\\n        {\\n                public override void OnException(MethodExecutionEventArgs eventArgs)\\n                {\\n                        SeleniumManager.Selenium.CaptureScreenshot(string.Format(\\\"C:\\\\{0}.jpg\\\", eventArgs.Method.Name));\\n                }\\n        }\\n}\\n\")), mdx(\"p\", null, \"Every time a test will throw an Exception Selenium will take a screenshot of the screen: pretty simple.\"), mdx(\"p\", null, \"The only caveat is that it won\\u2019t work if Cruise is running as a service, and to get a decent result you\\u2019ll probably need to maximize the web browser windows.\"));\n}\n;\nMDXContent.isMDXComponent = true;"},"allWebMentionEntry":{"nodes":[]}},"pageContext":{"id":"32e521e0-361f-533f-b1d9-70d55a09173b","previous":{"id":"bb4be58b-ad82-54cd-bdcd-adc378096bd3","fields":{"slug":"/suffering-of-selenese-flu-try-webdriver/","published":true},"frontmatter":{"redirect_from":["/suffering-of-selenese-flu-try-webdriver-3759b0236013"],"redirect_to":null,"title":"Suffering of Selenese Flu? Try webdriver"}},"next":{"id":"5c2a3100-a76b-5486-ab79-ec373e84b2ec","fields":{"slug":"/the-unknown-variable-che-guevara-theories-applied-to-agile-teams/","published":true},"frontmatter":{"redirect_from":["/the-unknown-variable-che-guevara-theories-applied-to-agile-teams-a3f4df26df79"],"redirect_to":null,"title":"The unknown variable, Che Guevara theories applied to agile teams"}},"permalink":"https://javame.netlify.app/aop-nunit-and-selenium-clever-screenshots-of-failures/","themeOptions":{"plugins":[],"config":{"title":"Antonio Terreno","description":"Antonio Terreno's blog archive","shortBio":"","bio":"Principal Consultant at Equal Experts","author":"Antonio Terreno","githubUrl":"https://github.com/aterreno/blog","siteUrl":"https://javame.netlify.app/","social":{"twitter":"javame","medium":"","facebook":"","github":"aterreno","linkedin":"antonioterreno","instagram":"tritonitri"},"goatCounterCode":null}}}},"staticQueryHashes":["4131332129","645483741"]}