crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel Reid (JIRA)" <>
Subject [jira] [Commented] (CRUNCH-326) Add section on unit testing to user guide
Date Mon, 20 Jan 2014 08:19:23 GMT


Gabriel Reid commented on CRUNCH-326:

Thanks for the tip about the tabs in markdown, not having to deal with converting all those
angle brackets to html entities is definitely a relief.

The patch looks good to me, with the following minor comments:
* There is a reference to the getCounters method in MemPipeline, but it's written as "Counters
getCounters". Intentional, or is that from a copy-paste from the javadoc or something?
* I think it would be good to have a couple of really simple code examples for the testing
of DoFns via a single process() call and/or via MemPipeline, something like this:

    public void testToUpperCaseFn() {
        InMemoryEmitter<String> emitter = new InMemoryEmitter<String>();

        new ToUpperCaseFn().process("input", emitter);

        assertEquals(ImmutableList.of("INPUT"), emitter.getOutput());

and this:

    public void testToUpperCase_WithPipeline() {
        PCollection<String> inputStrings = MemPipeline.collectionOf("a", "B", "c");

        PCollection<String> upperCaseStrings = inputStrings.parallelDo(new ToUpperCaseFn(),

        assertEquals(ImmutableList.of("A", "B", "C"), Lists.newArrayList(upperCaseStrings.materialize()));


One other thing I noticed (although not linked directly to this ticket) is that the links
to the javadocs have a hardcoded version number in them. I've noticed that most projects have
a "current" version link to their javadocs, and if we used that in the user guide then the
guide will always point to the current docs. I'll create a separate ticket for that.

> Add section on unit testing to user guide
> -----------------------------------------
>                 Key: CRUNCH-326
>                 URL:
>             Project: Crunch
>          Issue Type: Bug
>          Components: Site
>            Reporter: Josh Wills
>         Attachments: unittest.patch
> One section the new user guide is missing: guidance on unit testing Crunch pipelines.

This message was sent by Atlassian JIRA

View raw message