I think its a good practice to name the tests according to the
functionality their are testing. Using your example, i would do 2 test
classes one per platform. Either way, if mapping per method instead it will
probably solve this issue


On Fri, Apr 5, 2013 at 9:01 AM, wenns <notifications@github.com> wrote:

> In
> sonar-cxx-plugin/src/test/java/org/sonar/plugins/cxx/xunit/CxxXunitSensorTest.java:
>
> > +    // case 2:
> > +    // the testcase file resides: in a subdirectory
> > +    // the testcase file contains: a couple of classes
> > +    // the report mentions: the class name
> > +    assertEquals(sensor.getFilePath("TestClass2"), new File(baseDir, "tests1/subdir/Test2.cc").getPath());
> > +
> > +    // case 3:
> > +    // the testcase file resides: in second directory
> > +    // the testcase file contains: the class in a namespace
> > +    // the report mentions: the class name
> > +    assertEquals(sensor.getFilePath("TestClass3"), new File(baseDir, "tests2/Test3.cc").getPath());
> > +
> > +    // case 4:
> > +    // the testcase file resides: somewhere
> > +    // the testcase file contains: the class is implemented via a header and impl. file
> > +    // the report mentions: the class name
>
> On 04/04/2013 06:01 PM, Jorge Costa wrote: In
> sonar-cxx-plugin/src/test/java/org/sonar/plugins/cxx/xunit/CxxXunitSensorTest.java:
> > + // case 2: > + // the testcase file resides: in a subdirectory > + //
> the testcase file contains: a couple of classes > + // the report mentions:
> the class name > + assertEquals(sensor.getFilePath("TestClass2"), new
> File(baseDir, "tests1/subdir/Test2.cc").getPath()); > + > + // case 3: > +
> // the testcase file resides: in second directory > + // the testcase file
> contains: the class in a namespace > + // the report mentions: the class
> name > + assertEquals(sensor.getFilePath("TestClass3"), new File(baseDir,
> "tests2/Test3.cc").getPath()); > + > + // case 4: > + // the testcase file
> resides: somewhere > + // the testcase file contains: the class is
> implemented via a header and impl. file > + // the report mentions: the
> class name The test method needs to be checked, we are checking this only
> with class name. Might be good idea to extend this to do method visitor.
> Having test methods from same class scattered over multiple files is indeed
> a problem. My suggestion to this, would be to limit the search to methods.
> Import the first file that contains the first test method.
> Yeah, something like this.
>  And flag violations in the file to any test method that is not included
> in the same file. I think is a good practice todo so.
> No, I wouldnt do this. There are valid reasons to scatter the
> implementation over a couple of files (e.g. one interface -> many [platform
> dependent] implementations). The same goes for tests, I think. In case when
> there is more than one candidate we should choose one and document our
> decision in the logfile, IMO.
> … <#13dd8c98a59d95dd_>
>  — Reply to this email directly or view it on GitHub <
> https://github.com/SonarCommunity/sonar-cxx/pull/22/files#r3657721>.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/SonarCommunity/sonar-cxx/pull/22/files#r3668456>
> .
>