You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Jesse Anderson <je...@smokinghand.com> on 2017/01/04 16:18:13 UTC

Re: Running a Specific Test

The blog post <http://www.jesse-anderson.com/2017/01/maven-tips/> is up. It
covers some of the common Maven commands I've needed when developing Beam.
One is how to run a verify on a single module instead of everything. The
second is how to run unit tests both in the IDE and from the command line
in Maven.

Thanks again to everyone for your help.

On Thu, Dec 29, 2016 at 1:39 PM Dan Halperin <dh...@google.com.invalid>
wrote:

> If you'd like early eyes on the blog post, let us know. Happy to review!
>
> One thing worth noting: we've tried to structure Beam so that the pain is
> mostly limited to the core. Many modules have module-specific unit tests
> that use DirectRunner directly. The module simply has a test dependency on
> DirectRunner, and unit tests that expect the DirectRunner to be there "just
> work". It's only the 2 modules the DirectRunner depends on directly
> (sdk-core and runners-core) that have this pain.
>
> Now for tests that should work on *any* runner, there is similar
> customization -- @RunnableOnService (today, some better name tomorrow) and
> runnable-on-service-tests, etc. etc.
>
> Dan
>
> On Thu, Dec 29, 2016 at 12:42 PM, Jesse Anderson <je...@smokinghand.com>
> wrote:
>
> > Thanks to everyone for their help. I'm writing a blog about the various
> > Maven things you need to know with Beam.
> >
> > @Dan that command line worked. Thanks!
> >
> > On Thu, Dec 29, 2016 at 11:23 AM Stas Levin <st...@gmail.com> wrote:
> >
> > > I believe you raise a good point :)
> > >
> > > On Thu, Dec 29, 2016 at 9:00 PM Dan Halperin
> <dhalperi@google.com.invalid
> > >
> > > wrote:
> > >
> > > > I suspect -- but may be wrong -- that the command line Stas gives
> will
> > > use
> > > > the *installed* version of beam-sdks-java-core. If you are iterating
> > on a
> > > > @NeedsRunner test in the SDK core, you will either need to reinstall
> it
> > > > over and over again, or use `-am` to force recompilation of the core.
> > > >
> > > > Here is a command that works for me. Please criticize :)
> > > >
> > > > mvn -Dtest=org.apache.beam.sdk.transforms.RegexTest
> > -DfailIfNoTests=false
> > > > -pl runners/direct-java -am integration-test
> > > >
> > > > Note that this is an `integration-test`, not a `test` because it
> tests
> > > the
> > > > integration of the SDK with the DirectRunner:
> > > >
> > > https://github.com/apache/beam/blob/master/runners/direct-
> > java/pom.xml#L64
> > > >
> > > > Dan
> > > >
> > > > On Thu, Dec 29, 2016 at 10:53 AM, Stas Levin <st...@gmail.com>
> > > wrote:
> > > >
> > > > > P.S
> > > > > You can also do this from the main directory (without cd-ing into
> the
> > > > > direct-runner):
> > > > >
> > > > > "mvn test -Dtest=RegexTest
> > > > > -DdependenciesToScan=org.apache.beam:beam-sdks-java-core -pl
> > > > > runners/direct-java"
> > > > >
> > > > > On Thu, Dec 29, 2016 at 8:50 PM Stas Levin <st...@gmail.com>
> > > wrote:
> > > > >
> > > > > > Once you "cd" into "runners/direct-java" you can use:
> > > > > >
> > > > > > "mvn test -Dtest=RegexTest
> > > > > > -DdependenciesToScan=org.apache.beam:beam-sdks-java-core"
> > > > > >
> > > > > > -Stas
> > > > > >
> > > > > > On Thu, Dec 29, 2016 at 8:27 PM Jesse Anderson <
> > > jesse@smokinghand.com>
> > > > > > wrote:
> > > > > >
> > > > > > I tried that one already. It gives a no tests run error. If you
> > > bypass
> > > > > that
> > > > > > error with -DfailIfNoTests=false, no tests get run at all.
> > > > > >
> > > > > > On Thu, Dec 29, 2016 at 10:20 AM Jean-Baptiste Onofré <
> > > jb@nanthrax.net
> > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Jesse
> > > > > > >
> > > > > > > Mvn test -Dtest=RegexTest
> > > > > > >
> > > > > > > Should work
> > > > > > >
> > > > > > > Don't forget the test goal. And no need to provide the fqcn.
> > > > > > >
> > > > > > > Regards
> > > > > > > JB⁣​
> > > > > > >
> > > > > > > On Dec 29, 2016, 18:55, at 18:55, Jesse Anderson <
> > > > > jesse@smokinghand.com>
> > > > > > > wrote:
> > > > > > > >Does anyone know the Maven way to run a specific unit test
> with
> > > > Beam?
> > > > > > > >I've
> > > > > > > >tried:
> > > > > > > >mvn -Dtest=org.apache.beam.sdk.transforms.RegexTest
> > > > > > > >-DfailIfNoTests=false
> > > > > > > >-Dgroups="org.apache.beam.sdk.testing.NeedsRunner" -pl
> > > > > > > >org.apache.beam:beam-sdks-java-core test
> > > > > > > >
> > > > > > > >The test still doesn't run. Does anyone know what I'm missing?
> > > > > > > >
> > > > > > > >Thanks,
> > > > > > > >
> > > > > > > >Jesse
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Running a Specific Test

Posted by Jesse Anderson <je...@smokinghand.com>.
I just found out that running:
mvn verify -pl org.apache.beam:beam-sdks-java-core

