list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

Automatic Test

Test can be automatically generated by compiling the Umple model with the test generator. This can be done using the following commandline

  • java -jar umple.jar -generate Test umpleModel.ump
  • When compiled this way, Umple will generate a list of files with the extension .umpt you can compile these abstract test files with the unit test generator targeting one of the platforms supported. This can be done using the following commandline tool:
  • java -jar umple.unit-test.jar -generate testModel.umpt -l JUnit
  • Using the automatic test generator for the following example will generate the following files:
  • testModel_ModelTest.umpt contains test logic for associations
  • AdvisorTest.umpt
  • StudentTest.umpt
  • CourseTest.umpt
  • OfficeTest.umpt
  • Example

    
    
    
    class Advisor 
    {
      name;
      id;
      int tel;
    
      0..1 -- * Student;
    
      1 -- * Office;
    
      2 -- * Course;
    
    }
    
    
    class Student {
      name;
    
    }
    
    
    class Office {
      name;
      lazy address;
    
    
    
    }
    
    
    class Course {
      code;
      int numberOfStudents;
      description;
    
      Date startDate = "2020-12-26";
    
      Time classTime = "12:59:59";
    
    
    }
          

    Load the above code into UmpleOnline