Note: This command is available only from a code environment
collectSupportData(String zipDestination, String applicationPath, String device,String scenario, String expectedResult, String actualResult)
|
|
|
|
|
|
|
This command is used to collect the support data (consist of error.log, device.log, Silk Mobile .log etc) during run time.
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 recognize under the device manager.
scenario: Description of the scenario.
expectedResult: The result as expected.
actualResult: The actual result.
This command can be used to collect support data as part of the recovery mechanism in case of a failure.
Scenario: In the following example we will override the Silk Mobile Client in case of Click command. In case it will fail, 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, intport) { 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 test{ private String host ="localhost"; private int port = 8896; protected MyClientclient =null; @Before public void setUp(){ MyClient = new Client(host, port, true); MyClient.setReporter("xml", "reports","Untitled"); } @Test public void CollectSupportData(){ public void testeribank_ass3(){ MyClient.setDevice("adb:GT-I9300"); MyClient.openDevice(); MyClient.launch("com.experitest.ExperiBank/.LoginActivity", true, false); MyClient.elementSendText("NATIVE","hint=Username", 0,"company"); MyClient.elementSendText("NATIVE","hint=Password", 0,"company"); MyClient.verifyElementFound("NATIVE","text=Login", 0); MyClient.MyClick("NATIVE","text=Login", 0, 1); MyClient.verifyElementFound("NATIVE","id=makePaymentButton", 0); MyClient.sleep(1000); MyClient.MyClick("NATIVE","text=Logout", 0, 1); MyClient.closeDevice(); } } @After public void tearDown(){ MyClient.generateReport(true); } } Step 3: Run test.java
Step 4: Whenever click the supportData.zip will be collected under the mentioned location.