How to add a view dependency to a Drupal 8 functional test
Sometimes the code in core is not as pretty and consistent as we would like, which can make it a but tricky to find out what is best practice.

For views, it seems that this is pretty consistent. You should create a test module and have the view config yml files be placed inside a test_views folder of the module.

There are examples of this in node and rest modules.