Skip to content

Add more location information to Test messagesΒ #674

Open
@Arthurm1

Description

Describe the use-case for this feature

Currently BuildTargetTest leads to feedback messages of TaskStartParams containing a TestStart and TaskFinishParams containing a TestFinish.

Both TestStart and TestFinish contain Location which points to a position in a file.

For JUnit tests (JVM languages) there seems to be no feedback from the library about file location of the test. Instead there is suite, class, method. But there is no way of communicating this info to the BSP client.

There is also no option in TestFinish to passback a stacktrace which is helpful to diagnose test failures.

What do you propose

I'd like to propose a JVMTestStartType that can be added to TestStart#data and JVMTestFinishType to be added to TestFinish#data. TestStart currently doesn't have a dataKind or data member and would need to be added.

Both JVMTestStartType and JVMTestFinishType would contain suite, class, method and JVMTestFinishType would also contain stacktrace.

I see Bazel already has the JUnitStyleTestCaseData bespoke type.

I've called the types JVMTestXXXType but I'm not sure whether this as applicable to all test frameworks or all JVM test frameworks or a subset of JVM test frameworks.

Here's some JVM examples...
Junit seems to pass back method, package, class, file (with optional position).
TestNG seems to pass back class, method, method parameters.
Gradle passes back suite, class, method for JUnit and TestNG
SBT test Interface appears to pass back the FQN of suite/method

The idea of parameterized tests is a bit hazy. The file location, suite, class, method should be the same regardless of the parameters used to run the test but I guess it's possible there are overloaded methods of the same name with different parameter types in the file which would mean the BSP client would not know which method was run from the above new data structures. I feel it's unlikely but 🀷.

I've checked to make sure there isn't already a way to support this in the current protocol

  • I've checked the existing protocol and there isn't a way to do this currently

Maintainer approval (This is for the maintainers)

  • Jetbrains
  • Metals
  • Scala Center

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