HowToRunAutomateTestSuitesForUmple

Kevin Brightwell edited this page Aug 26, 2015 · 1 revision
Clone this wiki locally

Running Unit tests

For a complete discussion of testing see UmpleArchitectureTestingView

Umple unit tests are run using the ant scripts found in the build directory

Running a complete build will run all the tests:

   ant -Dmyenv=local

You might want to put this in a script so you don't have to keep typing it. Your script would cd to your build directory first then run the above. Some of us call that script 'bumple'

However, if you are compiling Umple code and want to speed up your work, you may want to first get your new version of Umple to compile (i.e. deal with all compilation errors, and any debugging). The following will just run umple to generate the java code for umple (umpleself), then compile that java coe (compile) and finally package the Jars. Some of us put this in a script 'qbumple'

   ant -Dmyenv=local -f build.umple.xml umpleSelf compile packageJars

Once the above works cleanly you can run the testing as a separate step (you can also do this if you have modified a one of the .ump or .txt files used in testing)

  ant -Dmyenv=local -f build.umple.xml template.test

The testbeds: Testing Umple Generated Systems

Umple is a programming language that currently targets Java, Ruby and PHP. So an additional part of our testing infrastructure we build specific examples and then test those sample programs to ensure the code generation is as we expect.

The following describes the ruby testbed. There are also testbeds for Java and PHP

testbed_ruby

The ruby testbed is available at ./trunk/testbed_ruby

Be sure to have a working at valid ruby environment (1.8.7 or 1.9.2). Consider using RVM (https://rvm.beginrescueend.com/) to help with that.

To compile the tests against the latest deployed umple (found in /trunk/dist/umple.jar), run "rake compile_and_testbed" as shown below.

Gondor:testbed_ruby aforward$ pwd
/Users/aforward/tp/projects/uottawa/umple/trunk/testbed_ruby
Gondor:testbed_ruby aforward$ rake compile_and_testbed

The output will look similar to:

Gondor:testbed_ruby aforward$ rake compile_and_testbed
(in /Users/aforward/tp/projects/uottawa/umple/trunk/testbed_ruby)
Success! Processed src/TestHarnessRuby.ump.
/Users/aforward/.rvm/rubies/ruby-1.8.7-p248/bin/ruby -w -I"lib" "/Users/aforward/.rvm/gems/ruby-1.8.7-p248/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/attributes/date_time_string_test.rb" "test/attributes/defaulted_test.rb" "test/attributes/immutable_test.rb" "test/associations/m_n_to_m_n_test.rb" "test/associations/m_n_to_m_star_test.rb" "test/associations/m_n_to_n_test.rb" "test/associations/m_n_to_optional_n_test.rb" "test/associations/m_star_to_m_star_test.rb" "test/associations/m_star_to_optional_n_test.rb" "test/associations/many_to_m_n_test.rb" "test/associations/many_to_m_star_test.rb" "test/associations/many_to_many_test.rb" "test/associations/many_to_n_test.rb" "test/associations/many_to_optional_n_test.rb" "test/associations/n_to_m_star_test.rb" "test/associations/n_to_n_test.rb" "test/associations/n_to_optional_n_test.rb" "test/associations/one_to_m_n_test.rb" "test/associations/one_to_mandatory_many_test.rb" "test/associations/one_to_many_test.rb" "test/associations/one_to_n_test.rb" "test/associations/one_to_one_test.rb" "test/associations/one_to_optional_n_test.rb" "test/associations/optional_n_to_optional_n_test.rb" "test/associations/optional_one_to_m_n_test.rb" "test/associations/optional_one_to_m_star_test.rb" "test/associations/optional_one_to_many_test.rb" "test/associations/optional_one_to_n_test.rb" "test/associations/optional_one_to_one_test.rb" "test/associations/optional_one_to_optional_n_test.rb" "test/associations/reflexive_one_test.rb" "test/associations/reflexive_optional_one_test.rb" "test/associations/unidirectional_m_n_test.rb" "test/associations/unidirectional_m_star_test.rb" "test/associations/unidirectional_many_test.rb" "test/associations/unidirectional_n_test.rb" "test/associations/unidirectional_one_test.rb" "test/associations/unidirectional_optional_n_test.rb" "test/associations/unidirectional_optional_one_test.rb" 
Loaded suite /Users/aforward/.rvm/gems/ruby-1.8.7-p248/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
..................................................................................................................................................................................................................................................................................................................................................................................
Finished in 0.066088 seconds.

370 tests, 1670 assertions, 0 failures, 0 errors

If you are working on adding tests to the Ruby sample system but do not need to recompile the Umple, then simply run "rake", as shown below.

rake

The tests will execute and should all pass.