When you submit test results using launchable record tests
, you can submit additional metadata in the form of key-value pairs using the --flavor
option.
For example:
# run tests in Chrome and report resultscypress run --reporter junit --reporter-options "mochaFile=report/test-output-chrome.xml"launchable record tests --build [BUILD NAME] --flavor browser=chrome cypress report/test-output-chrome.xml# run tests in Firefox and report resultscypress run --reporter junit --reporter-options "mochaFile=report/test-output-firefox.xml"launchable record tests --build [BUILD NAME] --flavor browser=firefox cypress report/test-output-firefox.xml
And so on. (You can submit multiple key-value pairs, too: --flavor key=value --flavor key2=value2
)
Later, when you want to request a subset of tests, you can include the same key-value pairs to get a subset of tests specifically selected for that flavor.
For example:
# get a subset for Chrome, run it, then report resultsfind ./cypress/integration | launchable subset --build [BUILD NAME] --confidence 90% --flavor browser=chrome cypress > subset-chrome.txtcypress run --spec "$(cat subset-chrome.txt)" --reporter junit --reporter-options "mochaFile=report/test-output-chrome.xml"launchable record tests --build [BUILD NAME] --flavor browser=chrome cypress report/test-output-chrome.xml# get a subset for Firefox, run it, then report resultsfind ./cypress/integration | launchable subset --build [BUILD NAME] --confidence 90% --flavor browser=firefox cypress > subset-firefox.txtcypress run --spec "$(cat subset-firefox.txt)" --reporter junit --reporter-options "mochaFile=report/test-output-firefox.xml"launchable record tests --build [BUILD NAME] --flavor browser=firefox cypress report/test-output-firefox.xml
This feature lets you select the right tests to run based on the changes being tested and the environment they are being run in.
Note: if your workflow involves creating a session externally using launchable record session
, you should set --flavor
in that command (instead of launchable subset
or launchable record tests
, as they will be ignored), such as:
launchable record session --build [BUILD NAME] --flavor browser=chrome > session.txtfind ./cypress/integration | launchable subset --session $(cat session.txt) --confidence 90% cypress > subset-chrome.txtcypress run --spec "$(cat subset-chrome.txt)" --reporter junit --reporter-options "mochaFile=report/test-output-chrome.xml"launchable record tests --session $(cat session.txt) cypress report/test-output-chrome.xml