use of org.testng.ITestNGMethod in project arrow by NetEase.
the class PowerXMLReport method writeSuiteGroups.
private void writeSuiteGroups(XMLStringBuffer xmlBuffer, ISuite suite) {
xmlBuffer.push(XMLReporterConfig.TAG_GROUPS);
Map<String, Collection<ITestNGMethod>> methodsByGroups = suite.getMethodsByGroups();
for (Map.Entry<String, Collection<ITestNGMethod>> entry : methodsByGroups.entrySet()) {
Properties groupAttrs = new Properties();
groupAttrs.setProperty(XMLReporterConfig.ATTR_NAME, entry.getKey());
xmlBuffer.push(XMLReporterConfig.TAG_GROUP, groupAttrs);
Set<ITestNGMethod> groupMethods = getUniqueMethodSet(entry.getValue());
for (ITestNGMethod groupMethod : groupMethods) {
Properties methodAttrs = new Properties();
methodAttrs.setProperty(XMLReporterConfig.ATTR_NAME, groupMethod.getMethodName());
methodAttrs.setProperty(XMLReporterConfig.ATTR_METHOD_SIG, groupMethod.toString());
methodAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, groupMethod.getRealClass().getName());
xmlBuffer.addEmptyElement(XMLReporterConfig.TAG_METHOD, methodAttrs);
}
xmlBuffer.pop();
}
xmlBuffer.pop();
}
use of org.testng.ITestNGMethod in project cloudstack by apache.
the class TestNGAop method intercept.
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
for (IMethodInstance methodIns : methods) {
ITestNGMethod method = methodIns.getMethod();
ConstructorOrMethod meth = method.getConstructorOrMethod();
Method m = meth.getMethod();
if (m != null) {
DB db = m.getAnnotation(DB.class);
if (db != null) {
TransactionLegacy txn = TransactionLegacy.open(m.getName());
}
}
}
// TODO Auto-generated method stub
return methods;
}
use of org.testng.ITestNGMethod in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onConfigurationFailure.
@Override
public void onConfigurationFailure(ITestResult testResult) {
ITestNGMethod testMethod = testResult.getMethod();
ITestClass testClass = testMethod.getTestClass();
TestClassInfo classInfo;
synchronized (lock) {
if (!failedConfigurations.add(testResult)) {
// workaround for bug in TestNG 6.2 (apparently fixed in some 6.3.x): listener is notified twice per event
return;
}
classInfo = this.testClassInfo.get(testClass);
}
// Synthesise a test for the broken configuration method
TestDescriptorInternal test = new DefaultTestMethodDescriptor(idGenerator.generateId(), testClass.getName(), testMethod.getMethodName());
Object parentId = classInfo == null ? null : classInfo.id;
resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis(), parentId));
resultProcessor.failure(test.getId(), testResult.getThrowable());
resultProcessor.completed(test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE));
}
use of org.testng.ITestNGMethod in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onBeforeClass.
@Override
public void onBeforeClass(ITestClass testClass) {
TestDescriptorInternal testInternal = null;
Object parentId = null;
synchronized (lock) {
TestClassInfo info = testClassInfo.get(testClass);
if (info != null) {
info.incrementStartedCount();
} else {
testInternal = new DefaultTestClassDescriptor(idGenerator.generateId(), testClass.getName());
testClassInfo.put(testClass, new TestClassInfo(testInternal.getId()));
parentId = xmlTestIds.get(testClass.getXmlTest());
for (ITestNGMethod method : testClass.getTestMethods()) {
testMethodParentId.put(method, testInternal.getId());
}
}
}
if (testInternal != null) {
resultProcessor.started(testInternal, new TestStartEvent(clock.getCurrentTime(), parentId));
}
}
use of org.testng.ITestNGMethod in project sonar-java by SonarSource.
the class TestNGListenerTest method mockTestResult.
private ITestResult mockTestResult() {
ITestResult testResult = mock(ITestResult.class);
ITestClass testClass = mock(ITestClass.class);
when(testResult.getTestClass()).thenReturn(testClass);
ITestNGMethod testMethod = mock(ITestNGMethod.class);
when(testResult.getMethod()).thenReturn(testMethod);
when(testClass.getName()).thenReturn("class");
when(testMethod.getMethodName()).thenReturn("method");
return testResult;
}
Aggregations