Running tests from maven command line: Different options
When we work on developing automation scripts ,we may sometime need run based on different conditions. Let us see some here. Assuming Prerequisite met for running : Some TestClasses with TestMethods are present in Framework Maven is used as build tool for Framework design. Using TestNG framework for Test Cases The following are the steps: Run specific test from a test class: mvn -Dtest=Testclassname#testmethodname test To run all tests in class: mvn -Dtest=classname test To run test that match a pattern: This will run all tests that starts with testcreate in class named Testclassname mvn -Dtest=Testclassname#testcreate* test Run all test methods match pattern ‘testFoo*’ and ‘testBar*’ from a test class: mvn test -Dtest=Test1#testFoo*+testBar* To run multiple methods in a testclass: mvn -Dtest=Testclassname#testone+testtwo test T o run Multiple method from multiple class : mvn test -Dtest=CLASS_NAME1#METHOD_NAME1,CLASS_NAME2#METHOD_NAME2 To run multiple tes...