Skip to content

Instantly share code, notes, and snippets.

@sahajamit
Last active August 29, 2015 14:14
Show Gist options
  • Save sahajamit/dcca16e59ab9e41499a7 to your computer and use it in GitHub Desktop.
Save sahajamit/dcca16e59ab9e41499a7 to your computer and use it in GitHub Desktop.
Testng annotation transformer to apply @test annotation at runtime . Here we are setting the timeout using it.
package com.testng.practise;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.testng.IAnnotationTransformer;
import org.testng.ITest;
import org.testng.annotations.ITestAnnotation;
import org.testng.annotations.Test;
import org.testng.IAnnotationTransformer;
public class TestNGAnnotationTransformer implements IAnnotationTransformer{
@Override
public void transform(ITestAnnotation annotation, Class testClass,
Constructor testConstructor, Method testMethod) {
annotation.setTimeOut(2000);
annotation.getInvocationCount();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment