我试图在集成测试中使用Localstack来模拟AWS。作者指示我们将Localstack与我们的Java测试集成如下:
import cloud.localstack.LocalstackTestRunner;
import cloud.localstack.TestUtils;
@RunWith(LocalstackTestRunner.class)
public class MyCloudAppTest {
但是,我的黄瓜测试如下:
@RunWith(Cucumber.class)
@CucumberOptions( monochrome = true,
features = "src/test/resources/",
glue = "com/mydomain/services" )
public class MyFeatureTest {
}
由于我不能有两个RunWith批注,因此有人可以建议同时使用Localstack和Cucuming进行测试吗?
谢谢您的帮助。
答案 0 :(得分:0)
我接受了@Grasshopper的建议,并使其工作如下:
@RunWith(LocalstackDockerTestRunner.class)
@LocalstackDockerProperties(services = {"dynamodb"})
public class MyFeatureTest {
@Test
public void test() throws IOException {
String [] argv = new String[]{ "-g","com/mydomain/services","./src/test/resources/myFeature.feature"};
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
cucumber.api.cli.Main.run(argv, contextClassLoader);
}
}