Corda 无法使用gradle integrationTest从CLI运行基于驱动程序的测试
我已经在CorDapp项目的src/integrationTest/kotlin/com.example.integrationTest目录下定义了基于驱动程序的测试:Corda 无法使用gradle integrationTest从CLI运行基于驱动程序的测试,corda,Corda,我已经在CorDapp项目的src/integrationTest/kotlin/com.example.integrationTest目录下定义了基于驱动程序的测试: class IntegrationTest { private val nodeAName = CordaX500Name("NodeA", "", "GB") private val nodeBName = CordaX500Name("NodeB", "", "US") @Test fun `run driver test
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测试将通过适当的测试报告/日志按预期工作。为了确保集成测试实际运行,您需要使用clean参数:
./gradlew clean integrationTest
该命令的输出并不总是明确哪些测试已经运行。您可以使用-info标志使其显示更多信息:
./gradlew clean integrationTest --info