Distinguishing handler with the same names/same suite names

I have suites:

  • ‘Suite1’ with script ‘lib’ which has handler named ‘do_smthng’.
  • ‘Suite2’ with script ‘lib’ which has handler named ‘do_smthng’.

Also I have suite ‘Tests’. “Suite1” and “Suite2” are helpers of this suite. Suite ‘Tests’ has a script which calls ‘lib.do_smthng’.

It always call the ‘lib.do_smthng’ from the suite which is the first in the list of helpers. Is there any way to force it to call the handler from the ‘Suite2’?

a-la Suite2.lib.do_smthng

There are a couple of ways to approach this. The first is to use “dynamic helpers”: rather than listing Suite1 and Suite2 on the Helpers tab for your Tests suite, you can use the OpenSuite and CloseSuite commands within your scripts to dynamically control which suites are available as helpers at any point in a script, and which one takes precedence if more than one is open.

OpenSuite "Suite1"
lib.do_smthng -- uses Suite1's lib
OpenSuite "Suite2"
lib.do_smthng -- Suite2's lib should take priority here

If you prefer to keep Suite1 and Suite2 as static helpers (listed on the Helpers tab), you can still use Suite2’s lib, but only by providing the full path name. If Suite2 is in the same folder as the Tests suite, you could do it like this:

lib.do_smthng -- calls Suite1's lib, because it is the first Helper
(my folder's folder's folder & "Suite2.suite/Scripts/lib").do_smthng
      -- use Suite2's lib

We hope to provide the ability to control this more easily in a future release, but for now hopefully one of the approaches above will satisfy your need.