Quantcast

No duplications for tests?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

No duplications for tests?

Sheldon
When I run sonar-runner and review the results I see duplication for
files that are only in the source folder, but not in the test folder.  I
know there are some small duplicate blocks of code in my tests, but they
are not listed when I drill in to the duplicates from the Sonar
Dashboard.  My test files are included in the analysis, and I can
confirm this when I search for the class names in the Sonar Dashboard.  
Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder,
and remove the 'tests' setting, then I see the duplicate code for the
tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in
the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No duplications for tests?

Evgeny Mandrikov
Hi,

Currently Sonar doesn't perform CPD for tests.

On Thu, Aug 9, 2012 at 8:05 AM, sporcina <[hidden email]> wrote:
When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder.  I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard.  My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard.  Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No duplications for tests?

Alexandre Victoor-2
Hello
I look forward to get this feature in sonar :)
Is there already a jira ticket about it ?
Regards

Alex

On Thu, Aug 9, 2012 at 7:10 AM, Evgeny Mandrikov <[hidden email]> wrote:
Hi,

Currently Sonar doesn't perform CPD for tests.


On Thu, Aug 9, 2012 at 8:05 AM, sporcina <[hidden email]> wrote:
When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder.  I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard.  My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard.  Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No duplications for tests?

Evgeny Mandrikov
Hi Alex,

Probably there is no such ticket. I think that you can create one, but what do you expect from such feature? I have strong feeling that if we will apply current CPD algorithm on tests, we will receive a tons of false-positives.


On Thu, Aug 9, 2012 at 12:04 PM, Alexandre Victoor <[hidden email]> wrote:
Hello
I look forward to get this feature in sonar :)
Is there already a jira ticket about it ?
Regards

Alex


On Thu, Aug 9, 2012 at 7:10 AM, Evgeny Mandrikov <[hidden email]> wrote:
Hi,

Currently Sonar doesn't perform CPD for tests.


On Thu, Aug 9, 2012 at 8:05 AM, sporcina <[hidden email]> wrote:
When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder.  I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard.  My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard.  Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_




--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No duplications for tests?

Patroklos Papapetrou
Hi Evgeny and Alex

Several times in our project we've been in the position where we found the same piece of code ( mostly initiliazing some classes and dummy data) in Unit tests. Maintenance of unit tests was somehow too hard and error-prone for us because we had to modify the same code in multiple unit test classes. 
So, to the point, if we could know duplicate lines in unit tests we could re-factor them as soon as possible. 
I believe such kind of a metric is really useful but it shouldn't create any violations. It should remain to the engineer decision to evaluate the importance of these code repetitions.
+1 for the proposal of Alex.
Regards
Patroklos

2012/8/9 Evgeny Mandrikov <[hidden email]>
Hi Alex,

Probably there is no such ticket. I think that you can create one, but what do you expect from such feature? I have strong feeling that if we will apply current CPD algorithm on tests, we will receive a tons of false-positives.


On Thu, Aug 9, 2012 at 12:04 PM, Alexandre Victoor <[hidden email]> wrote:
Hello
I look forward to get this feature in sonar :)
Is there already a jira ticket about it ?
Regards

Alex


On Thu, Aug 9, 2012 at 7:10 AM, Evgeny Mandrikov <[hidden email]> wrote:
Hi,

Currently Sonar doesn't perform CPD for tests.


On Thu, Aug 9, 2012 at 8:05 AM, sporcina <[hidden email]> wrote:
When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder.  I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard.  My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard.  Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_




--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No duplications for tests?

Sheldon
In reply to this post by Evgeny Mandrikov
Thank-you.

On 12-08-08 11:10 PM, Evgeny Mandrikov wrote:
Hi,

Currently Sonar doesn't perform CPD for tests.

On Thu, Aug 9, 2012 at 8:05 AM, sporcina <[hidden email]> wrote:
When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder.  I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard.  My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard.  Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No duplications for tests?

Sheldon
In reply to this post by Patroklos Papapetrou
Agree with the previous comments that this would be a useful feature.  Test code can also degrade like application code.  It needs to be shepherded over time.  Applying the metrics like CPD to test could would yield value IMHO.  I've created a new JIRA enhancement request for this issue:  http://jira.codehaus.org/browse/SONAR-3733.


On 12-08-09 12:19 AM, Papapetrou P.Patroklos wrote:
Hi Evgeny and Alex

Several times in our project we've been in the position where we found the same piece of code ( mostly initiliazing some classes and dummy data) in Unit tests. Maintenance of unit tests was somehow too hard and error-prone for us because we had to modify the same code in multiple unit test classes. 
So, to the point, if we could know duplicate lines in unit tests we could re-factor them as soon as possible. 
I believe such kind of a metric is really useful but it shouldn't create any violations. It should remain to the engineer decision to evaluate the importance of these code repetitions.
+1 for the proposal of Alex.
Regards
Patroklos

2012/8/9 Evgeny Mandrikov <[hidden email]>
Hi Alex,

Probably there is no such ticket. I think that you can create one, but what do you expect from such feature? I have strong feeling that if we will apply current CPD algorithm on tests, we will receive a tons of false-positives.


On Thu, Aug 9, 2012 at 12:04 PM, Alexandre Victoor <[hidden email]> wrote:
Hello
I look forward to get this feature in sonar :)
Is there already a jira ticket about it ?
Regards

Alex


On Thu, Aug 9, 2012 at 7:10 AM, Evgeny Mandrikov <[hidden email]> wrote:
Hi,

Currently Sonar doesn't perform CPD for tests.


On Thu, Aug 9, 2012 at 8:05 AM, sporcina <[hidden email]> wrote:
When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder.  I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard.  My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard.  Here is my configuration for the folders in sonar-project.properties:

sources=app/src/main/java
tests=acceptance-tests/src/test/java

If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

# sources=app/src/main/java
sources=acceptance-tests/src/test/java
# tests=acceptance-tests/src/test/java


Am I missing a configuration option in Sonar to look for duplicates in the test folder?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_




--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_


Loading...