You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by bu...@apache.org on 2009/04/12 16:54:43 UTC

DO NOT REPLY [Bug 47016] New: BSF sampler with javascript doesn't return values

https://issues.apache.org/bugzilla/show_bug.cgi?id=47016

           Summary: BSF sampler with javascript doesn't return values
           Product: JMeter
           Version: 2.3.2
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: jmeter-dev@jakarta.apache.org
        ReportedBy: amir@thegur.net


Created an attachment (id=23481)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23481)
test plan that demonstrates the bug

Add a BSF Sampler to a Thread Group.
Set the scripting language to javascript.
In the 'script to run' field just put:

return ("test");

and run the test.

In a results tree, in the 'sampler results' tab, you can see now:

Error Count: 1
Response code: 500
Response message: org.apache.bsf.BSFException: JavaScript Error: invalid return

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 47016] BSF sampler with javascript doesn't return values

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47016


Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




--- Comment #4 from Sebb <se...@apache.org>  2009-04-13 16:56:54 PST ---
"return" is only valid when used in a function - that is why the error is
reported.

Try the following script:

123+456

and you will see that the result is 579.

Likewise, try the following script (as already suggested):

"test"

and you will see that the value test is returned.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 47016] BSF sampler with javascript doesn't return values

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47016


Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Sebb <se...@apache.org>  2009-04-12 08:03:00 PST ---
This is not a JMeter error. The script is not valid, as shown by the message:

JavaScript Error: invalid return

Try leaving off the return.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 47016] BSF sampler with javascript doesn't return values

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47016





--- Comment #3 from Amir Gur <am...@thegur.net>  2009-04-12 09:02:06 PST ---
As a workaround, you can use:

(function(){
   return ("test");
})();


instead of just 

return ("test");

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 47016] BSF sampler with javascript doesn't return values

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47016





--- Comment #2 from Amir Gur <am...@thegur.net>  2009-04-12 08:13:12 PST ---
The JMeter documentation for BSF Sampler (18.1.11) states that:

"The SampleResult ResponseData is set from the return value of the script".


The statement 'return ("test");' is a legal javascript code.

The same test works fine if I change the scripting language to beanshell.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 47016] BSF sampler with javascript doesn't return values

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47016


Amir Gur <am...@thegur.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |amir@thegur.net
         Resolution|INVALID                     |




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org