Hi,
I have a KDT based on sereval keywords stored in a class A in order dynamically configure behavior of each keyword they share an object B which is a member variable of my class A.
Code look like this
public class A
{
protected B m_b = new B;
protected Desktop desktop = new Desktop;
@Keyword
public void state_01()
{
m_b.update(); ...; ...;
}
@Keyword
public void state_02()
{
m_b.update(); ...; ...;
}
}
But it seems that object A is re-instancied for each keyword leading me to situation where m_b is reset and so previous state is lost.
You can assume that B has a counter initialized to zero, then if I run a KDT with N calls to state_01, but counter will remain to 0 even after N calls.
I have two dirty solutions to workaround this:
1 - Use Junit instead of KDT, it means that instead clicking in a KDT view to add calls to keywords you will have type code to each method (state_01, state_02, ...) and find a way to generate report file (xlg)
2 - Use static variable for class B, but this is hawful and doesn't make any sense in a design point of view.
But I would prefer to find a better solution to do the same e.g keep KDT, doesn't use of static declaration)
Finally, there is a Desktop variable which is also part of class but doesn't seem to be re-instanciated, what is the magic beyond that
Regards,
Thomas