How to set up telegram bot's name from an environment variable in node-red? - telegram-bot

Using node-red-contrib-telegrambot palette it is possible to set up bot's token from an env variable using the following syntax {env.get("BOT_TOKEN")}.
But is it possible to do the same for the bot's name?

To populate any fields of a node in the editor from environment variables you need to use the following syntax:
${BOT_TOKEN}
You can find the docs here

Related

Postman set variable

Here is my example, I need to set values to the environment variable as follows
I have already known variable called 'ponumberA', is it possible to set that value to environment variable using 'pm.environment.set' function.
(((var ponumberA="A1234";
pm.environment.set("ponumberxx",ponumberA);
var ponumberxxx=pm.variables.get("ponumberxx")
console.log ("Request PO # is  " +ponumberxxx))))
https://learning.postman.com/docs/sending-requests/variables/
you can set variable and scope from pm object
pm.environment.set
pm.collectionVariables.set
pm.variables.set
pm.globals.set
you can use this variables in any session like url , body ,header etc as
{{variablename}}
example
pm.environment.set("myvar",2)
and in url
https://www.somewebsite.com?id={{myvar}}

Postman: How to use global variable defined in Pre-request Script in Tests Script

I have defined one global variable in a Pre-request Script.
I want to compare this global variable with variable present in the response.
As the warning message says, you're running a very old version of Postman and it's probably the chrome extension.
This is now several major versions behind and the pm.* functionality is not included in that old version of the chrome extension.
Download the native application and start using the newest version of Postman. By not doing this, you're missing out on so many new features.
As #Danny mentioned, it is recommended to update to the latest version.
Now to your question, if you want to compare the global variable with workkard_number present in response, you need to first parse the response and get the workkard_number in it, which you can then compare with your global variable. You could try something like this in your test script:
var jsonData = JSON.parse(responseBody);
var responseWorkkardNumber = jsonData.wokkard_number;
You can retreive the workkard_number in the response like this(assuming that your response is a json with "workkard_number" as a key in it. Then you can compare it as follows:
tests["workkard_numbers are equal"] = responseWorkkardNumber === globals.workkard_number;
or
tests["workkard_numbers are equal"] = responseWorkkardNumber === pm.globals.get("workkard_number");
Also note - "Warning - Environment and global variables will always be stored as strings. If you're storing objects/arrays, be sure to JSON.stringify() them before storing, and JSON.parse() them while retrieving." - https://www.getpostman.com/docs/v6/postman/environments_and_globals/manage_environments

Using result from the first request and passing in the second request- POSTMAN

I want to use the result which is "id" and use it in the second request POST
Saving it as environmental variable in the first request(under tests)
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("id", jsonData.token);
Here is the second request looks like, not sure what I am doing wrong here
Your request is correct.
As long as you set an environment variable, you may USE this environment. From your print screen I see "no environment" on the top right corner.
I suggest either you create an environment where to save your environment variables and then use it or you use a global variable, postman.setGlobalVariable("id", ...) instead
Alex

selenium - created variable but doesn't seem available

I want to set a variable $import_location so that I can set it once for many uses and not hard-code it into each test case that is doing file uploads.
I have the variable set OK with the store command.
I am trying to use it on the uploads screen but keep getting the literal ${variable name}
How can I set the import location to be the variable that I've set above?
I just hadn't run the actual 'variable setting' script. One I had run it and created the variable I was able to use it OK.

Reference a variable within a variable in JMeter

I'm working with JMeter. I'd like to specify the test host using user defined variables, like this:
variable name value
localhost localhost
test 192.168.0.1
hostname ${localhost}
Executing the test, I see that the hostname value is not substituted, and obviously the test fails. I know I can use properties and pass the hostname from the command line, or simply change the hostname value. Is it possible to it like I've explained?
Thanks.
I've managed to solve my problem. I've changed the hostname variable value to: ${__evalVar(${localhost})}, but I've got this error:
ERRROR jmeter.functions.EvalVarFunction: Variables have not yet been defined
So I've moved the hostname variable declaration in a "User defined variable" child node of my Sampler node. That solved it.
To solve this you should use hostname = ${__eval(${localhost})}
http://jmeter.apache.org/usermanual/functions.html#__eval
Carlos' answer has a mistake (which I can't comment on due to rep) as it uses evalVar, this requires as an argument a plain string:
This works: ${__evalVar(localhost)})
This works: ${__eval(${localhost})}
This doesn't work (the current answer): ${__evalVar(${localhost})}
http://jmeter.apache.org/usermanual/functions.html#__evalVar
Check this forum:
from Blazemeter
For example: getting value of varible "listid_XXX" where the XXX number comes from an index variable:
${__V(listid_${idx1})}
New newer versions (from 2.2), you can use ${__V(${...})}/.
Ex: ${__V(${SERVER_CONTEXT})}/rest
As #Alies Belik mentioned, if you get
ERRROR jmeter.functions.EvalVarFunction: Variables have not yet been defined
then define the 2nd variable in next other UDV (User Defined Variables) node.