Studio Fx on Rails Demonstrating the Studio Fx API
Requirements Software – Ruby >= – Rails >= gem install rails – MySQL >= 5 – Other Ruby Gems to install xml/libxml net/https Hardware (tested) – Mac OS X – Linux
MySQL Install and configure MySQL – Linux example yum install mysql yum install mysql-devel yum install mysql-server chgrp -R mysql /var/lib/mysql chmod -R 770 /var/lib/mysql service mysqld start – set the passwords for your root account: /usr/bin/mysqladmin -u root password 'new-password’ Open MySQL and create the database – mysql –u root –p – create database ddt_development;
Studio Fx On Rails Check out the source from mu-labs google_code: – labs/source/browse/trunk/analyzer/automation/S tudio_Fx_On_Rails labs/source/browse/trunk/analyzer/automation/S tudio_Fx_On_Rails
Create the Database Tables Edit /config/database.yml – set the name of the MySQL database – set the MySQL root password Create the database tables – From : rake db:migrate This will create the tables that are defined in the db/migrate directory (‘runs’ and ‘results’)
Run Rails Start the Rails server. From, run: – ruby script/server Open the browser to Rails – : :3000 You should see the Rails Home Page – (next slide) Continue on to the Studio Fx Home Page – :3000/runs
Rails Home Page
Studio Fx on Rails / Runs
Load templates from a Mu From the ‘Runs’ page: – Enter the IP address of the Mu – Click the 'Get Templates/Set IP' button Loads all of the Mu’s templates for – Testbeds – Targets – Scenarios – Testsuites
Create a New Test Run: 1 Click on the ‘New Run’ link and see:
Create a New Test Run: 2 Select Testbed, Target, Scenario and Testsuite
Create a New Test Run: 3 Click on the ‘Create’ button and see:
Create a New Test Run: 4 Click on the ‘Back’ link to see the new Run
Run the Testsuite Click on the ‘Execute’ link to run the test suite – The browser will be busy until the test is completed – When the test is done, click on the ‘Results’ link to view the test results
View the Results
View Results Details Click on the ‘Show’ link to view more details, including the options and their values
Filter the Results The results can be filtered by test name, run_id or both, and, in all cases, to see only the 'latest' results /results?name=testname&run_id=1 /results?name=testname&run_id=1&latest /results?run_id=1 /results?run_id=1&latest /results?name=testname /results?name=testname&latest
Filtered Results
Sample Code Most of the interesting code is found here: – /app/models/run.rb This code executes the Rails back-end commands, creating the DdtApi object and invoking its methods – /lib/ddt_api.rb The DdtApi class is where all of the Mu Studio Fx API code is invoked
Mu Template fetching When we collected the templates from the Mu, we used a Mu REST Api – /rai/rest/mu/findUsing?type= /rai/rest/mu/findUsing?type – type was Testbed, Target, Scenario and DDTSuite The test tool collected the responses and parsed them into hash maps, using the template names as keys and the uuid’s as values
Test Execution Executing the tests (run.rb:run_test) invoked the following sequence of calls from the DdtApi class: – new_session – testbed(testbed_uuid) – target(target_uuid) – setup_session – scenario(scenario_uuid) – run(testsuite_uuid)
Collecting Results After the test completes, the tool: – calls the DdtApi.collect_results method – parses the results – adds them to the MySQL database (results table)
Other DdtApi methods Studio Fx on Rails does not use all of the DdtApi methods. Other available methods include – Methods that manage csv files (import, export, post, run, and eval (preview)) – post_template (to send a scenario or other xml template to the Mu) – teardown_session (invoked when you are finished using the Mu)