Skip to content

Test source cannot be moved from default location #614

@efirestone

Description

@efirestone

If you try to move your Java test files out of src/test/java then running testJ2objc will fail because the packages on the tested class names will be wrong.

For example, if I move my test class from the normal location of src/test/java/my/package/Test.java to something like tests/my/package/Test.java and set the source set to look at that directory (sourceSets.test.java.srcDirs = [file('tests')]), the resulting testJ2ObjC command that gets run looks something like testJ2Objc tests.my.package.Test. Note that the tests directory is considered part of the package name.

The issue here looks to be that the test package is determined by:

  1. Taking the path relative to the Gradle project root
  2. Removing the (hardcoded) standard directory

This means that non-standard directories are not handled. In my mind the expected behavior would be that the package is determined from the root of the test source directory (tests/ in my example). This would work for both the existing case since the default test source directory is src/tests/java/, as well as for custom directories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions