Duplicate Local Variable/Constant/Timer
Definition:
The same local variable, constant or timer is defined in two or more functions, test cases or altsteps running on the same component.
Code Example:
type component c {
port ExamplePort p;
}
testcase tc1() runs on c {
timer t;
p.send("foo1");
t.start (10.0);
alt {
[] p.receive("bari") {
// do something
}
[] any port.receive{
// error handling
}
[] t.timeout {
// error handling
}
}
}
testcase tc2() runs on c {
timer t;
p.send("foo2");
t.start (20.0);
alt {
[] p.receive("bar2") {
// do something
}
[] any port.receive {
// error handling
}
[] t.timeout {
// error handling
}
}
}
References:
Quality attributes
- Code Example
- Cause and Effect
- Frequency
- Refactoring