Passing extra args to chrome browser tests cases

178 views
Skip to first unread message

Shadi Khalek

unread,
Jul 23, 2015, 10:56:39 PM7/23/15
to Chromium-dev
Hi folks,

I am trying to figure out what is the best way to pass data to different test cases. 

For example, let's assume I want to run:
browser_tests --gtest_filter=*MY_TESTS

which filters out the following test cases:
FOO_MY_TESTS
FOO1_MY_TESTS
FOO2_MY_TESTS

What I want to achieve is to be able to run:
browser_tests --gtest_filter=*MY_TESTS --my_args=1,2,3

and get:
FOO_MY_TESTS --special_arg=1
FOO1_MY_TESTS --special_arg=2
FOO2_MY_TESTS --special_arg=3

(the order in which 1,2,3 are assigned to a test case is not important).

Doing some research, one possible way to do so is to extend ChromeTestLauncherDelegate and override AdjustChildProcessCommandLine to split my_args across each test case. Is this the right way?

Any other suggestions? Alternatively, instead of passing --special_arg to each test case I can somehow query for this unique "special_arg" from a global object shared across all test cases if possible, but that seemed tough given that each test case run in a separate process.

Thanks,
Shadi


Carlos Knippschild

unread,
Jul 24, 2015, 5:35:09 AM7/24/15
to sh...@chromium.org, Chromium-dev

If you pass arguments other than the ones captured by the test runner itself they will be sent down to Chrome. They probably need to be defined as command line switches though and I'm guessing that's what you are doing?

So, if I understood you correctly, you should be able to run the suite 3 times passing the filter for the test along with the argument that that test should receive:

browser_tests --gtest_filter=FOO_MY_TESTS --special_arg=1
browser_tests --gtest_filter=FOO1_MY_TESTS --special_arg=2
browser_tests --gtest_filter=FOO2_MY_TESTS --special_arg=3

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Shadi Khalek

unread,
Jul 24, 2015, 12:43:05 PM7/24/15
to Carlos Knippschild, Chromium-dev
Yes Carlos, that is what I am trying to do. I guess my question is whether there is an alternative to using command line switches so that each test can grab this "special_arg" from a global map for example?

Paweł Hajdan, Jr.

unread,
Jul 27, 2015, 6:45:31 AM7/27/15
to Shadi Khalek, Carlos Knippschild, Chromium-dev
Could you explain more why you're trying to do this?

Paweł

Shadi Khalek

unread,
Jul 27, 2015, 2:01:54 PM7/27/15
to Paweł Hajdan, Jr., Carlos Knippschild, Chromium-dev
Pawel, this is related to end-to-end sync integration tests. I want to run each test case with a different Gaia account. The backend already has XX accounts created that I can use and I am exploring ways for each test case to pick a unique Gaia account at runtime. 

My first idea was to pass all gaia accounts as command line arg and have the test launcher manage accessing those in each test case. As I mentioned, I did find a solution by creating a new test launcher and overriding  AdjustChildProcessCommandLine. However, I am wondering if there might a better way ?
Reply all
Reply to author
Forward
0 new messages