Testing Code.org's Interactive 
Computer Science Curriculum 
Brian Jordan, software engineer at Code.org 
brian@code.org 
@bcjordan 
bcjordan.com
Code.org
non-profit
expanding 
participation in CS
Hour of Code
10 million
43 million
now?
district partnerships, 
professional development
700 teachers trained 
10 school districts
policy changes
K-12 CS Curriculum
Testing Challenges
what are we up 
against? 
demo time!
testing challenges
multiple browsers
multiple browsers
iOS / Android
IE 9
localization
33 languages
left-to-right
right-to-left
browser features
<svg>, <canvas>
Javascript
conditional logic to 
support all browsers
tough but important
now let's test it!
Unit Tests!
dashboard (Ruby on Rails) 
blockly (JS, svg, canvas, grunt) 
Unit Tests? 
blockly-core (JS, svg, Closure Tools)
Dashboard 
Blockly Apps Blockly Core
Rails testing
ActiveSupport::TestCase
Factory Girl
Factory Girl
SimpleCov
Blockly testing
solution tests 
grunt-mocha-test 
Chai for assertions 
node-canvas for drawing
solution tests
solution tests
solution 
tests
UI tests
challenge: 
multiple browsers
solution: 
BrowserStack
challenge: 
interaction, 
drag-and-drop
solution: 
jQuery Simulate 
$(selector).drag…
Cucumber —> 
Selenium
local tests with 
chromedriver 
@browser = Selenium::WebDriver.for :chrome, :url=>"http://127.0.0.1:9515"
remote tests with 
BrowserStack 
@browser = Selenium::WebDriver.for 
:remote, 
url => "http://#{browserstack_username}:#{browserstack_authkey} 
@hub.browserstack.com/wd/hub"
Cucumber is uncomfortable 
to start with
DSL should be high-level 
And I drag block "2" to block "4"
Build a library of steps
Visit the URL 
Given I am on "http://learn.code.org/s/1/level/24"
Visit the URL 
Given /^I am on "([^"]*)"$/ do |url| 
url = replace_hostname(url) 
@browser.navigate.to "#{url}" 
end
Annotations 
@no_mobile 
@no_ie 
@skip 
@db_access
On BrowserStack
Demo: Speed Run
Monitoring
integration with CI
HipChat all the things
completion rates
per-browser 
completion rates
Travis CI <> GitHub
Takeaways
Build up 
Library 
of Tests
Culture of 
Testing
Saves time in 
test writing
Saves time in 
development
Thanks! 
Brian Jordan, software engineer at Code.org 
brian@code.org 
@bcjordan 
bcjordan.com 
http://code.org/help 
http://github.com/code-dot-org

Testing Code.org's Interactive CS Curriculum