0
votes

I am a newbie in EA (Enterprise Architect). Could you please help me to solve my problem about unit test generation from activity diagram?

Firstly, let me show more detail about my problem:

  • My requirement is that generate unit test case from activity diagram or class diagram. Each unit test is included test case name or test case id, test case input& expected output, test case scenario or test case activity diagram (I think too difficult to generate unit test code).

  • I tried 2 way different:

    • Transform class to "unit test" class by "right click to class -> advanced -> transform". But unfortunately, the unit test class has only test function without input or output

    • convert activity diagram -> scenario then convert scenario -> test case. But I can not convert activity diagram to scenario. I searched with google, the information I got that only generated activity from scenario can convert to scenario.

So, could anyone please help me to answer 2 question:

  • Could we generate unit test case from activity diagram. Each test case included name, input& expected output and scenario.
  • If yes, could you please guide this way to me?

Thanks.

1

1 Answers

1
votes

The main idea behind the unit test is to test the code we write or drive your code through the unit test (TDD). One or the other you cannot generate functional unit test through activity diagram as to pass the unit test you should have your business logic written. Moreover, it is not a good idea to generate unit tests from activity diagram as test should derive from business logic (If you are not following TDD). If you are following TDD then your code should derive from the test. In either case, unit tests shouldn't derive from activity diagram