Junit4 and TestNG in one project with Maven

后端 未结 3 987
傲寒
傲寒 2020-12-21 05:38

To run them together there are few options available but I have chosen using different profiles for Junit and TestNG. But now problem is with excluding and including test c

3条回答
  •  青春惊慌失措
    2020-12-21 06:03

    The configuration for the compiler plugin excludes the TestNG types. The configuration from the profile is merged with the default configuration, so your effective compiler configuration is:

    
      org.apache.maven.plugins
      maven-compiler-plugin
      
        1.5
        1.5
        
          **/tests/**.java
          **/tests/utils/**.*
        
        
          **/tests/**.*
          **/tests/utils/**.*
        
      
    
    

    This means that your TestNG types aren't ever compiled and therefore aren't run.

    If you specify the section in the testNG profile it will override the default excludes and your TestNG types will be compiled and run. I can't remember if it will work with an empty excludes tag (i.e. ), you may have to specify something like this to ensure the default configuration is overridden.

        
          dummy
        
    

提交回复
热议问题