Hi Nuwan,

If you are looking for a way for setting the environment variables for the
tests (please correct me if I haven't understood correctly), you can set it
up in your maven configurations. If that's what you are looking for, please
try [1].

[1]
https://stackoverflow.com/questions/11078863/how-to-set-env-variables-for-maven-to-run-test-correctly

Cheers,

*Nadeeshaan Gunasinghe*
Technical Lead, WSO2 Inc. http://wso2.com
+94770596754 | nadeesh...@wso2.com | Skype: nadeeshaan.gunasinghe
<https://mail.google.com/mail/u/1/#>
<http://www.facebook.com/nadeeshaan.gunasinghe>
<http://lk.linkedin.com/in/nadeeshaan> <http://twitter.com/Nadeeshaan>
<http://nadeeshaan.blogspot.com/>


On Sun, Sep 12, 2021 at 2:45 PM Nuwan Jayawardene <nsga...@gmail.com> wrote:

> Hi all,
> I've been working on writing unit tests for a feature that extracts a
> prefixed variable from a synapse.xml config during runtime and populates it
> with a preset environment variable. It's similar in functionality to what's
> mentioned here:
> https://docs.wso2.com/display/EI660/Injecting+Parameters+as+Environment+Variables
> .
>
> I'm reaching out to verify if there's a way to set environment variables
> in-memory with Java so that it is picked up when the unit test is being run.
> I found an answer here: https://stackoverflow.com/a/7201825/7838048,
> however unfortunately it doesn't seem to work as it retrieves a null value
> when the code is debugged.
>
> Would appreciate some thoughts on this.
> Kind regards
> --
> *Nuwan Jayawardene*
> Assistant Lecturer, Informatics Institute of Technology (IIT).
> Research Assistant, University of Moratuwa
>
> https://www.linkedin.com/m/in/nuwanjaya
>
>
>

Reply via email to