I've been working on editing and creating various path variables for some automated test scripts so that as I change software versions of my application I'm testing, all I need to do in the code is to change a single variable called version
.
The code looks like this:
//App path
var appPath = "Windows (C:)\\Program Files\\APP\\";
//App exe versions
var appV2_0 = "App v2.0\\"
var appV2_1 = "App v2.1\\"
//App current version
var version = appV2_1
export var AppVersion = appPath + version + "Bin\\";
I'm also working on making some functions that will automatically export various "outputs" from our tests to a shared drive where other team members can grab them as they want. I'm trying to handle the paths to these directories in a similar fashion. That looks like this so far:
////Share Drive variables
var ShareDrive = "\\\\shareDrive\\Path\\To\\Drive\\APP\\";
//Share Drive Major Versions
var appV2_0_SD = "AP SW\\v2.0\\";
var appV2_1_SD = "AP SW\\v2.1\\";
//Share Drive Minor Versions
//v2.0
var appV2_0a_SD = "v2.0a\\Test Files\\AutoTCs\\";
var appV2_0b_SD = "v2.0b\\Test Files\\AutoTCs\\";
//v2.1
var appV2_1a_SD = "v2.1a\\Test Files\\AutoTCs\\";
var appV2_1b_SD = "v2.1b\\Test Files\\AutoTCs\\";
//Test Files -- Version Directories
var appV2_0a_TestFiles = ShareDrive + appV2_0_SD + appV2_0a_SD;
var appV2_0b_TestFiles = ShareDrive + appV2_0_SD + appV2_0b_SD;
var appV2_1a_TestFiles = ShareDrive + appV2_1_SD + appV2_1a_SD;
var appV2_1b_TestFiles = ShareDrive + appV2_1_SD + appV2_1b_SD;
export var shareDriveTestFiles = [HERE IS THE CRUX OF MY QUESTION].....
Ultimately, it would be fairly easy to simply put whatever new version shows up in both the version
variable and the shareDriveTestFiles
variable. However, since I've used the same nomenclature for naming my variables, I was hoping that I might be able to define the shareDriveTestFiles
variable using the version
variable similar to how I can append a string using a variable (e.g. "Hello " + worldText + "!") so that maybe I could define it something like shareDriveTestFiles = verson + _TestFiles
so that changing the version will also cause it to select the correct variable under the "Test Files -- Version Directories" comment.
Hopefully that long explanation was clear enough. I tried googling around but I wasn't even sure how to word what I was searching for. So please, let me know if I can clear anything up.