Hi everyone! I'm trying to create a custom task to run specific tests. (For a lot of reasons that I'...
j
Hi everyone! I'm trying to create a custom task to run specific tests. (For a lot of reasons that I'm ashamed to disclaim, I cannot use
gradle test
) On top of that, I'd like to also run an additional command that runs screenshot tests. I'm not sure if this is possible... But I've been struggling with it for the last couple of days. I'll leave a couple of examples on the thread for a better understanding.
Current task:
Copy code
tasks.register("testAll") {
        group = Group
        description = "Run all tests except app and proposition"

        dependsOn(
            "module1:test",
            "module2:test",
            "module3:test",
        )
    }
I'd like to also run
./gradlew verifyRoborazziDebug
at the same time of the other tests
v
Can you elaborate on what you actual question / problem is?
j
Basically... I want to create a custom task that runs multiple gradle commands. A bunch of module tests and then the one above. From what I've been investigating there is not an easy way to do this... Just wanted to confirm 😓
v
What is wrong or not working or not easy with your
testAll
?
j
Doing something like:
Copy code
dependsOn(
            "module1:test",
            "module2:test",
            "module3:test",
            "verifyRoborazziDebug",
        )
Gives this error:
Copy code
Could not determine the dependencies of task ':testAll'.
> Task with path 'verifyRoborazziDebug' not found in root project 'GstAppsAndroid'.
So... I was wondering if there was another way of running tasks in parallel
v
If the task does not exist, you cannot depend on it. If
./gradlew verifyRoborazziDebug
works, but
dependsOn("verifyRoborazziDebug")
does not work, the difference is, that the former executes
verifyRoborazziDebug
in any project that has such a task, while the latter only refers to that task in the current project. There is no way to express the former in a
dependsOn
, but you would need to list out the tasks with the full path.
Besides that, "in parallel" the tasks are only executed when you use
--parallel
and they are in different projects, or when you use configuration cache with which all tasks can run in parallel, even tasks from the same project as long as there is no dependency or ordering constraint.
j
Got it! Running
./gradlew verifyRoborazziDebug
indeed works and now I understand why. Thank you for your explanation. I learned something new and I see that I need to approach this in a different way.
👌 1
v
Using
dependsOn("verifyRoborazziDebug")
would be like
./gradlew :verifyRoborazziDebug
which would also fail.
thank you color 1