You must add the package to a project with a UI app and then add a UI test target to the project.
Without a UI app to run what would you expect to happen in this line? What app would be launched? XCTest is not going to create an app for you. That just wouldn't make sense.
You could probably construct a single shell app that loads in different components as the root view based on a launch flag. You can then configure the launch flags in your test.