1

We are using QAF for our mobile automation. And there is 1 step in .bdd file which is common and also actually the first step for many of the tests .

    META-DATA: {"author":"<XXX>","description":"SRS-HLP-001-001", "fullReset":true ,groups:[ "EXISTING_USER" , "IOS" , "ANROID" , "REGRESSION_1" , "HELP" ]}
    Given User waits for sometime

And the step definition is:

    @QAFTestStep(description = "User waits for sometime")
    public void stepDefinitionMethodName() throws InterruptedException {
        Thread.sleep(5000);
    }

On executing the test, I see that the test is actually skipped very often and also in random. And the reason for failure:

com.qmetry.qaf.automation.step.StepInvocationException: Unable to Instantiate JavaStep: []

Eclipse/TestNG Report doesn't show anything other than this.

Appium Logs says this:

[debug] [XCUITest] Checking whether app '/var/folders/_j/9fbrggk96v3b44hlbshdp9tm0000gn/T/2020219-5328-duszjq.92kdd/Payload/.app' is actually present on file system[error] [XCUITest] Error: Connection was refused to port 51487 [error] [XCUITest] at Usbmux.connect (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-ios-device/lib/usbmux/index.js:183:13) [info] [DevCon Factory] Releasing connections for 202bc3b5a4c4571e98c08785b278002c7deed0f3 device on any port number [info] [DevCon Factory] No cached connections have been found [debug] [BaseDriver] Event 'newSessionStarted' logged at 1584634979919 (21:52:59 GMT+0530 (IST)) [debug] [W3C] Encountered internal error running command: Error: Connection was refused to port 51487 [debug] [W3C] at Usbmux.connect (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-ios-device/lib/usbmux/index.js:183:13) [info] [HTTP] <-- POST /wd/hub/session 500 40513 ms - 702

And in the next run, the same test might pass.

Looking at the step implementation, it is very simple as it uses thread.sleep to wait for 5 secs. I can't think of any reason why this test step should throw the above error.

The above step was from the below scenario. I removed the above step and re-executed the test. And again it failed as below:

#SRS-HLP-001-001
SCENARIO: <description>
META-DATA: {"author":"<XXX>","description":"SRS-HLP-001-001", "fullReset":true ,groups:[ "EXISTING_USER" , "IOS" , "ANROID" , "REGRESSION_1" , "HELP" ]}
    Given User accepts Alert box if any
    And Verify user is navigated to home screen, else login with "${login.user_name}" and "${login.password}"
    And User accepts Alert box if any
    Then Verify main Help screen will be displayed Help tab is clicked
END

@QAFTestStep(description = "User accepts Alert box if any")
    public void acceptAlerts() throws InterruptedException {
        handleBTPermissionAlert();
        handlePNSPermissionAlert();
    }

And this is the error in eclipse:

com.qmetry.qaf.automation.step.StepInvocationException: Unable to Instantiate JavaStep: acceptAlerts[]

And this is the listener details:

<test enabled="true" name="Help">
        <parameter name="env.resources"
            value="resources/data;resources/ios" />
        <parameter name="step.provider.pkg"
            value="qaf.<xxx>.tests;qaf.<xxx>.steps;qaf.<xxx>.ios.steps" />
        <parameter name="appium.capabilities.app"
            value="<path to the app>" />
        <parameter name="scenario.file.loc" value="scenarios/Help.bdd" />
        <classes>
            <class>
                name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory" />
        </classes>
    </test>

And this is the ivy.xml used.

<ivy-module version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="com.qmetry" module="QAF" status="integration">
    </info>
    
    <dependencies>
        <dependency org="com.qmetry" name="qaf" rev="2.1.15" force="true"/>
        <dependency org="com.qmetry" name="qaf-support" rev="2.1.13" />
        <dependency org="com.qmetry" name="qaf-support-ws" rev="2.1.15" />
        <dependency org="org.aspectj" name="aspectjtools" rev="1.9.5"/>
        <dependency org="org.aspectj" name="aspectjweaver" rev="1.9.5" />
        <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"/>
        <dependency org="io.appium" name="java-client" rev="7.3.0"/>
        <dependency org="org.seleniumhq.selenium" name="selenium-java" rev="3.141.59" force="true"/>
    </dependencies>
</ivy-module>

Help needed on how to make sure the test cases are not skipped frequently.

user861594
  • 5,733
  • 3
  • 29
  • 45
Vishwathma
  • 91
  • 1
  • 10

1 Answers1

1

Issue looks more related to appium. If problem is from step stepDefinitionMethodName implementation, you can try updating as below:

@QAFTestStep(description = "User waits for sometime")
public void stepDefinitionMethodName() {
    QAFTestBase.pause(5000);
}

@QAFTestStep(description = "User accepts Alert box if any")
public void acceptAlerts(){
    try{
       handleBTPermissionAlert();
       handlePNSPermissionAlert();
    }catch(InterruptedException e){
       throw new AutomationError(e);
    }
}
user861594
  • 5,733
  • 3
  • 29
  • 45