Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Apr 6, 2018

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 XXX option. 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).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
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 <[email protected]>
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 <[email protected]>
@danxuliu danxuliu added enhancement 3. to review Waiting for reviews labels Apr 6, 2018
@danxuliu danxuliu added this to the Nextcloud 14 milestone Apr 6, 2018
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoohoo!!!

@MorrisJobke MorrisJobke merged commit db6fa03 into master Apr 9, 2018
@MorrisJobke MorrisJobke deleted the make-possible-to-provide-acceptance-tests-for-apps branch April 9, 2018 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants