@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; }
private static boolean isCcmEnabled(Method testMethod) { Test ann = locateAnnotation(testMethod, Test.class); return !Collections.disjoint(Arrays.asList(ann.groups()), TEST_GROUPS); }
result.setGroups(join(test.groups(), findInheritedStringArray(cls, Test.class, "groups"))); result.setParameters(test.parameters()); result.setDependsOnGroups(join(test.dependsOnGroups(),
result.setGroups(join(test.groups(), findInheritedStringArray(cls, "groups"))); result.setDependsOnGroups( join(test.dependsOnGroups(), findInheritedStringArray(cls, "dependsOnGroups")));
@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(); }
@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(); }
@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 }
@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. }
private void setGroups(){ if(null != method.getAnnotation(org.testng.annotations.Test.class)) groups = method.getAnnotation(org.testng.annotations.Test.class).groups(); }
private static boolean isCcmEnabled(Method testMethod) { Test ann = locateAnnotation(testMethod, Test.class); return !Collections.disjoint(Arrays.asList(ann.groups()), TEST_GROUPS); }
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()));
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"))
continue; String[] groups = annotatn.groups(); if (groups != null && Arrays.asList(groups).contains("WIP")) { continue;
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)) {
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")) {
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")) {
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")) {
.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)) {