Forum Discussion

tvklovesu's avatar
tvklovesu
Frequent Contributor
2 years ago

How can I call a keywordTest in a script and pass variable to that test

Hi there,

I am trying to call a keywordTest with in a script. This script is used for a parallel test and it is working if I don't have any test parameters assigned. But when I try to pass parameters to that KeywordTest from script then the test fails to execute this script.

 

My code

function Main()
{

  var Tests = [

  'KeywordTests|SearchBasicTest' (this on works)

  'KeywordTests|SearchBasicTest("testdata")' (This test fails with an error in the log as "No test was found for KeywordTests|SearchBasicTest("testdata") 13:49:52 Normal 0.18"

I have already created test parameter in the SearchBasicTest testcase.

  ]

Parallel.RunTests(Tests)

}

note: If I specify like

KeywordTests.SearchBasicTest("testdata") then it says SearchBasicTest is not a function

1 Reply

  • tvklovesu's avatar
    tvklovesu
    Frequent Contributor

    I found the solution for my question and it is that I missed the word Run.

    KeywordTests.SearchBasicTest.Run("testdata"),

     

    But now I am having another issue where my scripts are running in sequence and not in parallel and after the script is done, I am getting error at line Parallel.RunTest(Tests) as 

    JavaScript runtime error.

    The parameter is incorrect

    Error location:
    Unit: "TestSuite_CORE\TestProject_CORE\Script\ParallelExecution"
    Line: 114 Column: 12.
     
    Any help would be greatly appreciated.
    Thanks