Forum Discussion

vikram_u_k's avatar
vikram_u_k
Contributor
8 years ago

Get Screenshot from Android using Cucumber

Hi Team/Support,

   We are checking for certain attributes(color/font and size) of text that are not listed as object attributes nor methods exist to get their attributes for comparision.

 

With Cucumber we have implemented steps to call routines in the testComplete Scripts as per CucumberStubs example.

Our current task is to get the screenshots generated in the stubs back onto the Cucumber Report(the THEN condition in particular as it has multiple attributes to be validated).

 

In particular the screenshot is stored in the log folder with unique names. Could we expect to get this image name exported?.

Is there a article which helps provide some direction in getting the screenshot so that we may automate the GIVEN, WHEN steps but have the screenshot from the THEN condition verified manually.

  • Hi,

      we resolved using the  @After    tag.

     

    @After
    	public void tearDown(Scenario scenario) throws IOException {
    		if (takeScreenshot() == true) {
    			final byte[] screenshot = getImageAsByteArray();
    			scenario.embed(screenshot, "image/png");
    		} else {
    			System.out.println("Error in capturing the screenshot");
    		}
    	}
  • Hi Support/Forum,
    We were using 11.30 Testcomplete earlier and have moved to the newer 12.01. Is there any newer version of the TestComplete Jar file available.

     

    I would like to know if there are any methods to export the screenshots from Android (filename/path).

      • vikram_u_k's avatar
        vikram_u_k
        Contributor

        Hi,

          we resolved using the  @After    tag.

         

        @After
        	public void tearDown(Scenario scenario) throws IOException {
        		if (takeScreenshot() == true) {
        			final byte[] screenshot = getImageAsByteArray();
        			scenario.embed(screenshot, "image/png");
        		} else {
        			System.out.println("Error in capturing the screenshot");
        		}
        	}
    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      vikram_u_k wrote:

      Hi Support/Forum,
      We were using 11.30 Testcomplete earlier and have moved to the newer 12.01. Is there any newer version of the TestComplete Jar file available.

       

      I would like to know if there are any methods to export the screenshots from Android (filename/path).


      See my response in your other thread... when you installed TC 12, there should be a new version of the JAR installed as well.

      • vikram_u_k's avatar
        vikram_u_k
        Contributor

        Hi Robert,

           No, i was unable to find any new jar's in these paths.

        C:\Program Files (x86)\SmartBear

        C:\Users\XXYY\Documents  sample projects.

         

        For now we are able to get the Screenshots via the adb shell.