Ask a Question

Trouble running Code Snippet from other project

SOLVED
bgran05
Occasional Contributor

Trouble running Code Snippet from other project

Hi,

 

I am trying to run a code snippet from Project A in Project B. Ultimately, I want to run Nunit Selenium tests in Project B after Project A's test has run.

 

Here is my directory structure:


+Project A

   Script Directory:

      Folder Name
          Script 1
          Script 2
      Folder Name
          Script 3
          Script 4

          Unit 1

 

+Project B

     Script Directory:

          Script
               Unit 1 - this was imported as Existing Unit 1 from Project A

     

      UnitTesting
           My Nunit Test

      KeywordTests
           KeywordTest 1

 

In Keyword Test 1, I have Run Script Routing, with the Operation: Unit 1.

 

The test instantly fails with "The USEUNIT section contains a reference to "ABC" unit that was not found in the project.

 

ABC is defined at the top of Unit 1 from Project A. Project A has many scripts (maybe a total of 20). Do I need to copy all to project B? Or is there a simpler way?

 

Thank you!

1 REPLY 1
tristaanogre
Esteemed Contributor

Everything that is in Unit1's section for "USEUNIT" needs to be in project B as well.  Anything that is a dependancy needs to be brought over.  You might not need to bring EVERYTHING over from Project B but, if there is a dependancy, it needs to be in both projects.

 

An alternative solution is to convert commonly executed code into Script Extensions to make it easier to share code between projects.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: