Page tree
Skip to end of metadata
Go to start of metadata
Note: This command is available only from a code environment

collectSupportData(String zipDestination, String applicationPath, String device,String scenario, String expectedResult, String actualResult)

collectSupportData(String zipDestination, String applicationPath, String device,String scenario, String expectedResult, String actualResult, boolean withCloudData, boolean onlyLatestLogs)

Supported in iOS Supported in Android

Description

This command is used to collect the support data (consist of error.log, device.log, SeeTestAutomation.log etc) during run time.

Parameters

  • zipDestination: The path in which the zip will be saved. If empty, a default path will be used.
  • applicationPath: An absolute path to the application file location on the PC.
  • device: Name of device as it recognized under the device manager.
  • scenario: Description of the scenario.
  • expectedResult: The result as expected.
  • actualResult: The actual result.
  • withCloudData: (Default: false) For remote devices, include SeeTestCloud logs in the support folder. Only available to cloud admin users.

  • onlyLatestLogs: (Default: true) Include only latest logs in the support folder

Usage

This command can be used to collect support data as part of the recovery mechanism in case of a failure.

Example:

Scenario: In the following example we will override the SeeTestAutomation Client in case of Click command. In case it fails, as part of the recovery, we will collect the support data to understand what happens. 

Step 1: Create MyClient.java class which will extend the Client.

We will override the click method to add recovery mechanism where support data will be collected if command will fail. When catching exception support data will be collected.

This way, for every click command on the script, support data will be collected.

Code should be like this:

import com.experitest.client.Client;
public class MyClient extends Client{
       public MyClient(String host, int port, boolean useSessionID) {
              super(host, port, true);
       }   
public void myClick(String zone, String element, int index, int clickCount)
  {
       try{
              super.click(zone, element, index, clickCount);
          } catch(Exception e)
          {
        super.collectSupportData("C:\\supportData.zip", <Installation folder path>\bin\ipas\eribank.apk,"adb:GT-I9300","click error", "expected click to work", "click has failed");    
         }
 }
 }

Step 2: Create a script of the login scenario on the EriBank demo application.

Please note that we are using MyClient class now and the overriding commands (MyClick)

Example code look like this:

import org.junit.*;
public class CollectSupportDataExample{
        private String host ="localhost";
        private int port = 8896;
        protected MyClient client =null;
         @Before
         public void setUp(){
             client = new MyClient(host, port, true);   
             client.setReporter("xml", "reports","Untitled");
         }
         @Test
         public void testEriBank(){
          client.setDevice("adb:GT-I9300");
          client.openDevice();
          client.launch("com.experitest.ExperiBank/.LoginActivity", true, false);
          client.elementSendText("NATIVE","hint=Username", 0,"company");
          client.elementSendText("NATIVE","hint=Password", 0,"company");
          client.verifyElementFound("NATIVE","text=Login", 0);   
          client.myClick("NATIVE","text=Login", 0, 1);
          client.verifyElementFound("NATIVE","id=makePaymentButton", 0);
          client.sleep(1000);
          client.myClick("NATIVE","text=Logout", 0, 1);
          client.closeDevice();
          
         }
         @After
         public void tearDown(){    
          client.generateReport(true);
         }
   } 

Step 3: Run test.java

Step 4: Whenever click the supportData.zip will be collected under the mentioned location.

  • No labels