org.testng.annotations.Test.groups()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(140)

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

Test.groups介绍

暂无

代码示例

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

@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods,
  ITestContext context)
{
 List<IMethodInstance> result = new ArrayList<>();
 for (IMethodInstance m : methods) {
  Test test = m.getMethod().getConstructorOrMethod().getMethod().getAnnotation(Test.class);
  Set<String> groups = new HashSet<>();
  for (String group : test.groups()) {
   groups.add(group);
  }
  if (groups.contains("fast")) {
   result.add(0, m);
  }
  else {
   result.add(m);
  }
 }
 return result;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private static boolean isCcmEnabled(Method testMethod) {
 Test ann = locateAnnotation(testMethod, Test.class);
 return !Collections.disjoint(Arrays.asList(ann.groups()), TEST_GROUPS);
}

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

result.setGroups(join(test.groups(), findInheritedStringArray(cls, Test.class, "groups")));
result.setParameters(test.parameters());
result.setDependsOnGroups(join(test.dependsOnGroups(),

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

result.setGroups(join(test.groups(), findInheritedStringArray(cls, "groups")));
result.setDependsOnGroups(
  join(test.dependsOnGroups(), findInheritedStringArray(cls, "dependsOnGroups")));

代码示例来源:origin: magro/memcached-session-manager

@BeforeMethod
public void setUp(final Method testMethod) throws Throwable {
  _portTomcat1 = 18888;
  _memcachedPort = 21211;
  final InetSocketAddress address = new InetSocketAddress( "localhost", _memcachedPort );
  _daemon = createDaemon( address );
  _daemon.start();
  final String[] testGroups = testMethod.getAnnotation(Test.class).groups();
  final String nodePrefix = testGroups.length == 0 || !GROUP_WITHOUT_NODE_ID.equals(testGroups[0]) ? _memcachedNodeId + ":" : "";
  _memcachedNodes = nodePrefix + "localhost:" + _memcachedPort;
  try {
    System.setProperty( "org.apache.catalina.startup.EXIT_ON_INIT_FAILURE", "true" );
    _tomcat1 = tcBuilder().buildAndStart();
  } catch ( final Throwable e ) {
    LOG.error( "could not start tomcat.", e );
    throw e;
  }
  _memcached = createMemcachedClient( _memcachedNodes, address );
  _httpClient = new DefaultHttpClient();
}

代码示例来源:origin: magro/memcached-session-manager

@BeforeMethod
public void setUp(final Method testMethod) throws Throwable {
  final InetSocketAddress address = new InetSocketAddress( "localhost", MEMCACHED_PORT );
  _daemon = createDaemon( address );
  _daemon.start();
  final String[] testGroups = testMethod.getAnnotation(Test.class).groups();
  final String nodePrefix = testGroups.length == 0 || !GROUP_WITHOUT_NODE_ID.equals(testGroups[0]) ? NODE_ID + ":" : "";
  _memcachedNodes = nodePrefix + "localhost:" + MEMCACHED_PORT;
  try {
    _tomcat1 = startTomcat( TC_PORT_1, JVM_ROUTE_1 );
    _tomcat2 = startTomcat( TC_PORT_2, JVM_ROUTE_2 );
  } catch ( final Throwable e ) {
    LOG.error( "could not start tomcat.", e );
    throw e;
  }
  final MemcachedNodesManager nodesManager = MemcachedNodesManager.createFor(_memcachedNodes, null, null, _storageClientCallback);
  final ConnectionFactory cf = nodesManager.isEncodeNodeIdInSessionId()
    ? new SuffixLocatorConnectionFactory( nodesManager, nodesManager.getSessionIdFormat(), Statistics.create(), 1000, 1000 )
    : new DefaultConnectionFactory();
  _client = new MemcachedClient( cf, Arrays.asList( address ) );
  _httpClient = new DefaultHttpClient();
}

代码示例来源:origin: stackoverflow.com

@BeforeMethod
 public void beforeMethod(Method method){
   Test testClass = method.getAnnotation(Test.class);
   for (int i = 0; i < testClass.groups().length; i++) {
     System.out.println(testClass.groups()[i]);
   }
 }

代码示例来源:origin: stackoverflow.com

@BeforeMethod
public void generateFolderFromGroups(Method m) {
  Test test = m.getAnnotation(Test.class);
  String[] groups = test.groups();
  // generate folder from groups
}

@Test(groups = "Foo")
public void test() {
  // the Foo folder will be already created
}

代码示例来源:origin: stackoverflow.com

@BeforeMethod
public void befMet(Method m){
    Test t = m.getAnnotation(Test.class);
    System.out.println(t.groups()[0]);//or however you want to use it.
}

代码示例来源:origin: springernature/omelet

private void setGroups(){
  if(null != method.getAnnotation(org.testng.annotations.Test.class))
  groups = method.getAnnotation(org.testng.annotations.Test.class).groups();
}

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

private static boolean isCcmEnabled(Method testMethod) {
 Test ann = locateAnnotation(testMethod, Test.class);
 return !Collections.disjoint(Arrays.asList(ann.groups()), TEST_GROUPS);
}

代码示例来源:origin: org.infinispan/infinispan-commons-test

Test annotation = testClass.getAnnotation(Test.class);
if (testClass != declaringClass) {
  if (!Arrays.equals(annotation.groups(), m.getGroups())) {
   errors.add("Method " + m.getConstructorOrMethod() + " was inherited from class " + declaringClass +
         " with groups " + Arrays.toString(m.getGroups()) +
         ", but the test class has groups " + Arrays.toString(annotation.groups()));

代码示例来源:origin: org.w3/ldp-testsuite

Method m = result.getMethod().getConstructorOrMethod()
    .getMethod();
String[] groups = m.getAnnotation(Test.class).groups();
for (int i = 0; i < groups.length; i++) {
  if (groups[i].equals("MUST"))
Method m = result.getMethod().getConstructorOrMethod()
    .getMethod();
String[] groups = m.getAnnotation(Test.class).groups();
for (int i = 0; i < groups.length; i++) {
  if (groups[i].equals("MUST"))
Method m = result.getMethod().getConstructorOrMethod()
    .getMethod();
String[] groups = m.getAnnotation(Test.class).groups();
for (int i = 0; i < groups.length; i++) {
  if (groups[i].equals("MUST"))

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base

continue;
String[] groups = annotatn.groups();
if (groups != null && Arrays.asList(groups).contains("WIP")) {
  continue;

代码示例来源:origin: org.w3/ldp-testsuite

for(Method m : classMethod) {
  if(m.getAnnotation(Test.class) != null) {
    String group = Arrays.toString(m.getAnnotation(Test.class).groups());
    for(String groupCover : testLdp.coveredByGroups()) {
      if(group.contains(groupCover)) {

代码示例来源:origin: org.w3/ldp-testsuite

for(Method methodName : classMethod) {
  if(methodName.getAnnotation(Test.class) != null) {
    String group = Arrays.toString(methodName.getAnnotation(Test.class).groups());
    for(String groupCover : specTest.coveredByGroups()) {
      if(group.contains(groupCover) && !methodName.getName().contains("Conforms")) {

代码示例来源:origin: org.w3/ldp-testsuite

for(Method methodName : classMethod) {
  if(methodName.getAnnotation(Test.class) != null) {
    String group = Arrays.toString(methodName.getAnnotation(Test.class).groups()); 
    for(String groupCover : spec.coveredByGroups()) {
      if(group.contains(groupCover) && !methodName.getName().contains("Conforms")) {

代码示例来源:origin: org.w3/ldp-testsuite

String allGroups = groups(test.groups());
  for (String group: test.groups()) {
    group = group.trim();
    if (conformanceLevels.contains(group))  {

代码示例来源:origin: org.w3/ldp-testsuite

for(Method methodName : classMethod) {
  if(methodName.getAnnotation(Test.class) != null) {
    String group = Arrays.toString(methodName.getAnnotation(Test.class).groups()); 
    for(String groupCover : testLdp.coveredByGroups()) {
      if(group.contains(groupCover) && !methodName.getName().contains("Conforms")) {

代码示例来源:origin: org.w3/ldp-testsuite

.write(testLdp.specRefUri())._a();
html.br().b().write("Groups: ")._b()
    .write(Arrays.toString(test.groups()));
html.br().b().write("Status: ")._b()
    .write(testLdp.approval().toString());
    for(Method m : classMethod) {
      if(m.getAnnotation(Test.class) != null) {
        String group = Arrays.toString(m.getAnnotation(Test.class).groups()); 
        for(String groupCover : testLdp.coveredByGroups()) {
          if(group.contains(groupCover)) {

相关文章