-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read environment variables in config/test suite #410
Comments
It’s not supported as-is but you could achieve it with a script in a variable. Anyway, I’ll add this as a feature. Thx for the good idea. |
Thanks for the tip. Will it be possible to use those variables as part of a connection string? That way passwords wouldn't have to go in the file that holds the test suite. |
I plan to support two ways to use environment variables: <variable name="myVar"/>
<environment name="MyEnvVar"/>
</variable> and for connection-strings it will be supported in the defaults and reference (not with inline definition). <default apply-to="sut"/>
<connectionString>
<environment name="MyEnvConnStr"/>
</connectionString>
</default>
<reference name="xyz"/>
<connectionString>
<environment name="MyOtherEnvConnStr"/>
</connectionString>
</reference> Note that for the connection-strings the evaluation of the value of the environment variable is executed during the read/load of the test-suite and not during the execution! |
Beta should be available at https://ci.appveyor.com/project/Seddryck/nbi/builds/19356719 |
This works fine for me, thanks! |
… and also to override the definition of a variable in a config file #410
Sorry for the late feedback, |
That’s probably because the environment variables are not accessible to the account running the build. I’d recommend to ensure that the environment variables are in the user-scope.
… On 15 Nov 2018, at 05:53, Tannenwedel ***@***.***> wrote:
Sorry for the late feedback,
Picking up environment variables when using the stand-alone NUnit tool works fine. However, when using the Nunit runner task within the Bamboo build server the bamboo-provided env vars are not being picked up and the connection strings are empty.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@Seddryck could you give an explaination why NBi is looking at the I think the code reason for my issue is: https://github.com/Seddryck/NBi/blob/90e0a283fbac3b69ce37551e3788bad25a2c8042/NBi.Core/Scalar/Resolver/EnvironmentScalarResolver.cs I was expecting to just set an environment variable before executing nbi on my build agent. However, nbi does not read environment variables but only user defined environment settings. |
I probably didn't make the choice between user and process but between user and machine. But you're right that process souns to be a better choice. You can submit a PR if you want. |
Hi,
Is there a way to read environment/system variables in either the config or test suite? I'd like to run NBi unit tests on a CI server such as Bamboo and set certain values as environment variables.
Thanks!
The text was updated successfully, but these errors were encountered: