Author: pmouawad
Date: Sat Mar  9 16:38:29 2019
New Revision: 1855128

URL: http://svn.apache.org/viewvc?rev=1855128&view=rev
Log:
Bug 63241 - __threadGroupName causes a NullPointerException if called from non 
Test threads

Add a test
Bugzilla Id: 63241

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java

Modified: 
jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java?rev=1855128&r1=1855127&r2=1855128&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java 
(original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java 
Sat Mar  9 16:38:29 2019
@@ -190,6 +190,20 @@ public class TestSimpleFunctions extends
             FileServer.getFileServer().setScriptName(null);
         }
     }
+    
+    @Test
+    public void testThreadGroupNameBug63241() throws Exception {
+        AbstractFunctionByKey function = new ThreadGroupName();
+        try {
+            HTTPSamplerProxy httpRequest = new HTTPSamplerProxy();
+            JMeterContext context = JMeterContextService.getContext();
+            context.setCurrentSampler(httpRequest);
+            String ret = function.execute(result, httpRequest);
+            assertEquals("", ret);
+        } finally {
+            FileServer.getFileServer().setScriptName(null);
+        }
+    }
 
     @Test
     public void testThreadGroupNameParameterCount() throws Exception {


Reply via email to