Custom annotations to configure tests
Posted
by ace
on Stack Overflow
See other posts from Stack Overflow
or by ace
Published on 2010-04-10T22:05:10Z
Indexed on
2010/04/10
22:13 UTC
Read the original article
Hit count: 240
First of al let me start off by saying I think custom annotations can be used for this but i'm not totally sure.
I would like to have a set of annotations that I can decorate some test classes with. The annotations would allow me to configure the test for different environments. Example:
public class Atest extends BaseTest{
private String env;
@Login(environment=env)
public void testLogin(){
//do something
}
@SignUp(environment=env)
public void testSignUp(){
//do something
}
}
The idea here would be that the login annotation would then be used to lookup the username and password to be used in the testLogin method for testing a login process for a particular environment.
So my question(s) is this possible to do with annotations? If so I have not been able to find a decent howto online to do something like this. Everything out there seems to be your basic here's how to do your custom annotations and a basic processor but I haven't found anything for a situation like this. Ideas?
© Stack Overflow or respective owner