org.testng.annotations.Parameters类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.testng.annotations.Parameters类的一些代码示例,展示了Parameters类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameters类的具体详情如下:
包路径:org.testng.annotations.Parameters
类名称:Parameters

Parameters介绍

暂无

代码示例

代码示例来源:origin: cbeust/testng

@Parameters({"pp1", "pp2", "pp3"})
public void parameters() {}

代码示例来源:origin: org.testng/testng

private IAnnotation createParametersTag(Annotation a) {
 ParametersAnnotation result = new ParametersAnnotation();
 Parameters c = (Parameters) a;
 result.setValue(c.value());
 return result;
}

代码示例来源:origin: org.testng/testng

@Test
@Parameters({ "testdata" })
public void filterOutInJectedTypesFromOptionalValuesTest(XmlTest xmlTest, @Optional("optionaltestdata") String testdata) {
 JDK15AnnotationFinder finder = new JDK15AnnotationFinder(null);
 Method curMethod = new Object() {}.getClass().getEnclosingMethod();
 FilterOutInJectedTypesResult filterOutResult = org.testng.internal.Parameters.filterOutInJectedTypesFromOptionalValues(
     curMethod.getParameterTypes(), finder.findOptionalValues(curMethod));
 Assert.assertEquals(filterOutResult.getOptionalValues()[0], "optionaltestdata");
 Assert.assertEquals(filterOutResult.getParameterTypes()[0], String.class);  
  
}

代码示例来源:origin: cbeust/testng

@Parameters("optional")
public OptionalParameterTest(@Optional String optional) {}

代码示例来源:origin: cbeust/testng

@Parameters({ "string", "int", "boolean", "byte", "char", "double",
  "float", "long", "short"  })
public ParameterConstructorTest(String s, int i, boolean bo, byte b, char c,
  double d, float f, long l, short sh)
{
 m_string = s;
 m_int = i;
 m_boolean = bo;
 m_byte = b;
 m_char = c;
 m_double = d;
 m_float = f;
 m_long = l;
 m_short = sh;
}

代码示例来源:origin: cbeust/testng

@Parameters({"this parameter doesn't exist"})
 @Test
 public void testNonExistentParameter(@Optional String foo) {
 }
}

代码示例来源:origin: cbeust/testng

private IAnnotation createParametersTag(Annotation a) {
 ParametersAnnotation result = new ParametersAnnotation();
 Parameters c = (Parameters) a;
 result.setValue(c.value());
 return result;
}

代码示例来源:origin: cbeust/testng

@Parameters("a")
 public void f(String p) {
  Assert.assertEquals(p, "Correct");
 }
}

代码示例来源:origin: cbeust/testng

@Test
@Parameters({ "testdata" })
public void test(XmlTest xmlTest, @Optional("optionaltestdata") String testdata) {
  Assert.assertEquals(testdata, "optionaltestdata");
}

代码示例来源:origin: cbeust/testng

@Parameters({"browsername"})
@AfterClass
public void afterClass(String browsername) {
 this.browsername = browsername;
}

代码示例来源:origin: cbeust/testng

@Parameters({PARAMETER_NAME})
 @Test
 public void testParameterAsOptional(@Optional("Unknown") String key) {
  Assert.assertEquals(key, EXPECTED_VALUE);
 }
}

代码示例来源:origin: cbeust/testng

@Parameters({"browsername"})
@BeforeClass
public void beforeClass(String browsername) {
 this.browsername = browsername;
}

代码示例来源:origin: cbeust/testng

@Test
  @Parameters({"parameter1", "parameter2", "parameter3", "parameter4"})
  public void inheritedParameter(String p1, String p2, String p3, @Optional("abc")String p4) {
   Assert.assertEquals(p1, "p1");
   Assert.assertEquals(p2, "c2p2");
   Assert.assertEquals(p3, "c2p3");
   Assert.assertEquals(p4, "abc");
  }
}

代码示例来源:origin: cbeust/testng

@Parameters({"browsername"})
@BeforeClass
public void beforeClass(String browsername) {
 this.browsername = browsername;
}

代码示例来源:origin: cbeust/testng

@Test
  @Parameters({"parameter1", "parameter2", "parameter3", "parameter4"})
  public void inheritedParameter(String p1, String p2, @Optional("foobar")String p3, String p4) {
   Assert.assertEquals(p1, "p1");
   Assert.assertEquals(p2, "c1p2");
   Assert.assertEquals(p3, "foobar");
   Assert.assertEquals(p4, "c1p4");
  }
}

代码示例来源:origin: cbeust/testng

@Parameters("string")
 @Test
 public void injectionAndParameters(String s, ITestContext ctx) {
 }
}

代码示例来源:origin: cbeust/testng

@BeforeSuite
@Parameters({ "beforesuitedata" })
public void beforeSuite(ITestContext context, @Optional("optionalbeforesuitedata") String beforesuitedata) {
  Assert.assertEquals(beforesuitedata, "optionalbeforesuitedata");
}

代码示例来源:origin: cbeust/testng

@Test
 @Parameters("foo")
 public void testMethod(String foo) {}
}

代码示例来源:origin: cbeust/testng

@Test
 @Parameters({"testdata"})
 @SuppressWarnings("unused")
 public void filterOutInJectedTypesFromOptionalValuesTest(
   XmlTest xmlTest, @Optional("optionaltestdata") String testdata) {
  JDK15AnnotationFinder finder = new JDK15AnnotationFinder(null);
  Method curMethod = new Object() {}.getClass().getEnclosingMethod();
  FilterOutInJectedTypesResult filterOutResult =
    org.testng.internal.Parameters.filterOutInJectedTypesFromOptionalValues(
      curMethod.getParameterTypes(), finder.findOptionalValues(curMethod));
  Assert.assertEquals(filterOutResult.getOptionalValues()[0], "optionaltestdata");
  Assert.assertEquals(filterOutResult.getParameterTypes()[0], String.class);
 }
}

代码示例来源:origin: prestodb/presto

@Parameters({
      "hive.hadoop2.metastoreHost",
      "hive.hadoop2.metastorePort",
      "hive.hadoop2.databaseName",
      "hive.hadoop2.s3.awsAccessKey",
      "hive.hadoop2.s3.awsSecretKey",
      "hive.hadoop2.s3.writableBucket"})
  @BeforeClass
  public void setup(String host, int port, String databaseName, String awsAccessKey, String awsSecretKey, String writableBucket)
  {
    super.setup(host, port, databaseName, awsAccessKey, awsSecretKey, writableBucket, false);
  }
}

相关文章