# Accessing ComponentSettings variable directly from Step Settings

**URL:** https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779
**Category:** General
**Created:** [July 14, 2022, 10:57pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779 "2022-07-14T22:57:17Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![nav\_dhillon](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@nav\_dhillon](https://forum.opentap.io/u/nav_dhillon)
#### Post date: [July 14, 2022, 10:57pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/1 "2022-07-14T22:57:17Z")

</div>

Is it possible to access a ComponentSettings variable via Step settings (without having to code out a step)?  
For example, if I set an existing ComponentSettings variable to an an absolute path and in a TestStep, I would like to access the absolute path in the step settings and use it to run a shell script which needs an absolute base path. I’m looking to change the path in one place and use it across multiple steps.

---

<div class="post-metadata">

### Author: ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)
#### Post date: [July 15, 2022, 1:49pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/2 "2022-07-15T13:49:04Z")

</div>

This should be possible. All Steps have access to the ComponentSettings. Does this example help with what you are trying to do?

> <https://github.com/opentap/opentap/blob/main/sdk/Examples/PluginDevelopment/TestSteps/Step%20Execution/AccessingComponentSettings.cs>

---

<div class="post-metadata">

### Author: ![nav\_dhillon](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@nav\_dhillon](https://forum.opentap.io/u/nav_dhillon)
#### Post date: [July 15, 2022, 11:12pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/3 "2022-07-15T23:12:42Z")

</div>

Thanks @brennen_direnzo . I was hoping to find a way to use ComponentSettings _directly_ in Step settings (e.g in the GUI) and not have to go into code. That way I can reuse something like SSH plugin → SSH Command Step and only have to write code for ComponentSettings

---

<div class="post-metadata">

### Author: ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)
#### Post date: [July 15, 2022, 11:42pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/4 "2022-07-15T23:42:23Z")

</div>

Ah ok I get it. That is not possible with ComponentSettings today, but you could have a Parent Step that creates an Output and then use that to pass to other Step Settings. Or leverage Parameterizing Settings and merge them into a Setting at the Test Plan Level.

@rolf_madsen I wonder if we could expand the the Input/Output system to support ComponentSettings.

---

<div class="post-metadata">

### Author: ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)
#### Post date: [July 18, 2022, 8:08am UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/5 "2022-07-18T08:08:55Z")

</div>

I guess we could support creating an Output from a ComponentSetting, but I’d rather make a test step that could read any property and then take that as an output.

---

<div class="post-metadata">

### Author: ![nav\_dhillon](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@nav\_dhillon](https://forum.opentap.io/u/nav_dhillon)
#### Post date: [August 1, 2022, 5:19pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/6 "2022-08-01T17:19:57Z")

</div>

@rolf_madsen : Could you elaborate on what you mean by: _making a test step to read a property and take that as an output?_

An example of my use case is:  
I have a hierarchical directory structure with files in different directories (multiple config files in one directory, etc). I want to specify paths to those directories in my test step settings and append the filenames to those paths. So something like {MyBasePath1}/MyConfigFile1.txt would work great where MyBasePath1 could be specified in a ComponentSetting

---

<div class="post-metadata">

### Author: ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)
#### Post date: [August 1, 2022, 8:05pm UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/7 "2022-08-01T20:05:07Z")

</div>

I was thinking something like this:

```cs
public class CombinePathStep : TestStep
{
    [Browsable(true)]
    public string String1 => MySettings.Current.BastPath1;
    public string String2{get;set} = "...";
    [Output]
    public string CombinedString => Path.Combine(String1, String2);
}

```

---

<div class="post-metadata">

### Author: ![nav\_dhillon](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@nav\_dhillon](https://forum.opentap.io/u/nav_dhillon)
#### Post date: [August 5, 2022, 3:00am UTC](https://forum.opentap.io/t/accessing-componentsettings-variable-directly-from-step-settings/779/8 "2022-08-05T03:00:37Z")

</div>

Thanks, @rolf_madsen . I’ll try to use this
