cancel
Showing results for 
Search instead for 
Did you mean: 

How to get test step response in readyAPI using Java?

SOLVED
Highlighted
Contributor

Re: How to get test step response in readyAPI using Java?

Hi nmrao. Thanks for help. I tried with WsdlProjectPro. Now I'm getting null pointer exception while executing, Please find my code

public void test() {

		final String testProjectFileNameStr = "C:\\Users\\akrishnan\\git\\automation\\";

		ProxySelector.getDefault();

		final WsdlProjectPro project = new WsdlProjectPro(testProjectFileNameStr);
		final String name = project.getName();
		System.out.println(name);

		final WsdlTestSuitePro testSuite = (WsdlTestSuitePro) project.getTestSuiteByName("InitiateTransfer");

		final int numOfTestCases = testSuite.getTestCaseCount();

		System.out.println("Number Of Test Cases: " + numOfTestCases);

		for (int i = 0; i < numOfTestCases; i++) {

			testCase = (WsdlTestCasePro) testSuite.getTestCaseAt(i);

			final String test = testCase.getName();

			System.out.println(test);

			final int numOfTestSteps = testCase.getTestStepCount();

			System.out.println("Number of Test Steps: " + numOfTestSteps);

			for (int j = 0; j < numOfTestSteps; j++) {
				// String reasonStr = "";
				final WsdlTestStep testStep = testCase.getTestStepAt(j);

				final String testStepNameStr = testStep.getName();

				final int countSteps = j + 1;
				System.out.println(countSteps);
				// KSU.testStepsOut(countSteps, testStepNameStr);

				final WsdlTestCaseRunner testRunner = new WsdlTestCaseRunner(testCase, null);

				soapResult = testRunner.runTestStepByName(testStepNameStr);

				final Status result = testRunner.getStatus();
				final String resultStr = result.toString();
				System.out.println(resultStr);

			}
		}

	}

In the above code snippet, I'm getting null pointer in final WsdlTestCaseRunner testRunner = new WsdlTestCaseRunner(testCase, null);

 

Can we use WsdlTestCaseRunner to run the case or we have to use something else specifically for soapui-pro?

 

FAILED: test
java.lang.NullPointerException
	at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.checkSaveMetrics(WsdlTestCaseRunner.java:84)
	at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.<init>(WsdlTestCaseRunner.java:36)
	at com.interac.oas.payments.SoapRunner.test(SoapRunner.java:93)
	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:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at org.testng.TestRunner.privateRun(TestRunner.java:744)
	at org.testng.TestRunner.run(TestRunner.java:602)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
	at org.testng.TestNG.runSuites(TestNG.java:1144)
	at org.testng.TestNG.run(TestNG.java:1115)
	at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Highlighted
Community Hero

Re: How to get test step response in readyAPI using Java?

Use pro api


Regards,
Rao.
Highlighted
Contributor

Re: How to get test step response in readyAPI using Java?

Hi nmao.

 

    I'm not able to find pro api equalent to below steps. I checked Pro API guide, but I couldn't find anything. can you help me on this?

final WsdlTestCaseRunner testRunner = new WsdlTestCaseRunner(testCase, null);

				soapResult = testRunner.runTestStepByName(testStepNameStr);
Community Hero

Re: How to get test step response in readyAPI using Java?

Will check.

Even in the script, didn't happen to notice the integration between test step and selenium. Would you please point?


Regards,
Rao.
Highlighted
Contributor

Re: How to get test step response in readyAPI using Java?

Hi nmrao. I wrote a separate class for the selenium and test step integration part. Here I'm trying to run readyAPI test cases and would like to receive the response of the each test step, I will pass those response as a JSON paramater to another class where I work on selenium with test data response as an input.

Highlighted
Contributor

Re: How to get test step response in readyAPI using Java?

Any inputs on my issue? 

Highlighted
Community Hero

Re: How to get test step response in readyAPI using Java?

You better open a support case to find out the same.


Regards,
Rao.
Highlighted
Community Hero

Re: How to get test step response in readyAPI using Java?

Highlighted
Community Leader

Re: How to get test step response in readyAPI using Java?

have you tried ant because one of my colleage is also trying to do the same, and as per him he will create the project in soapui and execute the project via ant and ant will store the response into one notepad file from where he will read the response and validate on UI.

 

If you need more info then do let me know i will connect with him and will try to help you how he is doing.

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors