-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing Qt Code which requires EventHandling and UI #294
Comments
Idea / Solution is to implement and use a Qt based WireProtocolServer in the main of the test applikation:
Implementations (attached as zip)
Which uses a custom Implementation of
|
@kreuzberger I strongly recommend to not include the Qt classes nor UI in the acceptance tests. And not timer, you don't want to make your tests slower than needed. Only include and test the business logic of the application. When doing so, you probably don't need the event handling. This removes asynchronous (non-deterministic) behavior, making the tests stable. I had cases where we had queues (in Qt this would be queued connections) in the code under test. The solution was to dispatch the stuff in the queue until empty after every step. I think it was with QEventLoop::processEvents within AFTER_STEP hook. Or something like here. |
I agree with most of your doubts. Testing with no such constraints make live easier. Main advantage of the gherkin language is for me still to test user scenarios (not the gui) but if the app under the test is a rich desktop qt app and runs in a multi process enviroment i have to face it. Or use Squish. But testing the logic with squish is much more slower and complicated i think. But this is currently my intention, test the app instead of squish/gherkin with a different (and maybe better) approach. But back to the questions:
|
🤔 What's the problem you're trying to solve?
Testing source code which requires Qt EventHandling (e.g. due to Network, Timer) and / or UI requires to haven an Q(Core)Applikation running and be executed in Thread or in the Main Thread depending on how to use the eventhandling or the ui.
This seems not to be possible with the current implementation, where the cucumper-cpp test processing is done in the main loop.
✨ What's your proposed solution?
Fortunately there is a nomain library of cucumber-cpp which an alternativ implementation could use. Unfortunatly there is no code available to execute the Stream Reader in a non-blocking or event handling way.
Maybe examples or basic implementations for the supported Test frameworks should be provided.
⛏ Have you considered any alternatives or workarounds?
Workaround is done by:
📚 Any additional context?
The AsyncStreamReader original Code used in the attached files comes from https://gist.github.com/vmrob/38debbb80b93df6da4fa
Questions?
CukeEngineImpl, JsonWireMessageCodec, WireProtocolHandler, SocketServer
intended and maintained as API classes?The text was updated successfully, but these errors were encountered: