• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

How to choose the main to execute

 
Ranch Hand
Posts: 102
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I am not sure if this is a manven or eclipse issue. I have several tests (everyone with its main method) hanging from :workspace\pepe\hmi\src\test\java\es\fff\spv\hmi\test

and I don't know why but when running the maven build (clean install). One of them is being executed by default and I am not sure, bur I cannot find it on any pom.xml at all.

Anyone knows how it works or what should I do to change the test by default?

Thanks in advance.
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do all your test classes start or end with "Test"?  That is, do they match

  • Test*.java
  • *Test.java

  • If not, either change the names of the classes or explicitly include them.

    http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html
     
    author & internet detective
    Posts: 40793
    828
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Also, are these JUnit or TestNG tests? Or classes that just happen to be tests. JUnit/TestNG tests don't typically have a main method.
     
    Alfonso Sanz
    Ranch Hand
    Posts: 102
    3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you very much for your rapid answers. They all have main method. I am new with eclipse/maven and I feel lost. Then if I use the profile by default and my classes start/end (indeed they are). Don't need any other line at POM file?

    Thanks in advance.
     
    Jeanne Boyarsky
    author & internet detective
    Posts: 40793
    828
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Forget about Maven for a minute.

    Are you using JUnit/TestNG? If you aren't sure, can you show one of your tests?
     
    Alfonso Sanz
    Ranch Hand
    Posts: 102
    3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I am so sorry Jeanne, but is company info. I have no idea if it is JUnit...
     
    Jeanne Boyarsky
    author & internet detective
    Posts: 40793
    828
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    If you aren't sure, can you show one of your tests?

     
    Alfonso Sanz
    Ranch Hand
    Posts: 102
    3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Without imports... something like this:

     
    Jeanne Boyarsky
    author & internet detective
    Posts: 40793
    828
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ok, so it isn't JUnit or TestNG. It's just a class with a main method.

    Maven and Eclipse aren't going to run those automatically.

    This is what a JUnit test looks like. I strongly recommend you convert your tests to JUnit tests.

    If you want to continue using main methods, you'll need to run the classes individually and look at the output. Also, that test looks like it runs a GUI. Which you'd need to run manually anyway.
     
    Alfonso Sanz
    Ranch Hand
    Posts: 102
    3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Exactly, It runs a GUI. Thank you for your recommendation.
    reply
      Bookmark Topic Watch Topic
    • New Topic