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

  • SEARCH
  • Home
  • 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 6818817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:13:30+00:00 2026-05-26T21:13:30+00:00

I have a Java project with a lot of classes. Now I want to

  • 0

I have a Java project with a lot of classes. Now I want to get a list with all jUnit tests. My idea was to use grep for that.

So I navigated to the root folder, and use the following command:

grep junit -R ./ > output.txt

But obviously this isn’t correct. So my question is. How is the correct command? And are there ways that are more easier to find jUnit tests?

  • 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-26T21:13:30+00:00Added an answer on May 26, 2026 at 9:13 pm

    You’d want:

    grep -r junit *
    

    But you need to be a little careful with that, as it’ll go through all files, include jars.

    Better to use find or ack:

    ack --java -cl '@Test' # Print filenames with, and # occurences of, @Test annotations
    

    Or more boringly:

    find . -name *.java | xargs grep junit
    ack --java junit # Or, more accurately:
    ack --java 'import\s.*?junit.*'
    

    (If you’re not using ack, for some stuff, it’s just awesome.)

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

Sidebar

Related Questions

I have a Java project and I want to include a text file with
I have made a java project and want to deliver it to a client
I have a Java project that currently has a lot of JARs in its
I have a rather complex project here that involves a lot of calculations. Now
i often have in java projects a lot of small helper(storage) classes like 2-Tuple,
I work on an open-source Java project, and we have a lot of resource
I have a Java project that needs a addon interface. I was thinking about
I have a Java project in Eclipse with ~10 packages and ~10 class files
I have a Java project connecting to an Ingres database and using the Spring
I have a Java project that I'm trying to implement with a model-view-controller design.

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.