farhan5248 / sheep-dog-tools

Eclipse and Maven plug-ins to help manual testers support developers adopting bdd and tdd using lean principles and model based testing
GNU General Public License v3.0
0 stars 0 forks source link

Create Cucumber Feature file from UML model #37

Closed farhan5248 closed 9 months ago

farhan5248 commented 9 months ago

I can create Java code from the UML model but not feature files. I need to look at how to create a feature file with Xtext, I might work on that from the 29th to the 31st.

farhan5248 commented 9 months ago

Trying to get something simple like this working. I took this from here: https://www.eclipse.org/forums/index.php/t/1090396/

    public static void main(String[] args) {
        Model model = MyDslFactory.eINSTANCE.createModel();
        ModelObject newCstic = MyDslFactory.eINSTANCE.createCstic();
        model.getObjects().add(newCstic);
        ((Cstic) newCstic).setDesc("MyNewCstic");
        newCstic.setName("MyNewCstic");
        Injector injector = new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
        ResourceSet rs = injector.getInstance(ResourceSet.class);
        Resource r = rs.createResource(URI.createURI("charts/test2.mydsl"));
        r.getContents().add(model);
        try {
            r.save(null);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
farhan5248 commented 9 months ago

Got this working, will now integrate it with a mojo

farhan5248 commented 9 months ago

This is done but it's not complete. I haven't tested the round trip of feature file to uml to feature file. It's not that important right now since I want to get to refactoring the code. After refactoring, I'll review the test cases and as I add missing ones, I'll complete the code.