Hi Lipeng,

Note that Surefire only picks up tests that match the following:

By default, the Surefire Plugin will automatically include all test classes
with the following wildcard patterns:

   - "**/Test*.java" - includes all of its subdirectories and all Java
   filenames that start with "Test".
   - "**/*Test.java" - includes all of its subdirectories and all Java
   filenames that end with "Test".
   - "**/*TestCase.java" - includes all of its subdirectories and all Java
   filenames that end with "TestCase".


http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

Try adding a new test file (in the appropriate test dir) called
TestMiniDFSClusterManager with your test code.

Best,
Andrew



On Wed, Feb 25, 2015 at 4:21 PM, Lipeng Wan <lipengwa...@gmail.com> wrote:

> Hi Charles,
>
> Thanks for your reply!
>
> I run "mvn test -Dtest=MiniDFSClusterManager", but no test code was
> executed.
> Here is the output:
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
>
> Results :
>
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 58.574 s
> [INFO] Finished at: 2015-02-25T17:38:53-05:00
> [INFO] Final Memory: 62M/697M
> [INFO]
> ------------------------------------------------------------------------
>
> Should I put the test code under a specific directory so that the
> maven can find it?
>
> Lipeng
>
> On Wed, Feb 25, 2015 at 5:38 PM, Charles Lamb <cl...@cloudera.com> wrote:
> > On 2/25/2015 5:35 PM, Lipeng Wan wrote:
> >>
> >> Dear all,
> >>
> >> I'm a beginner of HDFS development and trying to write my own test
> >> code of HDFS. For example, I modified the MiniDFSClusterManager class
> >> a little bit and try to execute it from command line. When I run "mvn
> >> test" under the hadoop-hdfs directory, it seems like all the existing
> >> test code can be executed correctly. I can also use "mvn -Dtest=XXX
> >> test" to run a specific existing test code. However, I'm not familiar
> >> with Maven, and I don't know how to let Maven know my own test code
> >> and execute it. Should I add some information in the pom.xml?
> >>
> > LW,
> >
> > If all you are doing is adding a new unit test, then just go ahead and
> add
> > it. mvn test will find it. Alternatively, you can do
> >
> > mvn test -Dtest=TestMyUnitTest
> >
> > and it should execute (assuming you named your unit test TestMyUnitTest).
> >
> > IHTH.
> >
> > Charles
> >
>

Reply via email to