I want to make an annotation to use in Test Cases. I have a method that tests methods of an object, and what I want is to use an annotation "grade" with a parameter called "value", and when the condition is right I want to set 10 to the annotation or 0 if it is wrong. For example: I have a method called "test" that receives an object as attribute. Then, knowing that this object has a method "sum", I will write a condition like if(myobject.sum(2,2)==4)
. If this test pass then the test gets the grade 10. So, what I want is to create a annotation to grade the tests, like @grade(10,0). If the test pass, I set 10 as parameter to the annotation and if didn't I set 0. This test case will execute from another class, so I think I will use reflection to see if there are annotations in the methods or attributes and then get the values but I don't know how to implement this way, if I need to put annotations for methods or for attributes, if I have to create an atribute to put the annotation, etc. Does anybody know how can I implement this?
jeudi 30 juin 2016
How to make an annotation where I can set a different value depending on the condition?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire