Lolpez
Lolpez

Reputation: 879

How to run a TestCafe test with CLI that contains a metadata array

I have a test with the following metadata:

test.meta({ type: 'smoke', testcase: ['tc01', 'tc02'] });

The testcase metadata contains an array of id's that I would like to use them as filter for running the test using any of the values using the command line interface:

testcafe --test-meta testcase=tc01

testcafe --test-meta testcase=tc02

These two command lines should run the same test, however they don't work. Is there another way to approach to this solution?

Upvotes: 1

Views: 562

Answers (1)

pavelsaman
pavelsaman

Reputation: 8332

Reading this discussion on TestCafe's github page, it seems that metadata has to be only single value strings: https://github.com/DevExpress/testcafe/issues/3267 The issue is then closed and the last explanation was that such a feature request is not very clear because:

In addition, the particular case you are addressing is a bit tricky, what will be the user expected behaviour?, To match only when the array has all the passed values? or when the array is equal to that values (ie: don't have any extra one)?.

Such an option is not mentioned in the official documentation either: https://devexpress.github.io/testcafe/documentation/guides/basic-guides/organize-tests.html#specify-test-metadata

That leads me to believe you can't really achive what you're asking for as of June 2020.

Upvotes: 2

Related Questions