What is the best way that run test codes on fleet?...
# fleet
u
What is the best way that run test codes on fleet? Fleet does not support junit, kotest plugin until now…
h
I wonder about the same thing: Is it possible to create a run configuration for a file? e.g. right-click a kotest spec, select my custom test runner -> which would run
gradle test --tests ${filename.replace(".kt", "")}
I figured that something like this works:
Copy code
{
    "configurations": [
      {
        "type": "gradle",
        "name": "Run Gradle test",
        "tasks": [ "test" ],
        "args": [ "--tests", "$FILE_NAME_NO_EXT$"],
        "workingDir": "$PROJECT_DIR$",
      },
    ]
}
I found the env variables at https://www.jetbrains.com/help/fleet/built-in-macros.html.
πŸ‘€ 1
u
@henrik is that work? i wrote run.json file under .fleet dir and added snippet what you wrote abobe
message has been deleted
h
that should work I think
it will run gradle test on the last file you have/had open in fleet
u
ummm…
h
oops, had a typo in args. need to split it up into an array (see edited above)
u
i did! thank you for your help Henrik!!
h
you're welcome :)
πŸ™Œ 1
u
image history for someone who need help. the run.json file should be located under .fleet dir
message has been deleted
h
This doesn't work for multiprojects, though. There aren't any macros to specify the subproject dir, so I have to use a custom script for that:
Copy code
{
            "type": "command",
            "name": "Gradle test",
            "program": "$PROJECT_DIR$/tools/bin/gr",
            "args": [ "test --tests $FILE_NAME_NO_EXT$"],
            "workingDir": "$FILE_DIR$",
        },
πŸ‘€ 1
(the
gr
scripts figures out which project the test is in and runs
gradle -p subProjectDir ...
)
(but this way I don't get the nice test view in fleet, only console)
u
ah my project is single module project.