How to pass java code a parameter from maven for testing

后端 未结 6 1429
故里飘歌
故里飘歌 2020-11-30 03:17

I need to pass on following values …

exeEvironment (Test environment) , testGroup (Group in testNG)

from Command-Line ->

6条回答
  •  抹茶落季
    2020-11-30 03:51

    building on the accepted answer

    if maven surefire and the are declared in a maven profile, they are not available and will return null unless the profile is also invoked.

    Command Line argument

    mvn clean test -PmyTestProfile -Denv.USER=UAT -Dgroups=Sniff 
    

    pom.xml

    
        
            myTestProfile
            
                false
            
    
            
                
                    
                        org.apache.maven.plugins
                        maven-surefire-plugin
                        ${surefire.version}
                        
                            
                                ${env.USER}
                            
                        
                    
                
            
        
    
    

提交回复
热议问题