# Eclipse: files in /src/test/java not being scanned

**URL:** <https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719>\
**Category:** Eclipse\
**Tags:** eclipse, sonarqube-ide\
**Created:** [April 11, 2019, 1:33pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719 "2019-04-11T13:33:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwetzel](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@mwetzel](https://community.sonarsource.com/u/mwetzel)\
**Post date:** [April 11, 2019, 1:33pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/1 "2019-04-11T13:33:53Z")

</div>

Planning on using SonarLint to scan Test Automation Java files. Using Eclipse with SonarLint 4.1.

While playing with the tool, I noticed that the Java files under /src/test/java are not being scanned.

- I am not connected to SonarQube
- “Test file regular expressions” is blank
- using Maven

Anyone?

thanks  
Matt Wetzel

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [April 11, 2019, 2:18pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/2 "2019-04-11T14:18:28Z")

</div>

Hi,

Is the file not analyzed, or simply no issues are reported (you can check SonarLint console in verbose mode to see if something is triggered when saving a change to the file).

My guess is that you are using a recent version of Eclipse, that has built-in support for test source folders. And most rules of SonarJava are not applied to test sources.

---

<div class="post-metadata">

**Author:** ![mwetzel](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@mwetzel](https://community.sonarsource.com/u/mwetzel)\
**Post date:** [April 11, 2019, 2:39pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/3 "2019-04-11T14:39:58Z")

</div>

Files are not being analyzed.  
Using Eclipse version 2019-03

Any way to force SonarLint to look at /src/test/java?

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [April 12, 2019, 7:03am UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/4 "2019-04-12T07:03:27Z")

</div>

Is there anything displayed in the SonarLint console (verbose mode enabled) when you open such file?

---

<div class="post-metadata">

**Author:** ![mwetzel](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@mwetzel](https://community.sonarsource.com/u/mwetzel)\
**Post date:** [April 12, 2019, 3:03pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/6 "2019-04-12T15:03:42Z")

</div>

SonarLint analysis of project tutorial1 (19 files processed)…  
File ‘src/test/java/net/serenity/tutorial/ui/SearchBox.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/model/Category.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/tasks/OpenTheApplication.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/steps/NavigatingUser.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/ui/CurrentPage.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/features/navigation/WhenBrowsingProductCategories.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/features/search/SearchByKeywordStory.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/test.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/ui/CategoryNavigationBar.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/tasks/Search.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/ui/EbayHomePage.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
File ‘src/test/java/net/serenity/tutorial/ui/GoogleSearchPage.java’ qualified as test by ‘JavaProjectConfiguratorExtension’  
Standalone mode (project not bound)  
Starting analysis with configuration:

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [April 12, 2019, 3:57pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/7 "2019-04-12T15:57:42Z")

</div>

Test files are scanned by SonarLint, but only a few rules of SonarJava are evaluated on test files:  
[https://rules.sonarsource.com/java/tag/tests](https://rules.sonarsource.com/java/tag/tests)

---

<div class="post-metadata">

**Author:** ![mwetzel](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@mwetzel](https://community.sonarsource.com/u/mwetzel)\
**Post date:** [April 12, 2019, 4:33pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/8 "2019-04-12T16:33:29Z")

</div>

And the only way to increase analysis would be to move to /src/main/java, correct?

---

<div class="post-metadata">

**Author:** ![mwetzel](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@mwetzel](https://community.sonarsource.com/u/mwetzel)\
**Post date:** [April 12, 2019, 4:39pm UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/9 "2019-04-12T16:39:33Z")

</div>

How does Java code under /src/test get classified as “tests” by Sonar. Is it based on the directory or a property that can be modified?

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [April 15, 2019, 6:57am UTC](https://community.sonarsource.com/t/eclipse-files-in-src-test-java-not-being-scanned/8719/10 "2019-04-15T06:57:13Z")

</div>

Please read the related part in the FAQ and tell me if this is not clear so that I can improve it:

> [@Frequently asked questions](https://community.sonarsource.com/t/frequently-asked-questions/7204):
>
> SonarLint FAQ Common Troubleshooting Each SonarQube for IDE has it’s own Troubleshooting page which contains information about getting your logs, what to look for if connected mode isn’t working right, and even some language-specific problem examples (when applicable). Check them out and if you’re still having trouble, reach out to us here in the community for more information! [Troubleshooting SonarQube for VS Code](https://docs.sonarsource.com/sonarqube-for-vs-code/resources/troubleshooting) (including forks of VS Code) [Troubleshooting SonarQube for IntelliJ](https://docs.sonarsource.com/sonarqube-for-intellij/resources/troubleshooting) (and other …
