Forum Discussion

kishore530's avatar
kishore530
Occasional Contributor
7 years ago

An error occurred [Cannot invoke method getProjectByName() on null object]

Hello Friends,

 

I am new to groovy scripting. i have requirement to run a testStep in test_suiteB from test_suiteA. i am facing below error while runnig  "Launch TestRunner

 

An error occurred [Cannot invoke method getProjectByName() on null object]". am i supposed to create any workspace here?

 

any help would be appreciated.

 

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Would you mind showing the current script which leading to the mentioned error?
    • kishore530's avatar
      kishore530
      Occasional Contributor

      Hello Rao, Thanks for your promptness.

       

      this is groovy script i have:

       

      import com.eviware.soapui.*;
      // Identify test step
      def workspace = testRunner.testCase.testSuite.project.workspace
      def testCase = workspace.getProjectByName("project2").testSuites["test suite2"].testCases["test case2"]
      def testStep = testCase.testSteps["test step2"]

      // Run test step
      context.x="5";
      testStep.run( testRunner, context)

       

       

       

      i have the above groovy script in project1 and i am launching testrunner on test suite1(present in project1)