Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How can you reference a Bamboo Build Plan variable inside a Karate config file? I have a Bamboo build plan for all of my karate tests. I need to be able to reference bamboo variables in the karate.config file for when the karate tests run though the bamboo build.

I've tried stuff like:

config.branchSource = karate.properties['branch.source'];

Where 'branch.source' is the bamboo build plan variable I enter at run time (Run Customized) with no luck.

I'm looking to pass a variable, that I input in bamboo, at runtime, where the karate tests will pickup and use appropriately. This other question, Using environment variables in Karate DSL testing, doesn't work. It speaks about java system properties. I'm not looking for system properties, I'm looking for Bamboo Build Plan Variables. Any ideas?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
722 views
Welcome To Ask or Share your Answers For Others

1 Answer

You have to add them to the command line, in my case, to the maven command.

IE. If we add this "-Dbamboo_build_variable=”whatever was entered” " to the "clean test" command, then the variable bamoo_build_variable will be accessible by Karate.
So in Karate.config you can read it, like this "var bamooVariable = bamboo_build_variable".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...