When you run a test, typically you want to run it against a specific system under test (SUT), or at least a specific type of SUT. In other cases, you might want to run the same test against multiple SUTs.
You can specify the SUT to use for a test in several places within Eggplant Manager: at the test level, at the script level, and at the schedule level. If you set a SUT at more than one level, it's important to know which SUT setting takes precedence.
Levels of SUT Priority
When SUTs are specified at multiple levels, the priority for which SUT the test uses is as follows:
- Schedule (same as selecting a SUT on the Run Now advanced options)
When a test runs, Eggplant Manager checks each script to see if a SUT is specified. If the script specifies a SUT, the script runs against that SUT. If the script does not specify a SUT, Eggplant Manager checks the schedule. If the schedule specifies a SUT, then the script uses that SUT. Otherwise, it checks to see if a SUT is set for the test and uses that one.
Finally, if no SUT is set even at the test level, Eggplant Manager attempts to run the script without a SUT. If a SUT is required to run the script, but no connection is made, you will receive a Script Error. (Note that the script itself can make a connection; see Specifying a SUT within a Script.)
Eggplant Manager goes through these steps to check for SUT priority with each script in the test. Note that this process means that each script in the test can use a different SUT, and each script can use a SUT that was specified at a different level.
If you have SUTs set at multiple levels, a script always attempts to connect to the SUT with the highest priority. However, if that SUT is not available, Eggplant Manager does not attempt to connect to any SUT that might be set at a lower order of precedence. Instead, the script fails.
You can have a higher level of SUT priority than the three mentioned above. If you define SUT connections within your scripts, those connections will have the highest priority. Regardless of the settings you've chosen in Eggplant Manager, the script attempts to connect to and run against the SUT defined within its own code.
Any connections made from within a script are outside the control of Eggplant Manager. Therefore, if the connection fails, or the attempt to connect fails, Eggplant Manager reports only a Script Error status because the error happened within the running script. You could look at the results for the test run to see if more specific information was reported.
If you intend to make connections from within your scripts, you should set SUTs to None at all levels within Eggplant Manager (test, schedule, and script).
Using Rule-Based SUTs
SUT priority applies equally whether you're using fixed SUTs or rule-based SUTs or any combination of the two. That is, it doesn't matter which type of SUT you've set; it matters at what level you've set it.
Remember, however, that with rule-based SUTs, the specific SUT isn't chosen until runtime, based on the criteria set in the SUT setup. If your test needs to run against a specific SUT, be sure to select the specific SUT rather than using the rule-based option.