Code Monkey home page Code Monkey logo

umlaut's Introduction

UMLAUT

Build Status codecov

This project is part of a submission for the MEng Degree in Computer Science at UCL (University College London).

Projects in this Repository

UML-Annotator

Tool to annotate Visual Studio UML models.

UML-Parser

Tool to convert UML models to a standard output for this project.

Output schema:

{
  "className": {
    "name": "Name of class",
    "variables": {
      "variableName": {
        "name": "Name of variable",
        "visibility": "Public/Private",
        "type": "Type of variable"
      },
      /* ...Next variable */
    },

    "methods": {
      "methodName": {
        "name": "Name of method",
        "visibility": "Public/Private",
        "type: "Return type of method",
        "arguments": {
          "argument": "Type of argument",
          /* ...Next argument */
        },

        "preconditions": [
          {
            "id": "UUID for this precondition",
            "comparison": "Comparison name",
            "arguments": [
              "Name of variable or method argument or direct value",
              /* ...Next argument */
            ]
          },
          /* ...Next precondition */
        ],

        "postconditions": [
          {
            "id": "UUID for this postcondition",
            "comparison": "Comparison name",
            "arguments": [
              "Name of variable or method argument or direct value",
              /* ...Next argument */
            ]
          },
          /* ...Next postcondition */
        ]
      },
      /* ...Next method */
    }

  },
  /* ...Next class */
}

For list of comparison names, see comparisons.json.

Input-Generator

Tool to generate inputs for tests.

Extends schema of UML-Parser, with an additional tests array on each method:

{
  "className": {
    ...
    "methods": {
      "methodName": {
        ...
        "tests": [
          {
            "condition": "Text identifying the meaning of the test",
            "arguments: {
              "argument": "Value of argument",
              /* ...Next argument */
            }
          },
          /* ...Next test */
        ]
      },
      /* ...Next method */
    }

  },
  /* ...Next class */
}

In order to generate inputs, the design of this section is for submodules to handle specific types for the test. Currently, only numerical logic is handled by the Input-Generator, though more is planned.

SMT-Solver

The SMT-Solver handles Boolean and Numerical Logic. Implementation is handled via the conversion of the annotated constraints on the methods into Satisfiability Modulo Theorem, SMT. Then by using Microsoft's z3, the constraints are solved to generate values that satisfy the constraints.

Test-Generator

Tool to take the UML model and inputs and generate the test suite.

Installation

This is a project dependent on C# (For UML-Annotator) and Node.js (For UML-Parser, Input-Generator and Test-Generator).
This project also uses ES6 syntax, which requires node version v6.0.0 at minimum.

Please ensure that node and npm are installed and available in your PATH, to correctly run this project.
Also check that node --version matches at least v6.0.0.

Node.js is available here for all major OS platforms.

Installing Locally

To install this project:

git clone https://github.com/KK578/compm091-code.git
cd compm091-code
npm install --production
npm link

This will setup the generator to work locally.

Developing

Dependencies

To develop the project, this project uses grunt.

npm install -g grunt-cli

Setup

git clone https://github.com/KK578/compm091-code.git
cd compm091-code
npm install
npm link

Linting

Ensure changes adhere to the existing coding style.
Check code changes with grunt lint.

Unit tests

To test the project, this project uses mocha, and is setup via grunt test.
For code coverage statistics, this project uses istanbul, and is setup via grunt coverage.

Continuous Integration builds is handled via Travis-CI, and is available here.
Code coverage information is handled via Codecov, and is available here.

License

This project has been templated by generator-kk578.

BSD-3 License

Copyright (c) 2017, Kevin Kwan ([email protected]).
All rights reserved.

See LICENSE.md for full license text.

umlaut's People

Contributors

kk578 avatar

Watchers

 avatar  avatar

umlaut's Issues

Rename smt-generator to more input generic

More representative in the future for conditions that may not be solvable just by SMT.
(Generator part of name works, but may be confusing with refactor of test-generator to top level.)

E.g. Input-Generator, Input-Solver, Test-Inputs

Overloaded methods

Currently assuming no methods have multiple overloads.
Is this a worthwhile thing to handle?

Weakly Typed languages

Strength of typing introduces challenges to the parser and test generation.
Assuming only Strongly typed for now.

Evaluate how to handle weakly typed languages later. (Add it to the test suite?)

CFG Parser for all conditions

Do no prior string manipulation on the conditions, and allow CFG to parse entirely.
Can then remove ----- splitters and leave as empty or just spaces.

Code cleanup

SMT-generator has additional items that should be removed.

Add expected exceptions

Add an expected exception state to conditions.

UML-Parser needs to split this into a exception property under the condition.
SMT-Generator and Test-Generator already handles this.

Script build from Annotated UML

Automate all steps into a script call.

User annotates UML -> AnnotatedUML

  1. UML-Parser parses AnnotatedUML into ParsedAnnotatedUML
  2. SMT-Generator reads ParsedAnnotatedUML and creates SMTScript
  3. SMT-Generator runs SMTScript and creates ModelTestInputs
  4. Test-Generator reads ParsedAnnotatedUML and ModelTestInputs and creates TestSuite

Exception Handling

Add exceptions that should be thrown if a given condition is unsatisfied.

Object describing the exception should be added to the UML Object.

Read Visual Studio UML Class Diagram

Parse VS Class diagram file as a XML configuration, into the annotator program.

Require by class, all methods and variables and expose the invariants/preconditions/postconditions.

Populate uml-parser list dynamically

Populating the list dynamically opens up support for plugins to other forms of UML objects.

Search locally installed npm modules with some plugin name/keyword (TBD).

Generate JUnit test suite

Copy Nunit generator and just modify the template to determine if anything needs to change particularly

Update project license

Would like to update to BSD-3-Clause.

Need confirming whether this can be made public and open source.

Refactor codebase

Merge all package.json together to a top level item.
Move subprojects down into a src/ directory.

No need for postinstall script if this is done.

Loses some sense of how the codebase is moduled however.

Store condition IDs to lookup table

If it speeds up the time taken and is worth the speed, may be useful.

Number of conditions may not be large enough for this to matter however.

Travis CI

Add linting and tests

Need C# linter and code runner on terminal though.

Annotator does not update both .uml and .classdiagram files

Currently only updates the file that is being used.
Ideal would be to select .uml file to load and that can push updates to the .classdiagram files.

This is a major issue if you want to work on the model again after doing the annotations.
It is slightly difficult to implement due to GUIDs need to match between the files, under <elementDefinition> nodes.

Improve test names

Include details of the entire universe of inputs for each test rather than just the one that is invalid.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.