Doesn't run the checkstyle for some reason. I'm not sure why and I had a
bunch of checkstyle errors.

On Wed, Jan 4, 2017 at 8:18 AM Jesse Anderson <je...@smokinghand.com> wrote:

> The blog post <http://www.jesse-anderson.com/2017/01/maven-tips/> is up.
> It covers some of the common Maven commands I've needed when developing
> Beam. One is how to run a verify on a single module instead of everything.
> The second is how to run unit tests both in the IDE and from the command
> line in Maven.
>
> Thanks again to everyone for your help.
>
> On Thu, Dec 29, 2016 at 1:39 PM Dan Halperin <dh...@google.com.invalid>
> wrote:
>
> If you'd like early eyes on the blog post, let us know. Happy to review!
>
> One thing worth noting: we've tried to structure Beam so that the pain is
> mostly limited to the core. Many modules have module-specific unit tests
> that use DirectRunner directly. The module simply has a test dependency on
> DirectRunner, and unit tests that expect the DirectRunner to be there "just
> work". It's only the 2 modules the DirectRunner depends on directly
> (sdk-core and runners-core) that have this pain.
>
> Now for tests that should work on *any* runner, there is similar
> customization -- @RunnableOnService (today, some better name tomorrow) and
> runnable-on-service-tests, etc. etc.
>
> Dan
>
> On Thu, Dec 29, 2016 at 12:42 PM, Jesse Anderson <je...@smokinghand.com>
> wrote:
>
> > Thanks to everyone for their help. I'm writing a blog about the various
> > Maven things you need to know with Beam.
> >
> > @Dan that command line worked. Thanks!
> >
> > On Thu, Dec 29, 2016 at 11:23 AM Stas Levin <st...@gmail.com> wrote:
> >
> > > I believe you raise a good point :)
> > >
> > > On Thu, Dec 29, 2016 at 9:00 PM Dan Halperin
> <dhalperi@google.com.invalid
> > >
> > > wrote:
> > >
> > > > I suspect -- but may be wrong -- that the command line Stas gives
> will
> > > use
> > > > the *installed* version of beam-sdks-java-core. If you are iterating
> > on a
> > > > @NeedsRunner test in the SDK core, you will either need to reinstall
> it
> > > > over and over again, or use `-am` to force recompilation of the core.
> > > >
> > > > Here is a command that works for me. Please criticize :)
> > > >
> > > > mvn -Dtest=org.apache.beam.sdk.transforms.RegexTest
> > -DfailIfNoTests=false
> > > > -pl runners/direct-java -am integration-test
> > > >
> > > > Note that this is an `integration-test`, not a `test` because it
> tests
> > > the
> > > > integration of the SDK with the DirectRunner:
> > > >
> > > https://github.com/apache/beam/blob/master/runners/direct-
> > java/pom.xml#L64
> > > >
> > > > Dan
> > > >
> > > > On Thu, Dec 29, 2016 at 10:53 AM, Stas Levin <st...@gmail.com>
> > > wrote:
> > > >
> > > > > P.S
> > > > > You can also do this from the main directory (without cd-ing into
> the
> > > > > direct-runner):
> > > > >
> > > > > "mvn test -Dtest=RegexTest
> > > > > -DdependenciesToScan=org.apache.beam:beam-sdks-java-core -pl
> > > > > runners/direct-java"
> > > > >
> > > > > On Thu, Dec 29, 2016 at 8:50 PM Stas Levin <st...@gmail.com>
> > > wrote:
> > > > >
> > > > > > Once you "cd" into "runners/direct-java" you can use:
> > > > > >
> > > > > > "mvn test -Dtest=RegexTest
> > > > > > -DdependenciesToScan=org.apache.beam:beam-sdks-java-core"
> > > > > >
> > > > > > -Stas
> > > > > >
> > > > > > On Thu, Dec 29, 2016 at 8:27 PM Jesse Anderson <
> > > jesse@smokinghand.com>
> > > > > > wrote:
> > > > > >
> > > > > > I tried that one already. It gives a no tests run error. If you
> > > bypass
> > > > > that
> > > > > > error with -DfailIfNoTests=false, no tests get run at all.
> > > > > >
> > > > > > On Thu, Dec 29, 2016 at 10:20 AM Jean-Baptiste Onofré <
> > > jb@nanthrax.net
> > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Jesse
> > > > > > >
> > > > > > > Mvn test -Dtest=RegexTest
> > > > > > >
> > > > > > > Should work
> > > > > > >
> > > > > > > Don't forget the test goal. And no need to provide the fqcn.
> > > > > > >
> > > > > > > Regards
> > > > > > > JB⁣​
> > > > > > >
> > > > > > > On Dec 29, 2016, 18:55, at 18:55, Jesse Anderson <
> > > > > jesse@smokinghand.com>
> > > > > > > wrote:
> > > > > > > >Does anyone know the Maven way to run a specific unit test
> with
> > > > Beam?
> > > > > > > >I've
> > > > > > > >tried:
> > > > > > > >mvn -Dtest=org.apache.beam.sdk.transforms.RegexTest
> > > > > > > >-DfailIfNoTests=false
> > > > > > > >-Dgroups="org.apache.beam.sdk.testing.NeedsRunner" -pl
> > > > > > > >org.apache.beam:beam-sdks-java-core test
> > > > > > > >
> > > > > > > >The test still doesn't run. Does anyone know what I'm missing?
> > > > > > > >
> > > > > > > >Thanks,
> > > > > > > >
> > > > > > > >Jesse
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>