18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Problem with _get/_setGlobal and/or string comparison
Hi,
I have some code like this:
and it executes the else case. Why? I would expect the string comparison to be true.
Best regards
I have some code like this:
_setGlobal("test_language", "de_DE");
var $language = _getGlobal("test_language");
if ($language == "de_DE") { ... } else {...}
and it executes the else case. Why? I would expect the string comparison to be true.
Best regards
Comments
_set($language, _getGlobal("test_language"));
instead of
var $language = _getGlobal("test_language");
Your code should have worked. We will verify it here.
_setGlobal and _getGlobal are no longer required in most cases.
Are you fetching the value "de_DE" from somewhere on the user interface?
Regards,
Narayan
so e.g testsuite_de.suite:
testsuite_en_us.suite:
de_DE_defs.sah:
en_US_defs.sah:
include_for_all_tests.sah
test1.sah
testsuite_de.sah
testsuite_en_us.sah
Is there another way to do this? Is it possible to give parameters to the test files in the suite file? Or to read some external variables, e.g. environment variables?
Best regards,
We will look at how to solve this problem better. Meanwhile use Popeye's suggestion to get global. It works.
Regards,
Narayan
Thank you very much for the quick answer! I assume you meen using java.util.Properties as described in topic id 1225.
However, this does not quite solve my problem, as I want to run the same suite in different languages without modifiyng any of the test scripts ever.
But I've came to another solution, the first test is now instead of setting a global variable just copying the language dependant file to a default filename and the subsequential tests are only knowing about this default and including it.
Best regards,