1

I'm trying to test this GitHub repository of mine using Travis CI. The problem I'm having is that what it does is use AppleScript's keystroke function to simulate user input. I can't figure out how to test this.

The repository is a Swift 4 library managed by the Swift Package Manager, in case that helps.

I've tried, on my computer, using a combination of readLine() and my typing method to get the output back as input, and I'm out of ideas.

Any help would be greatly appreciated.

Sam
  • 2,350
  • 1
  • 11
  • 22
  • You might look at [this post about unit-testing static libraries](https://stackoverflow.com/questions/4465267/is-it-possible-to-unit-test-a-static-library-project-using-xcodes-sentestingkit). In your tests, you could use `NEvent.addLocalMonitorForEvents(matching: .keyDown)` to detect keypresses (though there might be a better approach). Lastly, [`NSAppleScript`](https://developer.apple.com/documentation/foundation/nsapplescript) will make your life a *lot* easier. – aaplmath Aug 12 '18 at 19:39

0 Answers0