Download - Studio Fx on Rails 5.0
![Page 1: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/1.jpg)
Studio Fx on Rails 5.0
Demonstrating the Studio Fx API
![Page 2: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/2.jpg)
Requirements• Software
– Ruby >= 1.8.6– Rails >= 2.3.2
• gem install rails– MySQL >= 5– Other Ruby Gems to install
• xml/libxml• net/https• json
• Hardware (tested)– Mac OS X– Linux
![Page 3: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/3.jpg)
MySQLInstall 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 fx_development;
![Page 4: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/4.jpg)
Studio Fx On Rails
• Check out the source from mu-labs google_code:
• http://code.google.com/p/mu-labs/source/browse/trunk/analyzer/automation/Studio_Fx_On_Rails_5.0
![Page 5: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/5.jpg)
Create the Database Tables
• Edit <root_dir>/config/database.yml– set the name of the MySQL database– set the MySQL root password
• Create the database tables– From <root_dir>:• rake db:migrate• This will create the tables that are defined in the
<root_dir>db/migrate directory (‘runs’ and ‘results’)
![Page 6: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/6.jpg)
Run Rails
• Start the Rails server. From <root_dir>, run:– ruby script/server
• Open the browser to Rails– http://<host>:3000
• You should see the Rails Home Page – (next slide)
• Continue on to the Studio Fx Home Page– http://<host>:3000/runs
![Page 7: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/7.jpg)
Rails Home Page
![Page 8: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/8.jpg)
Studio Fx on Rails / Runs
![Page 9: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/9.jpg)
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– Scenarios– Test Suites– Hosts and Interfaces
![Page 10: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/10.jpg)
Create a New Test Run: 1
• Click on the ‘New Run’ link and see:
![Page 11: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/11.jpg)
Create a New Test Run: 4
• Select a Scenario and Test Suite, and click on the ‘Create’ button. Click on the ‘Back’ link to see the new Run
![Page 12: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/12.jpg)
Set Hosts
• Click on the Edit link to set the Hosts
![Page 13: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/13.jpg)
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
![Page 14: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/14.jpg)
View the Results
![Page 15: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/15.jpg)
View Results Details
• Click on the ‘Show’ link to view more details, including the options and their values
![Page 16: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/16.jpg)
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
![Page 17: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/17.jpg)
Sample Code
• Most of the interesting code is found here:– <root_dir>/app/models/run.rb• This code executes the Rails back-end commands,
creating the DdtApi object and invoking its methods– <root_dir>/lib/ddt_api.rb• The DdtApi class is where all of the Mu Studio Fx API
code is invoked
![Page 18: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/18.jpg)
Mu Template fetching
• When we collected the templates from the Mu, we used a Mu REST Api – https://<MU_IP>/rai/rest/mu/findUsing?type=– Where types are 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
![Page 19: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/19.jpg)
Test Execution
• Executing the tests (run.rb:run_test) invoked the following sequence of calls from the DdtApi class:– new_session– load_scenario(uuid)– set_hosts– setup_test– run_test_suite
![Page 20: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/20.jpg)
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)
![Page 21: Studio Fx on Rails 5.0](https://reader036.vdocuments.pub/reader036/viewer/2022062315/568161db550346895dd1e84a/html5/thumbnails/21.jpg)
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 and
run to verify the scenario)– post_template (to send a scenario or other xml
template to the Mu)– teardown_test (invoked when you are finished
using the Mu)