Buck syntax for running tests of single plugin

107 views
Skip to first unread message

Sebastian Schuberth

unread,
Aug 17, 2016, 5:16:01 AM8/17/16
to Repo and Gerrit Discussion
Hi,

can someone share the syntax for calling buck to run the tests for only a single plugin? Say, the cookbook-plugin as an example?

Also, is there a specific reason why we do not seem to run the tests as part of building the plugins on https://gerrit-ci.gerritforge.com/?

Thanks,
Sebastian

Sebastian Schuberth

unread,
Aug 17, 2016, 5:22:00 AM8/17/16
to Repo and Gerrit Discussion

BTW, I *did* try "buck test plugins/cookbook-plugin:cookbook-plugin", but that only gives "NO TESTS RAN".

Björn Pedersen

unread,
Aug 17, 2016, 5:25:50 AM8/17/16
to Repo and Gerrit Discussion
Hi,

try:

buck test --test-selectors CookbookIT#

(buck test --help gives more information)

Björn

Sebastian Schuberth

unread,
Aug 17, 2016, 5:26:43 AM8/17/16
to Repo and Gerrit Discussion
On Wednesday, August 17, 2016 at 11:22:00 AM UTC+2, Sebastian Schuberth wrote:

BTW, I *did* try "buck test plugins/cookbook-plugin:cookbook-plugin", but that only gives "NO TESTS RAN".

Ah, it's "buck test plugins/cookbook-plugin:cookbook_tests. Unfortunately, there seems to be no convention about the test target naming, so you need to look it up in the BUCK file for other plugins.

Sebastian Schuberth

unread,
Aug 17, 2016, 5:29:22 AM8/17/16
to Björn Pedersen, Repo and Gerrit Discussion
Thanks, but that seems to be for running a single test class. I was
looking for running all tests for a single plugin, but I believe to
have found the answer (see my other post).
> --
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/repo-discuss/kdSlH-yL0V0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> repo-discuss...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Sebastian Schuberth

Hugo Arès

unread,
Aug 17, 2016, 11:05:39 AM8/17/16
to Repo and Gerrit Discussion, ice...@googlemail.com
In order to be able to execute test from command line, plugins must define a java_test rule in their BUCK file. In that rule, most of plugins defines a label that can be used to execute all test of that rule.
The label is typically the plugin name.

cookbook-plugin/BUCK:

java_test(
  ....
  labels = ['cookbook-plugin'],
  ...
)

So you can use the following command to execute all cookbook-plugin tests:
buck test --include=cookbook-plugin

Sebastian Schuberth

unread,
Aug 17, 2016, 11:19:16 AM8/17/16
to Hugo Arès, Repo and Gerrit Discussion, ice...@googlemail.com
Good to know, thanks. Still I was hoping there was a consistent way to
run all tests of a plugin. For example to keep CI configurations of
building plugins simple (allow to share most of the config) and be
able to always use the same target / label to run the tests
independent of the actual plugin.
Reply all
Reply to author
Forward
0 new messages