yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator
MIT License
627 stars 147 forks source link

XCTest support #138

Closed Kastet closed 5 years ago

Kastet commented 5 years ago

Is XCTest supported? I tried Cmd+U and was getting

Fatal error: Use of global context is not permitted when running inside XCTest
yonaskolb commented 5 years ago

Hi @Kastet. Could you give some more information.

Do you mean the SwagGen codebase? If so and you've created an xcode project with swift package generate-xcodeproj, then yes just select the SwagGen scheme and press Cmd+U.

If you mean the generated Swift API then it totally depends on how you integrate it into your codebase. The generated code doesn't include any tests

yonaskolb commented 5 years ago

Wait I just tried running the tests via Xcode in SwagGen and I can see your issue. This is an integration issue with the test runner Spectre, and needs to be fixed 👍

In the meantime if you want to run the tests you can run swift test in the repo directory

Kastet commented 5 years ago

Thanks @yonaskolb and apologies for the poor description.

Yes I ended up running tests using SPM. It's the first time I used it - pretty cool.

yonaskolb commented 5 years ago

Strange, I went to fix this but found it isn't an issue anymore. Perhaps the update to Xcode 10.2 fixed something

Kastet commented 5 years ago

Just tried with Xcode10.2 and still able to reproduce

Screen Shot 2019-04-10 at 4 50 34 pm