cancel
Showing results for 
Search instead for 
Did you mean: 

Hosting the application on my own server

New Contributor

Hosting the application on my own server

Can I host my application on my own server and use that to test with cucumber using smartbear lib? Is this possible at all - When I try, its getting me a null response

4 REPLIES 4
Community Manager

Re: Hosting the application on my own server

 

Hi Priyarajan,

 

 

We need more information to better understand what is going on. Could you please explain in detail what you have done and the results you see?

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Contributor

Re: Hosting the application on my own server

 Here are more details - Am trying to write a CustomizedRecipeExecutor that is a subtotute for RecipeExecutor and am trying to run my application on my localhost and trying to run a cucumber test and am trying to contact the application running on my localhost

 

My StepDefinitions.java has this code

 URL url = null;
        try {
            url = new URL( "http://localhost:8083");
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        executor = new CustomizedRecipeExecutor(Scheme.valueOf(url.getProtocol().toUpperCase()),
                url.getHost(), url.getPort()); 
    }

    @When("^a request to the API listing is made$")
    public void requestToAPIListing() throws Throwable {
        testStep = new RestTestRequestStep();
        testStep.setURI("http://localhost:8083/api/admin/getTestSpecIds");
        testStep.setMethod(TestSteps.HttpMethod.GET.name());
        testStep.setType(TestStepTypes.REST_REQUEST.getName());
        System.out.println(testStep.toString());

    }

Here are the results - Execution is itself null

 

class RestTestRequestStep {
class RequestTestStepBase {
class TestStep {
type: null
name: null
}
type: null
name: null
URI: null
requestBody: null
authentication: null
assertions: []
headers: {}
encoding: null
timeout: null
followRedirects: false
entitizeParameters: false
}
type: REST Request
name: null
URI: http://localhost:8083/api/admin/getTestSpecIds
requestBody: null
authentication: null
assertions: []
headers: {}
encoding: null
timeout: null
followRedirects: false
entitizeParameters: false
method: GET
parameters: []
mediaType: null
postQueryString: false
}
Error received when sending test recipe to server
null
at com.smartbear.readyapi.client.execution.ApiClientWrapper.invokeAPI(ApiClientWrapper.java:141)
at com.smartbear.readyapi.client.execution.CodegenBasedTestServerApi.invokeAPI(CodegenBasedTestServerApi.java:227)
at com.smartbear.readyapi.client.execution.CodegenBasedTestServerApi.postTestRecipe(CodegenBasedTestServerApi.java:64)
at com.smartbear.readyapi.client.execution.CustomizedRecipeExecutor.doExecuteTestCase(CustomizedRecipeExecutor.java:100)
at com.smartbear.readyapi.client.execution.CustomizedRecipeExecutor.executeRecipe(CustomizedRecipeExecutor.java:72)
at org.caltesting.tss.services.StepDefinitions.runTest(StepDefinitions.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cucumber.runtime.Utils$1.call(Utils.java:37)
at cucumber.runtime.Timeout.timeout(Timeout.java:13)
at cucumber.runtime.Utils.invoke(Utils.java:31)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:223)
at cucumber.runtime.Runtime.runHooks(Runtime.java:211)
at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:205)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.api.testng.TestNGCucumberRunner.runCukes(TestNGCucumberRunner.java:50)
at org.caltesting.tss.services.TSSAdminServiceImplTest.runCukes(TSSAdminServiceImplTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
exceution;;;;;;null
Failure in after hook:StepDefinitions.runTest()
Message: java.lang.NullPointerException
at org.caltesting.tss.services.StepDefinitions.runTest(StepDefinitions.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cucumber.runtime.Utils$1.call(Utils.java:37)
at cucumber.runtime.Timeout.timeout(Timeout.java:13)
at cucumber.runtime.Utils.invoke(Utils.java:31)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:223)
at cucumber.runtime.Runtime.runHooks(Runtime.java:211)
at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:205)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.api.testng.TestNGCucumberRunner.runCukes(TestNGCucumberRunner.java:50)
at org.caltesting.tss.services.TSSAdminServiceImplTest.runCukes(TSSAdminServiceImplTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

java.lang.NullPointerException
at org.caltesting.tss.services.StepDefinitions.runTest(StepDefinitions.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cucumber.runtime.Utils$1.call(Utils.java:37)
at cucumber.runtime.Timeout.timeout(Timeout.java:13)
at cucumber.runtime.Utils.invoke(Utils.java:31)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:223)
at cucumber.runtime.Runtime.runHooks(Runtime.java:211)
at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:205)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.api.testng.TestNGCucumberRunner.runCukes(TestNGCucumberRunner.java:50)
at org.caltesting.tss.services.TSSAdminServiceImplTest.runCukes(TSSAdminServiceImplTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)


Scenario: Default API Listing # org/caltesting/tss/features/adminapi.feature:2
When a request to the API listing is made # StepDefinitions.requestToAPIListing()
Then a list of APIs should be returned within 500ms # StepDefinitions.validResponseTimeTest(int)

Failed scenarios:
org/caltesting/tss/features/adminapi.feature:2 # Scenario: Default API Listing

1 Scenarios (1 failed)
2 Steps (2 passed)
0m1.932s

java.lang.NullPointerException
at org.caltesting.tss.services.StepDefinitions.runTest(StepDefinitions.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cucumber.runtime.Utils$1.call(Utils.java:37)
at cucumber.runtime.Timeout.timeout(Timeout.java:13)
at cucumber.runtime.Utils.invoke(Utils.java:31)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:223)
at cucumber.runtime.Runtime.runHooks(Runtime.java:211)
at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:205)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.api.testng.TestNGCucumberRunner.runCukes(TestNGCucumberRunner.java:50)
at org.caltesting.tss.services.TSSAdminServiceImplTest.runCukes(TSSAdminServiceImplTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.899 sec <<< FAILURE! - in org.caltesting.tss.services.TSSAdminServiceImplTest

Results :

Failed tests:
TSSAdminServiceImplTest.runCukes:26 » Cucumber java.lang.NullPointerException

Community Manager

Re: Hosting the application on my own server

Hi,

Thanks for sending this information. I don't have a ready solution for you right now - I have never worked with test recipes. 

I suggest that you submit your question (with this detailed information) to our Customer Care Team. They will investigate your scenario with our R&D Team and come back to you with the solution.

You can reach out to the Support Team here: http://support.smartbear.com/product-list/

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Hosting the application on my own server

@priyarajan Please have a look at TestServer Cucumber project: https://github.com/readyapi/testserver-cucumber. Feel free to come back with questions or if you need help.

New Here?
Join us and watch the welcome video:
Final Interview in the Series
API_testing_mistake#7