-3

Need to ignore all the test class in my project. I knew we can use @Ignore. But I need to know if there is any way to ignore them at a project level.

Jay
  • 199
  • 1
  • 14
  • 6
    Uhm... don't run the tests? – Federico klez Culloca Oct 30 '19 at 15:25
  • lol @FedericoklezCulloca i need to do in java code.. – Jay Oct 30 '19 at 15:27
  • Then please specify what you mean, because as it stands your question doesn't make much sense. – Federico klez Culloca Oct 30 '19 at 15:28
  • Instead of adding @Ignore in all the classes, is there any other way to make it ? – Jay Oct 30 '19 at 15:30
  • 1
    Let me rephrase my point: why? Why do this when you can simply *not* run the tests? – Federico klez Culloca Oct 30 '19 at 15:31
  • 1
    Are you running the tests in an IDE or Maven? You can add a property to skip tests in Maven. The IDE will require more work, but that's Federico's point: Just don't run the tests. – duffymo Oct 30 '19 at 15:34
  • In my test environment, by default it will run all test class. i dont have access to change the configuration.if want to stop i need to add @Ignore in all my test class. So is there is any way to make it simple ?? – Jay Oct 30 '19 at 15:36
  • Can you avoid sending the test classes to the environment? Or send a dummy one? – Federico klez Culloca Oct 30 '19 at 15:38
  • I can not avoid. i need to do through code! – Jay Oct 30 '19 at 15:40
  • 1
    It's a shame you're not using junit5, because it has [this](https://junit.org/junit5/docs/current/api/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariable.html) which means you could put the annotation on all your classes and set the variable on all the environments where you want to run the tests but not on the test environment. – Federico klez Culloca Oct 30 '19 at 15:43
  • But it may be worthwhile to take some ideas from [this question](https://stackoverflow.com/questions/1689242/conditionally-ignoring-tests-in-junit-4) in your case. Hope it helps, somehow. – Federico klez Culloca Oct 30 '19 at 15:44

1 Answers1

1

Achieved..

In pom.xml file inside the <properties> i added below

<maven.test.skip>true</maven.test.skip>

it will skip all the test cases in build level.

Jay
  • 199
  • 1
  • 14