vim-xcode icon indicating copy to clipboard operation
vim-xcode copied to clipboard

Add custom build/test commands by configuration

Open yhkaplan opened this issue 7 years ago • 4 comments

Idea/pitch

So I'm not sure how difficult this might be, but what do you think about adding support for customizing test command arguments?

The two main use-cases I thought of are below.

Parallel testing with Xcode 10

set via g:xcodetest_arguments https://medium.com/xcblog/wwdc18-xcode-10-in-action-f56e14c62d79

$ xcodebuild -project Xcode10-Demo.xcodeproj/ -scheme Xcode10-Demo -destination 'platform=iOS Simulator,OS=12.0,name=iPhone X' clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -parallel-testing-worker-count 4

Running specific tests/test suites

https://stackoverflow.com/questions/35166214/running-individual-xctest-ui-unit-test-cases-for-ios-apps-from-the-command-li set via g:xcodetest_arguments or : Xtest -only-testing:TestBundle/TestSuite/TestCase

xcodebuild test -workspace <path> -scheme <name> -destination <specifier> -only-testing:TestBundle/TestSuite/TestCase

yhkaplan avatar Jul 21 '18 07:07 yhkaplan

I'm very on board with this.

I definitely thing the first thing to do would be to open up the ability to pass custom flags to xcodebuild test. I'd tweak the name for consistency to be g:xcode_xcodebuild_test_flags. That would leave us the ability to add flags for the base xcodebuild command down the line. Adding the flags to the Xtest command seems reasonable too, since we're not using arguments there at all yet.

One thought re: the -only-testing command: it'd be amazing if we could somehow integrate with vim-test if it's available. They are already doing a lot of work around finding the test case/module nearest to the cursor, and I actually added support for swift test in that plugin. This has been on my todo list for a long time.

gfontenot avatar Jul 23 '18 17:07 gfontenot

Sounds great!

Vim-test integration would also be very nice! My understanding of vim-test is that we could: a). copy the code from vim-xcode and integrate xcodebuild test support b). reimplement some features from vim-test c). integrate vim-xcode into vim-test such that, if a user has vim-xcode installed, he or she could use xcodebuild-based testing in vim-test

It sounds like you prefer option c), which certainly sounds like the best in the long term because maintenance would be easier. I'm guessing that the best way to implement this would be to make a very thin wrapper for vim-xcode in vim-test, but do you have any other approaches in mind?

I'll start implementing the test flags support in vim-xcode when I get the chance this week. This sounds very exciting!

yhkaplan avatar Jul 24 '18 05:07 yhkaplan

Yeah, C would be my pick for sure. vim-test has a fantastic architecture that would actually let us ship the runner alongside our plugin, with no code changes on their end. Users would need to add a custom runner in their config, but it should be easy enough to do. I started playing with this last night but didn't get too far. I'll keep picking at it if I can find the time.

gfontenot avatar Jul 24 '18 14:07 gfontenot

I opened up #88 to cover the vim-test stuff specifically, because I needed a place to record my thoughts on it.

gfontenot avatar Jul 24 '18 23:07 gfontenot