Testing Bazel rules?

96 views
Skip to first unread message

Jonathan Lange

unread,
Sep 21, 2017, 2:54:07 AM9/21/17
to bazel-discuss
Hello,

Is there any guidance for testing Bazel rules?

I notice that rules_go has a pretty impressive test infrastructure, but there's little in the way of commentary, so it would take rather a lot of work to figure out how rules for another language could do likewise.

Is there a blog post or a document or something I could take a look at?

Thanks,
jml

Jon Brandvein

unread,
Sep 21, 2017, 8:11:02 PM9/21/17
to bazel-discuss

Jonathan Lange

unread,
Sep 22, 2017, 2:17:56 AM9/22/17
to Jon Brandvein, bazel-discuss
I don't have access to that any more. Is there a public URL?
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/c8c15304-01d3-4d41-b514-62985cf27379%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jon Brandvein

unread,
Sep 22, 2017, 9:48:07 AM9/22/17
to Jonathan Lange, bazel-discuss
Apologies for the non-functional link.

We don't yet have a dedicated framework for unit testing Skylark rules. The general trick in the meantime is to put assertions (using fail()) inside dummy rules that depend on the rules under test, so that they have access to the returned providers. And of course, you can also have assertions over helper functions without having to depend on anything. Any assertion failures will be treated as a failure to build the dummy rule.

We'll be looking to add stronger Skylark testing support in the future. In the meantime we should externalize that doc.

On Fri, Sep 22, 2017 at 2:17 AM, Jonathan Lange <j...@mumak.net> wrote:
I don't have access to that any more. Is there a public URL?
On Fri, 22 Sep 2017 at 01:11, 'Jon Brandvein' via bazel-discuss <bazel-discuss@googlegroups.com> wrote:


On Thursday, September 21, 2017 at 2:54:07 AM UTC-4, Jonathan Lange wrote:
Hello,

Is there any guidance for testing Bazel rules?

I notice that rules_go has a pretty impressive test infrastructure, but there's little in the way of commentary, so it would take rather a lot of work to figure out how rules for another language could do likewise.

Is there a blog post or a document or something I could take a look at?

Thanks,
jml

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

ittai zeidman

unread,
Sep 23, 2017, 12:41:19 AM9/23/17
to bazel-discuss
There is also work being done by Damien to enable end to end testing with Bazel as part of a bazel Build.
Not sure when it will be exposed but you can take a look at rules scala's bash script to get a sense of our e2es. Once Damien's work will be released we'll probably migrate to using it (currently our e2es don't run in Bazel)
Reply all
Reply to author
Forward
0 new messages