Невозможно запустить тесты на основе драйвера из CLI с помощью gradle интеграцииTest - PullRequest
0 голосов
/ 16 ноября 2018

Я определил свои тесты на основе драйвера в каталоге src /grationTest / kotlin / com.example.IntegationTest моего проекта CorDapp:

class IntegrationTest {
private val nodeAName = CordaX500Name("NodeA", "", "GB")
private val nodeBName = CordaX500Name("NodeB", "", "US")

@Test
fun `run driver test`() {
    driver(DriverParameters(isDebug = true, startNodesInProcess = true)) {
        // This starts three nodes simultaneously with startNode, which returns a future that completes when the node
        // has completed startup. Then these are all resolved with getOrThrow which returns the NodeHandle list.
        val (nodeAHandle, nodeBHandle) = listOf(
                startNode(providedName = nodeAName),
                startNode(providedName = nodeBName)
        ).map { it.getOrThrow() }

        // This test will call via the RPC proxy to find a party of another node to verify that the nodes have
        // started and can communicate. This is a very basic test, in practice tests would be starting flows,
        // and verifying the states in the vault and other important metrics to ensure that your CorDapp is working
        // as intended.
        Assert.assertEquals(nodeAHandle.rpc.wellKnownPartyFromX500Name(nodeBName)!!.name, nodeBName)
        Assert.assertEquals(nodeBHandle.rpc.wellKnownPartyFromX500Name(nodeAName)!!.name, nodeAName)
    }
}
}

Если мы попытаемся выполнить тест, используя команду gradle integrationTest из командыстрока, как мы можем гарантировать, что IntegrationTest был успешно выполнен?

При попытке с Inteliij IDE, тест Junit работает, как и ожидалось, с соответствующими отчетами / журналами испытаний.

1 Ответ

0 голосов
/ 16 ноября 2018

Чтобы убедиться, что интеграционные тесты действительно выполняются, вам необходимо использовать аргумент clean:

./gradlew clean integrationTest

Вывод этой команды не всегда дает понять, какие тесты были выполнены.Вы можете заставить его отображать больше информации, используя флаг --info:

./gradlew clean integrationTest --info
...