When using `org.gradle.testfixtures.ProjectBuilder...
# community-support
a
When using
org.gradle.testfixtures.ProjectBuilder
is it possible to capture the logs?
addStandardOutputListener {}
doesn't seem to work
Copy code
test("warning") {
    val logs = mutableListOf<String>()

    ProjectBuilder.builder().build().run {
        logging.addStandardOutputListener {
            logs.add(it.toString())
        }
        logging.addStandardErrorListener {
            logs.add(it.toString())
        }

        project.plugins.apply(type = FooPlugin::class)
    }

    logs.shouldContain("some warning...")
}
v
iirc if you want to test that your plugin does or does not do certain output you should use a testkit test instead of project builder. project builder is more for unit-tests.