modifying QTP imported Environment variables - vbscript

Using QTP, I need to import environmental variables from an XML sheet, but there that is the imported ones are the imported Environmental variables are on read only mode, it cannot be edited.
I need to know if there is any way to import environment variables and edit them and i need to know, somehow, is there any method to create environment variables from code(programmatically)

To create environment variables from code, use below loc:
Environment("variablename")="Variablevalue" ' Create and intialise environment variable
Print Environment("variablename") 'To retrieve value of variable

Related

How to set an environment variable during a Cypress test?

I am looking to re-use a particular value across multiple step definitions in my Cypress/Cucumber test.
I was thinking of using a normal variable, but the problem is that the step definitions are stored in different files.
So I am wondering if I could assign the value to an environment variable & reference that in the other file.
I was trying to do something like Cypress.env('myUsername') = 'testUser', but I get this lint error:
Cypress environment variables can be set during a test by passing in the desired value as the second argument.
Cypress.env('HOST', 'asdf');
In the documentation, env API syntax should look like something below:
- Cypress.env()
- Cypress.env(name)
- Cypress.env(name, value)
- Cypress.env(object)
In your case the following will work
Cypress.env('myUsername', 'testUser')

How to use InstallForge environment variables to set registry values

I would like to use %IF_INSTALLPATH% to set a Registry value with InstallForge, but it doesn't resolve the variable. So the registry value created is "%IF_INSTALLPATH%\bin" instead of "C:\MyApp\bin".
How can I use %IF_INSTALLPATH% in setting a registry value?

How to access nested values in Cypress.json

Cannot access nested values in Cypress.json file.
I have just started learning Cypress and trying to organise some variables into the Cypress.json file.
The usual dot and bracket notation do not work because the key is already in single/double quotes, so I think Cypress sees it as a complete string eg. (Cypress.env('login.username')).
This is my simple Cypress.json file
{
"env":{
"login":{
"username":"Joe"
}
}
}
How can I access the name Joe?
Try this, it will return the username.
Cypress.env('login').username // returns "Joe"
Read more about Environment Variables
To expand upon Yevhen's answer.
Nested environment variables only work when placed inside a separate cypress.env.json file in the root of your project, next to your cypress.json file.
This can be seen under option #2 on the environment variables link that Yevhen already provided.
It isn't explicitly documented where this cypress.env.json file needs to be placed, I just wanted to share this information after having to figure it out for myself.

AWS Create Lambda script parameters output as parameter name, not value

I am running this Octopus community script for creating or updating a lambda function.
When we hard-code values for the parameters, the script works as advertised. However, when we define variables for use in the parameters, it always injects the name of the Octopus variable instead of the value.
Such that a variable named AWS_Dash_OrderOnline_Lambda_Function_Name is read as #{AWS_Dash_OrderOnline_Lambda_Function_Name} for the value instead of the actual variable value.
What's going on and what do I need to change?
Pertinent script code is below:
# Get the parameters.
$functionName = $OctopusParameters['FunctionName']
...
Write-Output $functionName
Output:
#{AWS_Dash_OrderOnline_Lambda_Function_Name}
You'll get the variable back as the value like this if a value cannot be determined. This could be because of a typo in the name, or it could be that there is no value for the variable that matches the scope of the current deployment.
For example, you may have a value for a variable called Foo defined for Prod and not for Dev. When you run a deployment into Dev you'll get #{Foo} but in Prod you'd get the actual value.
A technique I've used is to provide an unscoped value of something like "UnscopedFoo", then if you see that value you know you've got the name entered correctly and it's a scoping issue. If you don't then the name isn't entered correctly.
If you do not properly define your variable's scope, you will get the result as indicated in the question.
Define your scope, environment, roles, channels, etc properly and your variable values will import correctly.

Declare Jmeter variable from a property value

How can I declare a variable name by using the value of a property?
For example, I have the property propertyName with the value propertyValue. I want to declare a variable with the name propertyValue.
I've tried like ${${__P(variableName)}} but such constructions doesnt work.
You may need to evaluate the property name, using the ${__V()} function.
Thus, you'd probably end up with something like ${__V(${__P(propertyName)})} which would only declare a variable with a null value.
Basics on properties & command line:
if you need to pass variables through the command line, properties are indeed the correct choice.
The flag to set a property is -JpropertyName The function to read a property is ${__P(propertyName)}
For full details, see:
http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#How_do_I_pass_parameters_into_my_Test_scripts.3F_I_want_to_be_able_to_use_the_same_script_to_test_with_different_numbers_of_threads_and_loops.2C_and_I_don.27t_want_to_have_to_change_the_script_each_time.
Give up using properties files, try using Variables From CSV plugin. It is pretty simple and robust way to have variables loaded from file.
Property files are great!!! For my requirement, I have created a simple config element for JMeter to read property files.
Please check here.
http://www.testautomationguru.com/jmeter-property-file-reader-a-custom-config-element.

Resources