2012-05-03 24 views
0

初學者TestNG的隨時添加參數錯誤TestNG的參數失效

請各位高手幫忙看一下

謝謝!!

java代碼:

public class NewTest{ 

@Parameters({"names"}) 
@Test 
public void test(String name){ 
    System.out.println(name); 
} 

TestNGxml:

​​

異常信息:

org.testng.TestNGException: 
Parameter 'names' is required by @Test on method Test 
but has not been marked @Optional or defined 
in D:\Documents and Settings\huohui\workspace\lianxi\src\test.xml 

回答

1

也許你應該試着value="aaaaaaaaaa",不values="aaaaaaaaaa"

+0

正確,屬性是「value」而不是「values」。 –