I created a custom Gradle task for running from terminal in a separate file named feature.gradle, based on this answer and Gradle docs
task("withFeature", JavaExec::class) {
    group = "myCustomTasks"
    main = "com.example.calculator"
    classpath = sourceSets["main"].runtimeClasspath
    args(feature)
}
and register task in Gradle
tasks.register("withFeature")
feature is a property (string) that I want to pass into test (for now it's unit test, but later it would be android UI test)
    @Test
    fun getPackArgs() {
        val property = System.getProperty("feature")
        Assert.assertEquals("default", property)
    }
But when i write next command, where -Pfeature=default is what i wants to pass into code
./gradlew test withFeature -Pfeature=default
test fails, and System.getProperty("feature") is null :
expected:<default> but was:<null>
Expected :default
Actual   :null
Can anyone elaborate what i am doing wrong while running task with argument, which should pass into test package ? Thanks in advance