Forum Discussion

randall's avatar
randall
Contributor
6 years ago
Solved

I get an erroneous "Cross references are not allowed." message

I have two JavaScript files - Main_TrussStudio and DesignTrusses1A.  When I attempt to run the test from the Main script file the script view jumps to the DesignTrusses1A file and presents an error dialog with the following content:

 

Syntax error(s).

 

The units DesignTrusses1A and Main_TrussStudio refer to each other.

Cross references are not allowed in JScript units.

 

Error location:

Unit: "CSAutomation\CSDirector\Script\DesignTrusses1A"

Line: 2 Column: 1.

 

The error is bogus/erroneous because DesignTrusses1A script unit does not contain any USEUNIT reference to the Main_TrussStudio script unit.  The referenced line is:

 

//USEUNIT ToolbarFunctions_TSLayout

 

Which is obviously not "//USEUNIT Main_TrussStudio" as implied.

 

Has anyone seen this before or know a way I can work around it?  I am using TestComplete 11.31.2420.7.

 

 

  • Nope, still doesn't answer my question.

     

    Open up the script file ToolbarFunctions_TSLayout

     

    What USEUNIT statements, if any, are in that file.  Circular references are chained in.  So, even if Main is not DIRECTLY mentioned in DesignTrusses1A, if there is a reference to Main in ToolbarFunctions_TSSLayout, that may generate the error as well.

     

    So... basically, go down the line and examine ALL your code units and make sure that NONE of them reference back to your Main unit.

7 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Does ToolbarFunctions_TSLayout reference Main_TrussStudio at all?

    • randall's avatar
      randall
      Contributor

      No, the unit DialogFunctions_TSTruss does not contain any USEUNIT references to Main_TrussStudio.

       

      There is something else that I failed to mention.  TestComplete appears to be fixated on the second line of the DesignTrusses1A unit.  I have tried reordering the USEUNIT lines and no matter what unit is referenced in line 2 TestComplete always throws the same error.  TestComplete seems to think that the second line is "//USEUNIT Main_TrussStudio" no matter what is there.

       

      I have even tried copying the contents of DesignTrusses1A to a new unit file with a different name, then deleted the original DesignTrusses1A, and then renamed the copy back to DesignTrusses1A and that also didn't work.  TestComplete still manifests the same bogus error.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        That's not what I asked. :)

         

        You mentioned 

         

        "//USEUNIT ToolbarFunctions_TSLayout"

         

        is at the top of DesignTrusses1A.

         

        So, in that unit (ToolbarFunctions_TSLayout), what are the USEUNIT statements in that unit?  Circular reference doesn't apply to just the units that are immediately related but, because you can chain call through USEUNIT, it goes down the line to them all.