Make possible to provide acceptance tests for apps#9114
Merged
MorrisJobke merged 3 commits intomasterfrom Apr 9, 2018
Merged
Conversation
In order to autoload the server context classes the "bootstrap" directory was explicitly listed in Behat autoload configuration. This is fine in the configuration of acceptance tests for the server, but it would force the configuration of acceptance tests for the apps to explicitly include the path for the server context classes to be able to use them (for example, for the login step). Besides with its own configuration Behat also supports autoloading classes using Composer, so now context classes are autoloaded using Composer instead; thanks to this the server context classes are autoloaded also in the acceptance tests for apps without any explicit configuration in them. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the acceptance tests were run they were always loaded from the "tests/acceptance" directory of the Nextcloud server. Now it is possible to set the directory used to look for the Behat configuration and the Nextcloud installation script, which makes possible to run acceptance tests for the apps too instead of only for the server (although if no directory is explicitly given the tests for the server are the ones run). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until now the acceptance tests were limited to the server and apps in the Nextcloud server repository. This pull request makes possible to use the acceptance tests framework also in apps on their own repository (as long as the app repository was cloned in the apps directory of a Nextcloud server repository, which can be easily done in Drone with some shell commands, and is probably the typical setup in a development machine).
Instead of always loading the Behat configuration from tests/acceptance now the directory can be explicitly set with the
--acceptance-tests-dir XXXoption. Therefore now apps can provide their own Behat configuration to load the features and context classes for the app, including context classes from the Nextcloud server, for example, to use the login steps. Note that the context classes for the Nextcloud server and the core acceptance test framework classes are automatically loaded; there is no need to explicitly set them in the Behat configuration of the app.In any case, the Behat configuration used in the app is exclusive for the app; it does not extend the Behat configuration from the Nextcloud server (even if I tried to avoid duplicating some configuration parameters, but after exploring every option I could think of I found no way to do that :-( ).
The installAndConfigureServer.sh script executed when the acceptance tests are setup must be provided too in the acceptance tests dir. In this case, however, it is possible to just call the installAndConfigureServer.sh from the acceptance tests of Nextcloud server; after doing that the script for the app will typically enable it so the app is already available when the acceptance tests are run.
All of the above can be seen more clearly in nextcloud/spreed#768, which is the pull request to add acceptance tests for Nextcloud Talk (please refer to the messages of the commits for further information).