h1. YAKINDU Statechart Tools – Testcase 07 - Custom Generators

|_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
| 7.1 | Create Xtend/Java generator | <ol><li><p>In the package explorer, select _TestProject_.</p></li><li><p>Select _File → New → Project…_.</p></li><li><p>Select _YAKINDU SCT → Xtend/Java Generator Project_.</p></li><li><p>Click on _Next_.</p></li><li><p>Enter _TestProject.generator.xtend_ as project name.</p></li><li><p>Enter _testproject.generator.xtend.XtendGenerator_ as generator class.</p></li><li><p>Check the _Use Xtend_ checkbox.</p></li><li><p>Click on _Finish_.</p></li></ol> | Project _TestProject.generator.xtend_ has been created in the workspace. | %{color:red}open% |
| 7.1.1 | Create generator model for custom Xtend/Java generator | <ol><li><p>In the package explorer, select _TestProject_.</p></li><li><p>Select _File → New → Other_.</p></li><li><p>Select _YAKINDU SCT → Code generator model_.</p></li><li><p>Click on _Next_.</p></li><li><p>Enter _StaircaseXtend.sgen_ as filename.</p></li><li><p>Click on _Next_.</p></li><li><p>Select _Custom Xtend/Java-based Generator_.</p></li><li><p>Check _Staircase.sct_.</p></li><li><p>Click on _Finish_.</p></li></ol> | <ol><li><p>File _StaircaseXtend.sgen_ has been created with initial settings.</p></li><li><p>The file has an error marker, because the generator class cannot be found.</p></li></ol> | %{color:red}open% |
| 7.1.2 | Add Xtend/Java generator project to buildpath | <ol><li><p>Open the properties of the _TestProject_ project (context menu (right-click) → _Properties_, or @[Alt+Enter]@).</p></li><li><p>Select _Java Build Path_.</p></li><li><p>Select _Projects_ tab.</p></li><li><p>Click _Add…_.</p></li><li><p>Add _TestProject.generator.xtend_.</p></li><li><p>Click _OK_.</p></li><li><p>Click _Apply and Close_.</p></li></ol> | Project _TestProject.generator.xtend_ is in the build path of project _TestProject_. | %{color:red}open% |
| 7.1.3 | Setup Xtend generator model | <ol><li><p>In the _TestProject_ project, open the _StaircaseXtend.sgen_ file and change the following features as follows:</p></li><ul><li><p>targetFolder = "src-gen-xtend"</p></li><li><p>generatorProject = "TestProject.generator.xtend"</p></li><li><p>generatorClass = "testproject.generator.xtend.XtendGenerator"</p></li></ul><li><p>Save the file.</p></li></ol> | Folder _src-gen-xtend_ with generated code is created.</p> | %{color:red}open% |
| 7.2| Create Java generator | <ol><li><p>In the package explorer, select _TestProject_.</p></li><li><p>Select _File → New → Project…_.</p></li><li><p>Select _YAKINDU SCT → Xtend/Java Generator Project_.</p></li><li><p>Click on _Next_.</p></li><li><p>Enter _TestProject.generator.java_ as project name.</p></li><li><p>Enter _testproject.generator.java.JavaGenerator_ as generator class.</p></li><li><p>Don't check any checkbox.</p></li><li><p>Click on _Finish_.</p></li></ol> | Project TestProject.generator.java has been created in the workspace. | %{color:red}open% |
| 7.2.1 | Add Java generator project to buildpath | <ol><li><p>Open the properties of the _TestProject_ project (context menu (right-click) → _Properties_, or @[Alt+Enter]@).</p></li><li><p>Select _Java Build Path_.</p></li><li><p>Select _Projects_ tab.</p></li><li><p>Click _Add…_.</p></li><li><p>Add _TestProject.generator.java_.</p></li><li><p>Click _OK_.</p></li><li><p>Click _Apply and Close_.</p></li></ol> | Project _TestProject.generator.java_ is in the build path of project _TestProject_. | %{color:red}open% |
| 7.2.2 | Create generator model for custom Java generator | <ol><li><p>In the package explorer, select _TestProject_.</p></li><li><p>Select _File → New → Other_.</p></li><li><p>Select _YAKINDU SCT → Code generator model_.</p></li><li><p>Click on _Next_.</p></li><li><p>Enter _JavaTestcase.sgen_ as filename.</p></li><li><p>Click on _Next_.</p></li><li><p>Select _Custom Xtend/Java-based Generator_.</p></li><li><p>Check _Staircase.sct_.</p></li><li><p>Click on _Finish_.</p></li></ol> | <ol><li><p>File _JavaTestcase.sgen_ has been created with initial settings.</p></li><li><p>The file has an error marker, because the generator class cannot be found.</p></li></ol> | %{color:red}open% |
| 7.2.3 | Setup Java generator model | <ol><li><p>In the _TestProject_ project, open the _JavaTestcase.sgen_ file and change the following features as follows:</p></li><ul><li><p>targetFolder = "src-gen-java"</p></li><li><p>generatorProject = "TestProject.generator.java"</p></li><li><p>generatorClass = "testproject.generator.java.JavaGenerator"</p></li></ul><li><p>Save the file.</p></li></ol> | Folder _src-gen-java_ with generated code is created.</p> | %{color:red}open% |
| 7.3 | Create custom generator | <ol><li><p>In the package explorer, select _TestProject_.</p></li><li><p>Select _File → New → Project…_.</p></li><li><p>Select _YAKINDU SCT → Xtend/Java Generator Project_.</p></li><li><p>Click on _Next_.</p></li><li><p>Enter _TestProject.generator.custom_ as project name.</p></li><li><p>Enter _testproject.generator.custom.CustomGenerator_ as generator class.</p></li><li><p>Check the _Use Xtend_ checkbox.</p></li><li><p>Check the _Configure for Plugin Export_ checkbox.</p></li><li><p>Enter _CustomGenerator_ as generator name.</p></li><li><p>Click on _Finish_.</p></li></ol> | Project _TestProject.generator.custom_ has been created in the workspace. | %{color:red}open% |
| 7.3.1 | Use the new generator plugin | <ol><li><p>Select _File → Export… → Plug-in Development → Deployable plug-ins and fragments_.</p></li><li><p>Click on _Next_.</p></li><li><p>Check _TestProject.generator.custom_.</p></li><li><p>As _destination_, choose some arbitrary target folder.</p></li><li><p>Click on _Finish_.</p></li><li><p>Copy the exported JAR file into the _plugins_ subfolder of the YSCT product installation directory.</p></li><li><p>In the YSCT main menu, select _File → Restart_.</p></li></ol> | No errors occurred. | %{color:red}open% |
| 7.3.2 | Create generator model for custom generator | <ol><li><p>In the package explorer, select _TestProject_.</p></li><li><p>Select _File → New → Other_.</p></li><li><p>Select _YAKINDU SCT → Code generator model_.</p></li><li><p>Click on _Next_.</p></li><li><p>Enter _CustomTestcase.sgen_ as filename.</p></li><li><p>Click on _Next_.</p></li><li><p>Select _Custom Generator_.</p></li><li><p>Check _Staircase.sct_.</p></li><li><p>Click on _Finish_.</p></li></ol> | <ol><li><p>A new option is visible in the dropdown menu.</p></li><li><p>File _CustomTestcase.sgen_ has been created with initial settings.</p></li><li><p>Folders _src_ and _src-gen_ have been created and populated by builder.</p></li></ol> | %{color:red}open%
