无法通过 ThucydidesParameterizedRunner 从 CSV 读取测试数据
Unable to read the test data from CSV via ThucydidesParameterizedRunner
我正在尝试打印我在 CSV 文件中输入的值。当 运行 下面的一组代码通过 Junit 并出现错误时。
有人可以帮我解决这个错误并成功打印值
@RunWith(ThucydidesParameterizedRunner.class)
@UseTestDataFrom(value="test-data/simple-data.csv", separator=';')
public class SampleCSVDataDrivenScenario {
private String name;
private String age;
private String address;
public SampleCSVDataDrivenScenario() {
}
@Qualifier
public String getQualifier() {
return name;
}
@Test
public void data_driven() {
System.out.println(getName() + "/" + getAge());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
请在下面找到完整的错误日志
java.lang.NoSuchMethodError:
org.junit.runners.model.FrameworkMethod.getDeclaringClass()Ljava/lang/Class;
at net.serenitybdd.junit.runners.SerenityRunner.runChild(SerenityRunner.java:421)
at net.serenitybdd.junit.runners.SerenityRunner.runChild(SerenityRunner.java:55)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:252)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at net.serenitybdd.junit.runners.SerenityParameterizedRunner.run(SerenityParameterizedRunner.java:206)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
这就是我的 CSV 文件的样子
NoSuchMethodError 通常表示存在依赖冲突。您可能 运行 使用不兼容版本的 JUnit 进行测试 - 确保您使用的 JUnit 版本与您正在使用的 Serenity 版本兼容(Serenity 已经使用 JUnit 4.12 构建了一段时间)。
我正在尝试打印我在 CSV 文件中输入的值。当 运行 下面的一组代码通过 Junit 并出现错误时。 有人可以帮我解决这个错误并成功打印值
@RunWith(ThucydidesParameterizedRunner.class)
@UseTestDataFrom(value="test-data/simple-data.csv", separator=';')
public class SampleCSVDataDrivenScenario {
private String name;
private String age;
private String address;
public SampleCSVDataDrivenScenario() {
}
@Qualifier
public String getQualifier() {
return name;
}
@Test
public void data_driven() {
System.out.println(getName() + "/" + getAge());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
请在下面找到完整的错误日志
java.lang.NoSuchMethodError:
org.junit.runners.model.FrameworkMethod.getDeclaringClass()Ljava/lang/Class;
at net.serenitybdd.junit.runners.SerenityRunner.runChild(SerenityRunner.java:421)
at net.serenitybdd.junit.runners.SerenityRunner.runChild(SerenityRunner.java:55)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:252)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at net.serenitybdd.junit.runners.SerenityParameterizedRunner.run(SerenityParameterizedRunner.java:206)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
这就是我的 CSV 文件的样子
NoSuchMethodError 通常表示存在依赖冲突。您可能 运行 使用不兼容版本的 JUnit 进行测试 - 确保您使用的 JUnit 版本与您正在使用的 Serenity 版本兼容(Serenity 已经使用 JUnit 4.12 构建了一段时间)。