How can I ignore all test methods using ignore annotation in JUnit

0 votes
Jun 13, 2019 in Selenium by Gavish
3,914 views

1 answer to this question.

0 votes

@Gavish, if you want to ignore all the test methods, then you need to use @Ignore annotation at the class level. Following code snippet will demonstrate how you can ignore all test methods by calling @ignore at class level: 

package ignoreTestCase.junit;		

import static org.junit.Assert.assertEquals;				

import org.junit.Ignore;		
import org.junit.Test;		

@Ignore		
public class JunitTestExample {				

    public String message = "Ignore Test Methods";							

    JUnitMessage junitMessage = new JUnitMessage(message);							

    @Test		
    public void testJUnitMessage() {					

        System.out.println("Junit Message is printing ");					
        assertEquals(message, junitMessage.printMessage());					

    }		

    @Test		
    public void testJUnitHiMessage() {					
        message="Hi!" +message;							
        System.out.println("Junit Hi Message is printing ");					
        assertEquals(message, junitMessage.printHiMessage());					

    }		
}
answered Jun 13, 2019 by Tisha

Related Questions In Selenium

0 votes
1 answer

How can I run test cases in parallel using Keyword Driven Framework?

One solution to try for executing test ...READ MORE

answered Jun 29, 2020 in Selenium by Alexander
2,894 views
0 votes
1 answer

How can I click on male tag in facebook using selenium?

There is an approach for locating an ...READ MORE

answered Dec 21, 2018 in Selenium by Nabarupa
1,981 views
0 votes
1 answer

How can I travel forward and back in a browser using selenium?

You can use the Navigate interface to ...READ MORE

answered Dec 31, 2018 in Selenium by Nabarupa
12,283 views
0 votes
1 answer

What are the Junit Annotations used in Selenium Scripts?

Hi Priyanka, there are many annotations available ...READ MORE

answered Jun 12, 2019 in Selenium by Maria
1,133 views
0 votes
1 answer

What is the use of @Rule annotation in JUnit?

Hello Sarfaraz, JUnit provides special kind of handling ...READ MORE

answered Jun 19, 2019 in Selenium by anonymous
• 28,140 points
1,673 views
0 votes
1 answer

TestNG and Junit

No, testNG is better than JUnit. Here ...READ MORE

answered Jan 8, 2019 in Selenium by Nabarupa
820 views
0 votes
1 answer
0 votes
1 answer

How can I scroll a web page in Mozilla Firefox using Selenium?

Hi Rohan, steps to scroll a webpage in ...READ MORE

answered May 14, 2019 in Selenium by Pratibha
• 3,690 points
3,225 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP