Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3211008
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:39:20+00:00 2026-05-17T14:39:20+00:00

I use junit assumptions to decide whether to run a test or not. Tests

  • 0

I use junit assumptions to decide whether to run a test or not.
Tests where the assumption fails are ignored/skipped by the junit framework.

I wonder why skipped tests are not reported as ‘skipped’?

Please have a look at the example:

import static org.junit.Assert.fail;
import org.junit.Assume;
import org.junit.Test;

public class AssumptionTest {

    @Test
    public void skipAssumptionFailureTest() {
        Assume.assumeTrue("foo".equals("bar"));
        fail("This should not be reached!");
    }
}

Running this test in a maven project results in:

Running AssumptionTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec

I would prefer to have this test reported as ‘skipped’. Is there any chance to achieve this?

(junit 4.8.1; maven 2.2.1; java 1.6.0_21)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:39:21+00:00Added an answer on May 17, 2026 at 2:39 pm

    You can’t do this out-of-the-box as the only way to skip tests is with the @Ignore annotation. However, I found a blog post which might just be what you are looking for:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What GUI should use to run my JUnit tests, and how exactly do I
with ant it is possible to run JUnit tests and generate test reports in
How do I use JUnit to test a class that has internal private methods,
How can I use JUnit idiomatically to test that some code throws an exception?
I wonder if it is a good practice to use JUnit's @Ignore. And how
I'm using IntelliJ-Idea to write Java daemons. We use JUnit to unit test our
I use JUnit 3.x TestRunner that intantiates all tests at once before running them.
I use JUnit 4 in eclipse. I have some test classes in my package
I'm forced to use JUnit 3 for a particular test suite. I understand setUp()
What's the actual use of 'fail' in JUnit test case?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.