title: QAF: com.qmetry.qaf.automation.step.StepInvocationException: Unable to Instantiate JavaStep: <stepDefinition Method name>
body: <p>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 .</p>
  <pre><code>    META-DATA: {&quot;author&quot;:&quot;&lt;XXX&gt;&quot;,&quot;description&quot;:&quot;SRS-HLP-001-001&quot;, &quot;fullReset&quot;:true ,groups:[ &quot;EXISTING_USER&quot; , &quot;IOS&quot; , &quot;ANROID&quot; , &quot;REGRESSION_1&quot; , &quot;HELP&quot; ]}
      Given User waits for sometime
  </code></pre>
  <p>And the step definition is:</p>
  <pre><code>    @QAFTestStep(description = &quot;User waits for sometime&quot;)
      public void stepDefinitionMethodName() throws InterruptedException {
          Thread.sleep(5000);
      }
  </code></pre>
  <p>On executing the test, I see that the test is actually skipped very often and also in random.
  And the reason for failure:</p>
  <blockquote>
  <p>com.qmetry.qaf.automation.step.StepInvocationException: Unable to Instantiate JavaStep: []</p>
  </blockquote>
  <p>Eclipse/TestNG Report doesn't show anything other than this.</p>
  <p>Appium Logs says this:</p>
  <blockquote>
  <p>[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] &lt;-- POST /wd/hub/session 500 40513 ms - 702</p>
  </blockquote>
  <p>And in the next run, the same test might pass.</p>
  <p>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.</p>
  <p>The above step was from the below scenario. I removed the above step and re-executed the test. And again it failed as below:</p>
  <pre><code>#SRS-HLP-001-001
  SCENARIO: &lt;description&gt;
  META-DATA: {&quot;author&quot;:&quot;&lt;XXX&gt;&quot;,&quot;description&quot;:&quot;SRS-HLP-001-001&quot;, &quot;fullReset&quot;:true ,groups:[ &quot;EXISTING_USER&quot; , &quot;IOS&quot; , &quot;ANROID&quot; , &quot;REGRESSION_1&quot; , &quot;HELP&quot; ]}
      Given User accepts Alert box if any
      And Verify user is navigated to home screen, else login with &quot;${login.user_name}&quot; and &quot;${login.password}&quot;
      And User accepts Alert box if any
      Then Verify main Help screen will be displayed Help tab is clicked
  END
  
  @QAFTestStep(description = &quot;User accepts Alert box if any&quot;)
      public void acceptAlerts() throws InterruptedException {
          handleBTPermissionAlert();
          handlePNSPermissionAlert();
      }
  </code></pre>
  <p>And this is the error in eclipse:</p>
  <blockquote>
  <p>com.qmetry.qaf.automation.step.StepInvocationException: Unable to Instantiate JavaStep: acceptAlerts[]</p>
  </blockquote>
  <p>And this is the listener details:</p>
  <pre><code>&lt;test enabled=&quot;true&quot; name=&quot;Help&quot;&gt;
          &lt;parameter name=&quot;env.resources&quot;
              value=&quot;resources/data;resources/ios&quot; /&gt;
          &lt;parameter name=&quot;step.provider.pkg&quot;
              value=&quot;qaf.&lt;xxx&gt;.tests;qaf.&lt;xxx&gt;.steps;qaf.&lt;xxx&gt;.ios.steps&quot; /&gt;
          &lt;parameter name=&quot;appium.capabilities.app&quot;
              value=&quot;&lt;path to the app&gt;&quot; /&gt;
          &lt;parameter name=&quot;scenario.file.loc&quot; value=&quot;scenarios/Help.bdd&quot; /&gt;
          &lt;classes&gt;
              &lt;class&gt;
                  name=&quot;com.qmetry.qaf.automation.step.client.text.BDDTestFactory&quot; /&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  </code></pre>
  <p>And this is the ivy.xml used.</p>
  <pre><code>&lt;ivy-module version=&quot;2.0&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:noNamespaceSchemaLocation=&quot;http://ant.apache.org/ivy/schemas/ivy.xsd&quot;&gt;
      &lt;info organisation=&quot;com.qmetry&quot; module=&quot;QAF&quot; status=&quot;integration&quot;&gt;
      &lt;/info&gt;
      
      &lt;dependencies&gt;
          &lt;dependency org=&quot;com.qmetry&quot; name=&quot;qaf&quot; rev=&quot;2.1.15&quot; force=&quot;true&quot;/&gt;
          &lt;dependency org=&quot;com.qmetry&quot; name=&quot;qaf-support&quot; rev=&quot;2.1.13&quot; /&gt;
          &lt;dependency org=&quot;com.qmetry&quot; name=&quot;qaf-support-ws&quot; rev=&quot;2.1.15&quot; /&gt;
          &lt;dependency org=&quot;org.aspectj&quot; name=&quot;aspectjtools&quot; rev=&quot;1.9.5&quot;/&gt;
          &lt;dependency org=&quot;org.aspectj&quot; name=&quot;aspectjweaver&quot; rev=&quot;1.9.5&quot; /&gt;
          &lt;dependency org=&quot;ant-contrib&quot; name=&quot;ant-contrib&quot; rev=&quot;1.0b3&quot;/&gt;
          &lt;dependency org=&quot;io.appium&quot; name=&quot;java-client&quot; rev=&quot;7.3.0&quot;/&gt;
          &lt;dependency org=&quot;org.seleniumhq.selenium&quot; name=&quot;selenium-java&quot; rev=&quot;3.141.59&quot; force=&quot;true&quot;/&gt;
      &lt;/dependencies&gt;
  &lt;/ivy-module&gt;
  </code></pre>
  <p>Help needed on how to make sure the test cases are not skipped frequently.</p>