https://bz.apache.org/bugzilla/show_bug.cgi?id=61050
Bug ID: 61050
Summary: Crash in JMeterUtils due to null ResourceBundle in
method getResStringDefault while trying to use
DurationAssertion
Product: JMeter
Version: 3.2
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HTTP
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
while trying to use the DurationAssertion as follows, I am getting a crash,
looking into code and debugging it looks like the ResourceBundle object in
method private static String getResStringDefault(String key, String
defaultValue, Locale forcedLocale)
is null and hence crashing with null pointer exception.
following is the code that I am using
// Create a JMeter
ThreadGroup threadGroup =
jmeterTreeManager.createThreadGroup("TestCase1_Rest", 1, 1);
HashTree threadGroupHashTree =
jmeterTreeManager.addThreadGroupToRootTree(testPlan, threadGroup);
// Create HTTP Sampler
HTTPSamplerProxy httpSampler = new HTTPSamplerProxy();
httpSampler.setDomain(testConfigs.getDomain());
httpSampler.setPort(Integer.parseInt(HTTPConstants.DEFAULT_HTTPS_PORT_STRING));
httpSampler.setProtocol(HTTPConstants.PROTOCOL_HTTPS);
httpSampler.setPath("api/");
httpSampler.setMethod(HTTPConstants.POST);
httpSampler.addArgument("apikey", testConfigs.getApiKey());
httpSampler.setName("FixureRequest");
httpSampler.setProperty(TestElement.TEST_CLASS,
HTTPSamplerProxy.class.getName());
httpSampler.setProperty(TestElement.GUI_CLASS,
HttpTestSampleGui.class.getName());
// Get result from sampler
HTTPSampleResult samplerResult = (HTTPSampleResult)
httpSampler.sample();
// Create Response Assertion
ResponseAssertion responseAssertion = new ResponseAssertion();
responseAssertion.setName("ResponseAssertionForRest");
//responseAssertion.setTestFieldRequestHeaders();
responseAssertion.setTestFieldResponseData();
/**note : Contains, Matches: Perl5-style regular expressions
* Equals, Substring: plain text, case-sensitive
*/
responseAssertion.setToSubstringType();
responseAssertion.addTestString("\"started\":false");
responseAssertion.setEnabled(true);
// Create Duration Assertion
DurationAssertion durationAssertion = new DurationAssertion();
durationAssertion.setName("DurationAssertionForRest");
durationAssertion.setScopeAll();
durationAssertion.setAllowedDuration(1);
durationAssertion.setEnabled(true);
// Get assertion result from received response
AssertionResult assertionResult =
responseAssertion.getResult(samplerResult);
AssertionResult durationAsserRes =
durationAssertion.getResult(samplerResult);
following is the crash stack
java.lang.NullPointerException
at
org.apache.jmeter.util.JMeterUtils.getResStringDefault(JMeterUtils.java:515)
at
org.apache.jmeter.util.JMeterUtils.getResStringDefault(JMeterUtils.java:496)
at
org.apache.jmeter.util.JMeterUtils.getResString(JMeterUtils.java:451)
at
org.apache.jmeter.assertions.DurationAssertion.getResult(DurationAssertion.java:57)
at
com.incontact.test.testsuite.jmeter.TestSuite_RestApiAccess.RestApi_TestCase1(TestSuite_RestApiAccess.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
--
You are receiving this mail because:
You are the assignee for the bug.