JUNIT testscript execution, skipping

Posted on 2011-04-20
Last Modified: 2012-05-11

I am using JUNIT to run some test scripts. I would like to know how to skip some of the tests within the script.
Please advise on how can i resolve it. Any ideas, sample code, links, resources highly appreciated. thanks in advance
Question by:gudii9
    LVL 92

    Expert Comment

    you'll need to comment them out, you cannot skip individual tests.
    LVL 47

    Assisted Solution

    You can have, say, sequential  numbers of those tests you want to run as
    command line arguments and then have if clauses in you code which
    will excute each test depending on the presence of particular number in your command line

    Then you'd be able at least to run different tests
    without recompiling  
    LVL 92

    Assisted Solution

    Typically there is no need to skip an individual test, somewhat defeats the purpose of testing by reducing your test coverage.

    If you just want maven to skip the tests then that can be achieved with a command switch
    LVL 23

    Expert Comment

    If you use Junit4, you can do it..

    Check this thread.
    LVL 23

    Accepted Solution

    Also you can use Ignore annotation..

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    nested interface 5 29
    wordsWithout 49 64
    countPairs challenge 7 39
    countHi2 challenge 7 30
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now