Forum Discussion

kavansays's avatar
kavansays
Contributor
9 years ago

Dispatch not hooked to windows memory

Hi All,

We have Done TestComplete and API(Cucumber) integration and trying to run testcomplete scripts through cucumber.

But while execution sometimes it throws below error ..

-----------------------------------------------------------------------------------------

java.lang.IllegalStateException: Dispatch not hooked to windows memory
at com.jacob.com.Dispatch.throwIfUnattachedDispatch(Dispatch.java:288)
at com.jacob.com.Dispatch.invoke(Dispatch.java:501)
at com.smartbear.cucumber.TestComplete$TestCompleteRunner.CallMethod(TestComplete.java:246)
at com.smartbear.cucumber.TestComplete.RunRoutine(TestComplete.java:83)
at com.tullett.indms.accpt.steps.AmendSteps.amend_trade_from_UI(AmendSteps.java:4274)
at ✽.When Amend trade for commission from UI(src/test/resources/accpt2/TestCompleteIntegration.feature:11)

-----------------------------------------------------------------------------------------------------------------------------------------

 

Can someone please suggest what are we missing on to implement?

 

Eclipse: Eclipse Java EE IDE for Web Dev - Mars Release 4.5.0

TestComplete: 10.60.3387.7

 

Thanks in Advance,

Kavan Shah

5 Replies

    • kavansays's avatar
      kavansays
      Contributor

      Thanks EVarnavsky, we already tried this link but no luck.. Below is the actual code we tried, if you could find the solution..

       

      ->> Actual Code

      @When("^Amend trade for commission from UI$")
      public void amend_trade_from_UI() throws Throwable {
      TestCompleteWorld.TC().RunRoutine("Amend_Commission.Fn_AmendCommission", processedOmsId);
      log.info("Amend Trade(Comment) through GUI automation Successful---->"
      );
      }


      We tried Below code:
      -----------------------------------------------------------------------------------------
      '->> Throws null pointer exception because vtc remains null after execution.

       

      @When("^Amend trade for commission from UI$")
      public void amend_trade_from_UI() throws Throwable {
      Variant vtc = null;
      try {
      vtc = TestCompleteWorld.TC().RunRoutine("Amend_Commission.Fn_AmendCommission", processedOmsId);
      } catch (Exception e) {
      // TODO Auto-generated catch block
      ActiveXComponent act = new ActiveXComponent(vtc.toDispatch());

      }

      log.info("Amend Trade(Comment) through GUI automation Successful---->");
      }
      -----------------------------------------------------------------------------------------

       

      Cheers,

      Kavan Shah