Samarth Kejriwal
Samarth Kejriwal

Reputation: 1176

How to get the configurations of current running XC Test plan programmatically?

Problem Statement:

My Test flow will depend on the type of configuration that is currently running for a test plan. I want to get the configuration name and environment variable entries of the currently running test plan in Xcode, so that according to the configuration I can decide what action to perform in a particular test.

Eg.

I have a test plan XYZ.xctestplan with two configurations "A" and "B". I want to get the environment variable entries that are set in the currently running configuration of the XYZ.xctestplan According to these environment variables, I will decide which button should be clicked in my UI test.

Upvotes: 0

Views: 1399

Answers (1)

Steve Mykytyn
Steve Mykytyn

Reputation: 73

You can pull the environment variables in, say named "359TZ", like this:

    NSString *key = @"359TZ";
    NSString *tz359 = [NSProcessInfo.processInfo.environment objectForKey:key];

Please note that IIRC, you get the environment variables in a configuration when you run from Xcode, but not when you run using xcodebuild. YMMV.

Upvotes: 1

Related Questions