AnsweredAssumed Answered

Exception while Invoking Extenal JS files with Execute Script (JSR-223) DevTest Step

Question asked by nikhivs on Apr 9, 2018

Hey I would need a quick help please? I have a requirement where i want to test Javascript function with different combination of inputs. And this function will access two external Javascript files through https URL.

Based on my different combination of inputs to the function, one of the external Javascript file will make a request to invoke one webservice and provides the service response. I will have to validate this response.


For this, I am using Execute Script (JSR-223) DevTest Step. I am writing the script like this:


load("")  // External Javascript file - 1
load("") // External Javascript file - 2


"field1": {{"input1"}}, // here I will need to parameterize the input1, 2,3 and 4 from dataset
"field2": {{"input2"}},
"field3": {{"input3"}},

"field4": {{"input4"}}
}, function( response) {  // will return the response
testExec.setStateValue("data1", response);

When I execute the step with above script, I am getting below exception


| Step: Execute script (JSR-223)
| Message: Received fatal alert: unexpected_message
| Trapped Exception: Received fatal alert: unexpected_message
| Trapped Message: java.lang.RuntimeException: Received fatal alert: unexpected_message
java.lang.RuntimeException: Received fatal alert: unexpected_message
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(



I set the file as below.


It did not help even after setting the protocol like above. 


Can anyone please let me know what is the issue? How to resolve it and make it work or are there any other workaround to achieve this?


Please note: It is working when i created sample html file and wrote the function like above but it wont satisfy my automation need.