Testcase can be injected within the Umple/UML model code using the abstract testing syntax. a class with a state machine can also have test elements as part of the model. the following is an exmaple:
File: <modelBulb.ump>
01: class House {
02: name;
03: test checkBulb{
04: House h1 ("House1");
05: String currentState = h1.getBulb();
06: assertTrue(currentState == "Off");
07: boolean didFlip = h1.flip();
08: assertTrue(didFlip);
09: currentState = h1.getBulb();
10: assertFalse(currentState == "On");
11: }
12:
13: bulb
14: {
15: Off { flip -> On; }
16: On { flip -> Off; }
17: }
18: }
This abstract test can be generated into any unit testing platform using the ‘test’ generator followed by a compilation with the unit-test generator.
1 comment
Mr WordPress
Hi, this is a comment.
To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.