Service Virtualization

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

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

    Posted Apr 09, 2018 01:52 PM

    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("https://test.xyz.com/xyzSdk/wrap-sdk/wrapper.js")  // External Javascript file - 1
    load("https://test.xyz..com/xyzSdk/core-sdk/coreSdk.js") // External Javascript file - 2

     

    SDK.User.Details({
    "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: javax.net.ssl.SSLException: Received fatal alert: unexpected_message
    ----------------------------------------------------------------------------
    | Trapped Exception: javax.net.ssl.SSLException: Received fatal alert: unexpected_message
    | Trapped Message: java.lang.RuntimeException: javax.net.ssl.SSLException: Received fatal alert: unexpected_message
    ----------------------------------------------------------------------------
    STACK TRACE
    java.lang.RuntimeException: javax.net.ssl.SSLException: Received fatal alert: unexpected_message
    at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:397)

     

     

    I set the lisa.property file as below.

    https.protocols=TLSv1,TLSv1.1,TLSv1.2.

    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.