How I can use addon proxy in test

  • 9 Replies
  • 1258 Views
How I can use addon proxy in test
« on: August 03, 2018, 10:06:31 am »
Hello,
I created and successfully uploaded addon. After that I download it by link and attach to project (via references).
And I cannot use it as is in your example - https://github.com/testproject-io/java-sdk-examples/tree/master/Web#crowd-code--addon-proxy

Please describe how I can use my addon in test.
My downloaded addon is here - https://drive.google.com/open?id=1rxGufcEMDxTiv2H5o0XJFidmR8trEOq8

Re: How I can use addon proxy in test
« Reply #1 on: August 03, 2018, 15:30:38 pm »
Can you please upload your original Addon's JAR?
It seems that something is missing and the proxy JAR has no relevant code to proxy.

Re: How I can use addon proxy in test
« Reply #2 on: August 03, 2018, 15:41:06 pm »

Re: How I can use addon proxy in test
« Reply #3 on: August 03, 2018, 16:06:14 pm »
We have identified the problem.
It is happening because your class "RandomDestination" has no package.

Until we fix the issue, please place your class "RandomDestination" in a package (e.g. 'mypkg')
Then please re-upload the addon and re-generate the proxy.

The proxy should have two classes inside -
  • io.testproject.proxy.addon.RandomDestination
  • io.testproject.proxy.addon.{YOUR_PACKAGE}.RandomDestination

You should use io.testproject.proxy.addon.RandomDestination.getRandomDestination() to obtain an instance of your Action's proxy.
Then you can pass this instance to the helper's executeProxy() method.

Hope this helps.

Re: How I can use addon proxy in test
« Reply #4 on: August 03, 2018, 16:27:06 pm »
Thank you. All is ok now.

Re: How I can use addon proxy in test
« Reply #5 on: August 03, 2018, 21:42:43 pm »
I added following code:
ActionProxy action = RandomDestination.getRandomDestination();
 helper.executeProxy(action);


When I execute test I see following error on  helper.executeProxy(action) line

ERROR io.testproject.java.sdk.v2.Runner - Failed to execute codeblock class com.testpoject.ievgen.tests.BasicTest
java.lang.NullPointerException: null
   at io.testproject.java.sdk.v2.tests.helpers.TestHelperEx.extractProxyResults(TestHelperEx.java:70) ~[io.testproject.sdk.java.jar:na]
   at io.testproject.java.sdk.v2.tests.helpers.TestHelperEx.executeProxy(TestHelperEx.java:51) ~[io.testproject.sdk.java.jar:na]
   at com.testpoject.ievgen.tests.BasicTest.execute(BasicTest.java:32) ~[bin/:na]
   at io.testproject.java.sdk.v2.Runner.execute(Runner.java:195) [io.testproject.sdk.java.jar:na]
   at io.testproject.java.sdk.v2.Runner.run(Runner.java:420) [io.testproject.sdk.java.jar:na]
   at io.testproject.java.sdk.v2.Runner.run(Runner.java:386) [io.testproject.sdk.java.jar:na]
   at io.testpoject.proxy.addon.RandomDestination.TestRunnerTest.main(TestRunnerTest.java:21) [bin/:na]


My original addon here - https://drive.google.com/open?id=11mIUZViLHo2Q6JVquw1MNVnNw5smiaJS

Re: How I can use addon proxy in test
« Reply #6 on: August 04, 2018, 18:58:57 pm »
Hi,

We fixed a bug, so can you please download the new SDK?
Let us know if it works well for you after that.

Thanks!

Re: How I can use addon proxy in test
« Reply #7 on: August 04, 2018, 23:05:39 pm »
I downloaded new version of SDK. And tried execute test with it.  The same error.
My test project in JAR file is here - https://drive.google.com/open?id=1-mZdojhMplJZkT0q1S3WKBWclIuKAx85

Do I need also add sdk to addon project and recreate jar file of add-on?

Re: How I can use addon proxy in test
« Reply #8 on: August 05, 2018, 16:16:34 pm »
All of your code references to the SDK should be updated.
In a nutshell, this is happening because your original add-on code throws an exception.
Before trying to execute it in a Test via proxy, I would suggest making sure it works in a stand-alone mode, via Runner and via TestProject Recorder.

Re: How I can use addon proxy in test
« Reply #9 on: August 07, 2018, 17:05:15 pm »
Locked due to inactivity.

 

Sitemap 1 2 3 4 5 6 7 8