diff options
author | Vadim Rutkovsky <vrutkovs@redhat.com> | 2014-04-24 18:23:52 +0800 |
---|---|---|
committer | Vadim Rutkovsky <vrutkovs@redhat.com> | 2014-04-24 18:24:23 +0800 |
commit | 17cd7112467f15c33ed9957a5f560178eb1c7385 (patch) | |
tree | 0b00cd43f68f37aeb4ac9bab7f801749113d5c98 /tests/environment.py | |
parent | 4ed443d42014474bcd7c91aa1561c48ee51c205d (diff) | |
download | gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.tar gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.tar.gz gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.tar.bz2 gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.tar.lz gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.tar.xz gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.tar.zst gsoc2013-evolution-17cd7112467f15c33ed9957a5f560178eb1c7385.zip |
tests: store the screenshot for failed tests
Diffstat (limited to 'tests/environment.py')
-rw-r--r-- | tests/environment.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/environment.py b/tests/environment.py index 2d6a09f479..76fe686380 100644 --- a/tests/environment.py +++ b/tests/environment.py @@ -7,6 +7,7 @@ if not isA11yEnabled(): from common_steps import App, dummy, cleanup from dogtail.config import config +import os def before_all(context): @@ -31,6 +32,20 @@ def before_all(context): print("Error in before_all: %s" % e.message) +def after_step(context, step): + try: + if step.status == 'failed' and hasattr(context, "embed"): + # Embed screenshot if HTML report is used + os.system("dbus-send --print-reply --session --type=method_call " + + "--dest='org.gnome.Shell.Screenshot' " + + "'/org/gnome/Shell/Screenshot' " + + "org.gnome.Shell.Screenshot.Screenshot " + + "boolean:true boolean:false string:/tmp/screenshot.png") + context.embed('image/png', open("/tmp/screenshot.png", 'r').read()) + except Exception as e: + print("Error in after_step: %s" % str(e)) + + def after_scenario(context, scenario): """Teardown for each scenario Kill evolution (in order to make this reliable we send sigkill) |