# \#tests

**URL:** https://community.sonarsource.com/tag/tests/93.md

[Latest](https://community.sonarsource.com/latest.md) · [Categories](https://community.sonarsource.com/categories.md) · [Tags](https://community.sonarsource.com/tags.md)

---

## [\`typescript:S2699\` raises false positives on \`supertest\` (with reproducer)](https://community.sonarsource.com/t/typescript-s2699-raises-false-positives-on-supertest-with-reproducer/189102)

<div class="topic-metadata">

**Author:** [@JB.L](https://community.sonarsource.com/u/JB.L)\
**Replies:** 2\
**Last updated:** [October 6, 2026, 7:44am UTC](https://community.sonarsource.com/t/typescript-s2699-raises-false-positives-on-supertest-with-reproducer/189102 "2026-10-06T07:44:53Z")

</div>

Hello friends at Sonar :waving\_hand: I came across a lot of FP with typescript:S2699 on tests that rely on the supertest library. What language is this for? TypeScript (probably also JavaScript) Which rule? typesc…

---

## [Unit test code only shows Sonar rules which are specific to "Test sources"](https://community.sonarsource.com/t/unit-test-code-only-shows-sonar-rules-which-are-specific-to-test-sources/186491)

<div class="topic-metadata">

**Author:** [@Manuel.P](https://community.sonarsource.com/u/Manuel.P)\
**Replies:** 11\
**Last updated:** [August 11, 2026, 12:45pm UTC](https://community.sonarsource.com/t/unit-test-code-only-shows-sonar-rules-which-are-specific-to-test-sources/186491 "2026-08-11T12:45:14Z")

</div>

ALM used: Azure DevOps CI system used: Azure DevOps Scanner command: SonarCloudAnalyze@4 (with scannerMode: 'dotnet' in SonarCloudPrepare@4) Languages of the repository: C#, XAML, XML, JSON, YAML, SQL Only if the SonarC…

---

## [New Testing Rules for JS/TS](https://community.sonarsource.com/t/new-testing-rules-for-js-ts/186247)

<div class="topic-metadata">

**Author:** [@jean.jimbo](https://community.sonarsource.com/u/jean.jimbo)\
**Replies:** 0\
**Last updated:** [July 20, 2026, 8:28am UTC](https://community.sonarsource.com/t/new-testing-rules-for-js-ts/186247 "2026-07-20T08:28:08Z")

</div>

We’ve added eight new JavaScript and TypeScript rules to help teams write more reliable, maintainable tests and modernize utility-library usage. New rules: S8907: Replace Lodash/underscore.js methods with native APIs …

---

## [Java Test Code: 40 more rules enabled by default](https://community.sonarsource.com/t/java-test-code-40-more-rules-enabled-by-default/118406)

<div class="topic-metadata">

**Author:** [@gab](https://community.sonarsource.com/u/gab)\
**Replies:** 5\
**Last updated:** [February 27, 2026, 2:19pm UTC](https://community.sonarsource.com/t/java-test-code-40-more-rules-enabled-by-default/118406 "2026-02-27T14:19:25Z")

</div>

Hello Java devs, We want to help you write clean test code! However previously, Sonar was only using a limited set of rules on your test code, see the list here. Sonar relies on your configuration to determine which f…

---

## [javascript:S2486 should not be applied to unit tests](https://community.sonarsource.com/t/javascript-s2486-should-not-be-applied-to-unit-tests/172444)

<div class="topic-metadata">

**Author:** [@ArianeBouchardConfor](https://community.sonarsource.com/u/ArianeBouchardConfor)\
**Replies:** 8\
**Last updated:** [January 21, 2026, 7:35pm UTC](https://community.sonarsource.com/t/javascript-s2486-should-not-be-applied-to-unit-tests/172444 "2026-01-21T19:35:31Z")

</div>

This rule: Handle this exception or don’t catch it at all. Exceptions should not be ignoredjavascript:S2486  should not be applied to unit tests by default. Ignoring errors in tests is a perfectly normal thing to do…

---

## [Allow enabling sonar rules for test sources](https://community.sonarsource.com/t/allow-enabling-sonar-rules-for-test-sources/3379)

<div class="topic-metadata">

**Author:** [@reitzmichnicht](https://community.sonarsource.com/u/reitzmichnicht)\
**Replies:** 19\
**Last updated:** [August 27, 2025, 8:51am UTC](https://community.sonarsource.com/t/allow-enabling-sonar-rules-for-test-sources/3379 "2025-08-27T08:51:10Z")

</div>

Please create a configuration option that allows to apply all sonar rules that are evaluated for src/main/java also to be applied to any code in src/test/java I think it is a common coding guideline that test code has t…

---

## [Is it possible to upload test execution and coverage data separately from running sonar-scanner analysis?](https://community.sonarsource.com/t/is-it-possible-to-upload-test-execution-and-coverage-data-separately-from-running-sonar-scanner-analysis/14609)

<div class="topic-metadata">

**Author:** [@jrnail23](https://community.sonarsource.com/u/jrnail23)\
**Replies:** 17\
**Last updated:** [July 21, 2025, 10:25pm UTC](https://community.sonarsource.com/t/is-it-possible-to-upload-test-execution-and-coverage-data-separately-from-running-sonar-scanner-analysis/14609 "2025-07-21T22:25:46Z")

</div>

I’m migrating from Code Climate to SonarCloud, and in my continuous delivery pipeline (CircleCI), I’m currently running my code analysis job in parallel with my tests job (in separate containers). I’d like to be able to…

---

## [Thousands of unwanted issues in test code after upgrading to SonarQube 10](https://community.sonarsource.com/t/thousands-of-unwanted-issues-in-test-code-after-upgrading-to-sonarqube-10/143985)

<div class="topic-metadata">

**Author:** [@Thomas\_Mauch](https://community.sonarsource.com/u/Thomas_Mauch)\
**Replies:** 3\
**Last updated:** [July 9, 2025, 12:52pm UTC](https://community.sonarsource.com/t/thousands-of-unwanted-issues-in-test-code-after-upgrading-to-sonarqube-10/143985 "2025-07-09T12:52:16Z")

</div>

Hi I’ve seen the announcement and various questions whether the analysis scope could be controlled per rule, but without answers, e.g. Is there still no way to control for me as user whether applying a rule make s…

---

## [Duplicated lines of code in tests](https://community.sonarsource.com/t/duplicated-lines-of-code-in-tests/137785)

<div class="topic-metadata">

**Author:** [@Matthew](https://community.sonarsource.com/u/Matthew)\
**Replies:** 8\
**Last updated:** [March 28, 2025, 11:41am UTC](https://community.sonarsource.com/t/duplicated-lines-of-code-in-tests/137785 "2025-03-28T11:41:16Z")

</div>

We are using the default “Sonar Way” quality gate however are coming across problems with the duplicated lines metric. In our main code base this appears to work fine but it is very problematic in our tests resulting in …

---

## [Exclude complexity rule for Go test files](https://community.sonarsource.com/t/exclude-complexity-rule-for-go-test-files/136472)

<div class="topic-metadata">

**Author:** [@flyrlabs-rch](https://community.sonarsource.com/u/flyrlabs-rch)\
**Replies:** 1\
**Last updated:** [March 10, 2025, 10:19am UTC](https://community.sonarsource.com/t/exclude-complexity-rule-for-go-test-files/136472 "2025-03-10T10:19:57Z")

</div>

Go test files are next to their targets: /foo/action.go and /food/action\_test.go I want the test file to count for coverage (obviously), but I don’t want the “over-complex” or “too-many parameters” violations for the te…

---

## [False Positive java:S2699 with rest assured https://rest-assured.io/](https://community.sonarsource.com/t/false-positive-java-s2699-with-rest-assured-https-rest-assured-io/63839)

<div class="topic-metadata">

**Author:** [@ma3](https://community.sonarsource.com/u/ma3)\
**Replies:** 4\
**Last updated:** [December 18, 2024, 1:24pm UTC](https://community.sonarsource.com/t/false-positive-java-s2699-with-rest-assured-https-rest-assured-io/63839 "2024-12-18T13:24:04Z")

</div>

Operating system: Windows 10 IDE name and flavor/env: Eclipse 4.23.0 SonarLint plugin version: SonarLint for Eclipse 7.4.0.46482 Is connected mode used: No Framework: Rest Assured 4.4.0 SonarLint supports rest ass…

---

## [Java Test Code: 24 more rules enabled by default](https://community.sonarsource.com/t/java-test-code-24-more-rules-enabled-by-default/131653)

<div class="topic-metadata">

**Author:** [@jean.jimbo](https://community.sonarsource.com/u/jean.jimbo)\
**Replies:** 0\
**Last updated:** [December 5, 2024, 11:00am UTC](https://community.sonarsource.com/t/java-test-code-24-more-rules-enabled-by-default/131653 "2024-12-05T11:00:21Z")

</div>

Hello Java developers, We’ve heard from you that you want your test code to be as high-quality as your main code. We previously enabled 40 rules in Java test code, and now we have selected and added 24 more rules releva…

---

## [Automatic Analysis and Test reports](https://community.sonarsource.com/t/automatic-analysis-and-test-reports/129035)

<div class="topic-metadata">

**Author:** [@p10tyr](https://community.sonarsource.com/u/p10tyr)\
**Replies:** 3\
**Last updated:** [October 29, 2024, 12:05pm UTC](https://community.sonarsource.com/t/automatic-analysis-and-test-reports/129035 "2024-10-29T12:05:40Z")

</div>

Template for a good new topic, formatted with Markdown: ALM used - GitHub CI system used - Automatic Analysis with GitHub Scanner command used - none Languages of the repository - C#, PHP, TS/JS (as a start?) Only if t…

---

## [Sonarqube 10.7, scanning of test classes has changed !?](https://community.sonarsource.com/t/sonarqube-10-7-scanning-of-test-classes-has-changed/128488)

<div class="topic-metadata">

**Author:** [@anon40266202](https://community.sonarsource.com/u/anon40266202)\
**Replies:** 3\
**Last updated:** [October 24, 2024, 12:16pm UTC](https://community.sonarsource.com/t/sonarqube-10-7-scanning-of-test-classes-has-changed/128488 "2024-10-24T12:16:53Z")

</div>

After upgrading from Sonarqube 10.5.1 to Sonarqube 10.7, the scans of some projects suddenly raised a lot of issues with scope test. While I could not find any differences between 10.5 and 10.7 in the documentation Nar…

---

## [Spock tests are not recognized](https://community.sonarsource.com/t/spock-tests-are-not-recognized/127006)

<div class="topic-metadata">

**Author:** [@Vampire](https://community.sonarsource.com/u/Vampire)\
**Replies:** 7\
**Last updated:** [October 9, 2024, 1:23pm UTC](https://community.sonarsource.com/t/spock-tests-are-not-recognized/127006 "2024-10-09T13:23:09Z")

</div>

In SonarQube 9.9 Spock tests are not recognized. At the point where the graph ends, the JUnit 4 tests were replaced by Spock tests: It would be nice if SonarQube would also recognize Spock tests.

---

## [Sonar is not excluding test files from analysis](https://community.sonarsource.com/t/sonar-is-not-excluding-test-files-from-analysis/124704)

<div class="topic-metadata">

**Author:** [@Karthik\_Bhat](https://community.sonarsource.com/u/Karthik_Bhat)\
**Replies:** 3\
**Last updated:** [September 10, 2024, 1:03pm UTC](https://community.sonarsource.com/t/sonar-is-not-excluding-test-files-from-analysis/124704 "2024-09-10T13:03:38Z")

</div>

Hi, We are using Developer Editionv9.9.5 (build 90363) We are scanning go projects from jenkins. We are facing an issue with respect to ignoring the test files from analysis. This is the command we are using while sc…

---

## [Test inclusions when Sonar.test is set to null](https://community.sonarsource.com/t/test-inclusions-when-sonar-test-is-set-to-null/112410)

<div class="topic-metadata">

**Author:** [@Yadhu](https://community.sonarsource.com/u/Yadhu)\
**Replies:** 3\
**Last updated:** [August 5, 2024, 9:37am UTC](https://community.sonarsource.com/t/test-inclusions-when-sonar-test-is-set-to-null/112410 "2024-08-05T09:37:04Z")

</div>

The Sonar.test and src are set as null in the properties file, which I don’t have access to. If I set test.inclusions on the UI (wildcard on the test class name), will it rightly pick up the test file and apply test spec…

---

## [S1130 triggers on test methods](https://community.sonarsource.com/t/s1130-triggers-on-test-methods/118328)

<div class="topic-metadata">

**Author:** [@alec](https://community.sonarsource.com/u/alec)\
**Replies:** 1\
**Last updated:** [July 4, 2024, 12:15pm UTC](https://community.sonarsource.com/t/s1130-triggers-on-test-methods/118328 "2024-07-04T12:15:02Z")

</div>

Hi, I just upgraded to SonarQube 10.6 and I’m seeing the rule S1130 being reported on most of my test methods when no Exception is thrown. I perfectly understand the rule for the main code but I think this is a really …

---

## [Code coverage not reflecting on soanrqube dashboard for dotnet project](https://community.sonarsource.com/t/code-coverage-not-reflecting-on-soanrqube-dashboard-for-dotnet-project/118084)

<div class="topic-metadata">

**Author:** [@roshan](https://community.sonarsource.com/u/roshan)\
**Replies:** 1\
**Last updated:** [June 28, 2024, 12:44pm UTC](https://community.sonarsource.com/t/code-coverage-not-reflecting-on-soanrqube-dashboard-for-dotnet-project/118084 "2024-06-28T12:44:20Z")

</div>

In my case the coverage report is not uploaded to the sonarqube dashboard. I have checked the report and is not empty. In the log I am getting this info: INFO: Parsing the Visual Studio coverage XML report /home/runne…

---

## [Ctest test coverage on Sonarcloud](https://community.sonarsource.com/t/ctest-test-coverage-on-sonarcloud/117878)

<div class="topic-metadata">

**Author:** [@tech-pragmatic](https://community.sonarsource.com/u/tech-pragmatic)\
**Replies:** 1\
**Last updated:** [June 26, 2024, 12:02pm UTC](https://community.sonarsource.com/t/ctest-test-coverage-on-sonarcloud/117878 "2024-06-26T12:02:36Z")

</div>

I have a C++ repo for which I am able to get the sonar report on Sonarcloud. Development team used CTest (CMake test - Testing With CMake and CTest — Mastering CMake) to incorporate unit tests. I do have ctest results xm…

---

## [New tests for existing code not picked up by sonar](https://community.sonarsource.com/t/new-tests-for-existing-code-not-picked-up-by-sonar/117106)

<div class="topic-metadata">

**Author:** [@Rohith\_Prakash](https://community.sonarsource.com/u/Rohith_Prakash)\
**Replies:** 1\
**Last updated:** [June 13, 2024, 12:14pm UTC](https://community.sonarsource.com/t/new-tests-for-existing-code-not-picked-up-by-sonar/117106 "2024-06-13T12:14:53Z")

</div>

Hi, so I had written some junit test for uncovered code and raised a PR on github with just the test files. It was successfully merged but it’s not reflected in the test files shown in sonar, and the coverage is not upda…

---

## [Scanner can't find files that were properly indexed?](https://community.sonarsource.com/t/scanner-cant-find-files-that-were-properly-indexed/116294)

<div class="topic-metadata">

**Author:** [@rafaveguim](https://community.sonarsource.com/u/rafaveguim)\
**Replies:** 1\
**Last updated:** [June 6, 2024, 12:00pm UTC](https://community.sonarsource.com/t/scanner-cant-find-files-that-were-properly-indexed/116294 "2024-06-06T12:00:55Z")

</div>

Test files are found and indexed by scanner. Later on, scanner tries to find these tests, as they are referenced in the xunit report, but fails. The lookup key seems to match. What could possibly be the cause of this fa…

---

## [Help ignoring test files from coverage](https://community.sonarsource.com/t/help-ignoring-test-files-from-coverage/115803)

<div class="topic-metadata">

**Author:** [@maffin\_io](https://community.sonarsource.com/u/maffin_io)\
**Replies:** 2\
**Last updated:** [May 24, 2024, 4:44am UTC](https://community.sonarsource.com/t/help-ignoring-test-files-from-coverage/115803 "2024-05-24T04:44:52Z")

</div>

Hi! been trying for couple of days to ignore the test files for my coverage metric but can’t figure it out. I’ve tried the following: Add sonar.coverage.exclusions Check coverage by argaen · Pull Request #895 · maffin-…

---

## [C++ test sources - scanning for quality but ignoring for coverage](https://community.sonarsource.com/t/c-test-sources-scanning-for-quality-but-ignoring-for-coverage/112151)

<div class="topic-metadata">

**Author:** [@Ivan\_Ribakov](https://community.sonarsource.com/u/Ivan_Ribakov)\
**Replies:** 2\
**Last updated:** [March 28, 2024, 12:30pm UTC](https://community.sonarsource.com/t/c-test-sources-scanning-for-quality-but-ignoring-for-coverage/112151 "2024-03-28T12:30:07Z")

</div>

I have a C++ project that is configured as follows: sonar.sources=src sonar.exclusions=\*\*/\*.json, \*\*/\*.py, \*\*/\*.js, \*\*/\*.xml, \*\*/\*.html src/ folder internally contains source code for several libraries and their unit t…

---

## [SonarCloud doesn't show Groovy tests](https://community.sonarsource.com/t/sonarcloud-doesnt-show-groovy-tests/24289)

<div class="topic-metadata">

**Author:** [@Vadim\_Prudnikov](https://community.sonarsource.com/u/Vadim_Prudnikov)\
**Replies:** 4\
**Last updated:** [March 20, 2024, 10:40pm UTC](https://community.sonarsource.com/t/sonarcloud-doesnt-show-groovy-tests/24289 "2024-03-20T22:40:09Z")

</div>

ALM used: Azure DevOps CI system used: Azure DevOps Languages of the repository: Java Error observed: SonarCloud shows neither a proper number of Groovy tests nor Groovy test files. Steps to reproduce This…

---

## [SonarCloud no longer returns (many) test-related measures from Web API](https://community.sonarsource.com/t/sonarcloud-no-longer-returns-many-test-related-measures-from-web-api/109375)

<div class="topic-metadata">

**Author:** [@znerd](https://community.sonarsource.com/u/znerd)\
**Replies:** 3\
**Last updated:** [February 19, 2024, 4:24pm UTC](https://community.sonarsource.com/t/sonarcloud-no-longer-returns-many-test-related-measures-from-web-api/109375 "2024-02-19T16:24:45Z")

</div>

Since a couple of weeks (at least) it appears that the SonarCloud “GET measures” API no longer returns several test-related measures, even though the metrics are still supported according to the “GET metrics” API. Steps…

---

## [Vitest and \`describe.concurrent\` - Tests should include assertions](https://community.sonarsource.com/t/vitest-and-describe-concurrent-tests-should-include-assertions/107121)

<div class="topic-metadata">

**Author:** [@ValentinGurkov](https://community.sonarsource.com/u/ValentinGurkov)\
**Replies:** 1\
**Last updated:** [January 17, 2024, 3:07pm UTC](https://community.sonarsource.com/t/vitest-and-describe-concurrent-tests-should-include-assertions/107121 "2024-01-17T15:07:26Z")

</div>

Hello, Has anyone faced a similar issue? Concurrent vitest tests via describe.concurrent are flagged by SonarCloud for missing assertions. The tests have assertions, though the expect handler is passed through the loc…

---

## [Import the newman test data and generate the code coverage report](https://community.sonarsource.com/t/import-the-newman-test-data-and-generate-the-code-coverage-report/104999)

<div class="topic-metadata">

**Author:** [@BandaruMouni](https://community.sonarsource.com/u/BandaruMouni)\
**Replies:** 1\
**Last updated:** [November 27, 2023, 7:07pm UTC](https://community.sonarsource.com/t/import-the-newman-test-data-and-generate-the-code-coverage-report/104999 "2023-11-27T19:07:39Z")

</div>

Is there any way to import the newman test data and generate the code coverage report

---

## [Test File Exclusions not working](https://community.sonarsource.com/t/test-file-exclusions-not-working/102693)

<div class="topic-metadata">

**Author:** [@AEfe](https://community.sonarsource.com/u/AEfe)\
**Replies:** 2\
**Last updated:** [October 17, 2023, 12:26pm UTC](https://community.sonarsource.com/t/test-file-exclusions-not-working/102693 "2023-10-17T12:26:11Z")

</div>

Hello, We have the Sonarqube Community Edition 8.9.8. We are trying to exclude some test files using the web interface, but it is not working at all. The test files are located in folders called test in different direc…

---

## [How to properly test a plugin](https://community.sonarsource.com/t/how-to-properly-test-a-plugin/102659)

<div class="topic-metadata">

**Author:** [@a-zitzewitz](https://community.sonarsource.com/u/a-zitzewitz)\
**Replies:** 2\
**Last updated:** [October 16, 2023, 7:04pm UTC](https://community.sonarsource.com/t/how-to-properly-test-a-plugin/102659 "2023-10-16T19:04:34Z")

</div>

I am working on adding C++ support to the Sonargraph-Integration plugin. While doing it I also upgrded the plugin API and test harness to 9.3.0.51899. Now the unit tests do not compile anymore since classes like SensorCo…

[Next page](https://community.sonarsource.com/tag/tests/93.md?match_all_tags=true&page=1&tags%5B%5D=tests)
