Forum Discussion

MattS's avatar
MattS
Occasional Contributor
4 months ago

Javascript parameter issue following fail in TestExecution

Hello!

We are observing a scenario when executing tests composed of multiple KeywordTests and Script calls assembled in Test Execution.

Typically the flow of Keyword A -> Keyword B -> Script A -> Script B succeeds and all is well. 

However, we are seeing that when Script A fails (Log.Error, anticipated fail), Script B throws an exception for a null value. When reviewing the call stack, it indicates that after the failure in Script A, Script B runs with some parameters not defined. If the previous script succeeds, there is no issue.

In the multiple cases where we observe this, the passed parameters that go missing following a failure are project variables, aliases. Strings, integers passed are unaffected. 

Any idea why this might be occurring? Are there steps to take on failures earlier in Test Execution to prevent this? 

The script calls we observe this in are Javascript functions stored in the same script file.

 

4 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What version of TC are you using? 

    I'm assuming Script B relies on Script A. Does Script A sets any variables? Do you have default values defined for your variables?

    Are you running this on your local machine?

    • MattS's avatar
      MattS
      Occasional Contributor

      We are using TC 15.54, run on a virtual machine. Script B is not dependent on Script A. There are not defaults provided for the variables. The two most common instances of this issue we've encountered, to provide better detail, are the following.

      1. Script A accepts a nameMapping Alias as a parameter, evaluates the Alias properly and fails on a property check. Script B, which also accepts a nameMapping Alias, throws exception evaluating a null object, despite the fact that it is passed the alias in the same manner as Script A.
      2. Two independent calls, subsequently to the same Script A that accepts a string and a project var as parameters. The first call properly evaluates the string and project var and fails on a property check. The second call properly evaluates the string, but receives a null for the projectVar, despite the fact that the same project var is passed to each call and it has not been modified between the 2 invoking of the scripts.

       

       

      1.  
  • markos's avatar
    markos
    Occasional Contributor

    Can you declare and populate the variable in the keyword test? Then the second script should not fail if the first one did not update the value?