Skip to content

November 29, 2012

7

Thucydides Release 0.9.77 – Finer control on screenshots management

by rahulj51

We have released another version of Thucydides today. Release 0.9.77 contains the following features and bug fixes:

Finer screenshots control (Thucydides-105)

Whenever a step is executed, Thucydides saves a screenshot which is displayed in the report. In order to manage disk space better, some users require finer control on when and how many screenshots are generated and stored. Thucydides provided some support for this in the past by allowing users to set the properties thucydides.only.save.failing.screenshots for saving screenshots for only failed steps and thucydides.verbose.screenshots for saving screenshots at every web element action (like click(), typeAndEnter(), type(), typeAndTab() etc.).

In the latest release, these properties are deprecated and replaced with a new property thucydides.take.screenshots which can have the following values:

  • FOR_EACH_ACTION : Similar to thucydides.verbose.screenshots
  • BEFORE_AND_AFTER_EACH_STEP,
  • AFTER_EACH_STEP, and
  • FOR_FAILURES : Similar to thucydides.only.save.failing.screenshots

An even more granular level of control is now possible using annotations. You can annotate any test or step method (or any method used by a step or test) with the @Screenshots annotation to override the number of screenshots taken within this step (or sub-step). Some sample uses are shown here:

@Step
@Screenshots(onlyOnFailures=true)
public void screenshots_will_only_be_taken_for_failures_from_here_on() {…}

@Test
@Screenshots(forEachStep=true)
public void should_take_screenshots_for_each_step_in_this_test() {…}

@Test
@Screenshots(forEachAction=true)
public void should_take_screenshots_for_each_action_in_this_test() {…}

Other minor Bug fixes

  • Thucydides-89 : Fixed problem with tests failing randomly on Windows while building Thucydides.
  • Thucydides-96 : Fixed a bug that caused tests annotated with @WithDriver(“firefox”) to open in Internet Explorer browser.
  • Thucydides-108: Fixed a bug that caused Stories and Feature links on All Available tags section of Dashboard (report) to not work due to broken links.
Advertisements
Read more from News, Releases, Tips and Tricks
7 Comments Post a comment
  1. Dec 3 2012

    Reblogged this on new Tantchonta().getBlog().

    Reply
  2. Alex
    Dec 5 2012

    Would there be any chance of having thucydides-jbehave-archetype in maven? For now, there are only simple and easyb archetypes.

    Reply
    • Dec 5 2012

      Hi Alex,

      Can you raise a Jira ticket for this ?

      Reply
      • Alex
        Dec 6 2012

        Hi,
        thanks for your answer.
        Done – THUCYDIDES-113.

  3. Natali
    Feb 18 2013

    Dear John Smart and all members of Thucydides team

    Thank You very match for Your platform. It really helped to improve reporting for clients and management team. Also I personally like some of Thucydides features, which helped me to make my tests more readable and easy maintaining.
    But also I run into some problems with screenshots in my reports and @Screenshot annotation also wasn’t able to help me in this case…

    In test I open some links to check it not empty. I use code:

    import net.thucydides.core.annotations.Screenshots;
    import net.thucydides.core.annotations.Step;
    import net.thucydides.core.annotations.Title;
    import net.thucydides.core.pages.Pages;
    import net.thucydides.core.steps.ScenarioSteps;

    […]
    @Step
    @Title(“Check Page Elements”)
    public void open_page_elements() {
    WelcomePage page = getPages().currentPageAt(WelcomePage.class);
    clickTopMenuLink1();
    clickTopMenuLink2();
    clickTopMenuLink3();
    }

    @Step
    @Screenshots (forEachAction = true)
    public void clickTopMenuLink1 (){
    WelcomePage page = getPages().currentPageAt(WelcomePage.class);
    page.clickTopMenuLink1();
    }

    @Step
    @Screenshots (forEachAction = true)
    public void clickTopMenuLink2(){
    WelcomePage page = getPages().currentPageAt(WelcomePage.class);
    page.clickTopMenuLink2();
    }

    etc.

    But in report I got only screenshort of WelcomPage, but not of links, which opens on method clickTopMenuLink2. Test works correct and links opens. But in report management team and client didn’t see open links. For him test is failed (because they see only Welcome Page in all screenshorts), even if all steps was marked as successful.

    Is there any method to say Thucydides make screenshort in one fixed moment. For example:

    @Step
    public void clickTopMenuLink2(){
    WelcomePage page = getPages().currentPageAt(WelcomePage.class);
    Link2Page page2 = getPages().currentPageAt(Link2Page.class);
    page.clickTopMenuLink2();
    page2.confirmGreeting();
    Thucydides make screenshort
    page2.clickBackButton();
    }

    Thank You in advance for Your attention

    Reply
    • Feb 18 2013

      Hi Natall,

      I will add a feature like this in the next release. In the meantime, you can wrap references to your WebElements in a WebElementFacade using the element() or $() methods in your PageObject: this will cause a screenshot to be taken on every click or entered text, e.g.

      public class WelcomePage extends PageObject {

      @FindBy(linkText=”Whatever”)
      WebElement topMenu2;

      public void clickTopLenuLink2() {
      $(topMenu2).click();
      }
      }

      Also, with the latest version of Thucydides, you don’t need to use currentPageAt() anymore: you can just declare a variable of your PageObject and use open() to open the default page URL, e.g.

      public class WelcomeSteps extends ScenarioSteps {

      WelcomePage welcomePage;

      @Step
      public void clickTopMenu2() {
      welcomePage.open();
      welcomePage.clickTopMenuLink2();

      }

      Cheers,

      John.

      Reply

Trackbacks & Pingbacks

  1. Thucydides Release 0.9.98 – Better screenshots management | Official Thucydides Web Test Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: