MALE SPEAKER: What happened to the logo?
Actually, you know what?
Ouch.
Can't take it out, sorry.
BRIAN FORD: Need some help?
I have it on my shirt, too.
MALE SPEAKER: Yeah, I know.
BRIAN FORD: We'll be good.
MALE SPEAKER: All right.
Hi, we're back here at Devoxx 2013.
Devoxx has been a great year, I think, a great addition
for a lot of technologies, Angular in particular,
and I'm here with Brian.
BRIAN FORD: Thanks.
MALE SPEAKER: Welcome, Brian.
And you're here to talk about testing, and testing,
in particular, web apps, JavaScript, obviously not just
Angular, right?
And you had a session a couple days ago
about Karma, so give us the introduction on Karma.
BRIAN FORD: Sure.
So Karma is a JavaScript unit test runner
developed by a guy, Vojta, who also works with me on Angular.
And what's cool about Karma is that it kind of harnesses
real web browsers, so you can quickly test your JavaScript
app right as you're developing it.
MALE SPEAKER: The quick feedback is
key, that's what you're looking for.
BRIAN FORD: Yeah.
MALE SPEAKER: So how soon do you run this test?
On save, or--
BRIAN FORD: Yeah, so Karma's pretty configurable,
but the typical setup that we have is you
start Karma when you start developing,
and you can specify which files it will watch.
It can even watch CoffeeScript files, for instance,
and it'll recompile everything, load it up
in however many browsers you want to open up,
and have it hook into, and then it'll quickly
give you the tests.
So for some idea of how this works in practice,
we have something like 2,400 tests with Angular.
And when you're developing in Angular,
you might touch some certain part
of the framework that has kind of a wide impact,
so you want to be able to run all these tests very quickly.
So on each save, Karma will run all of these 2,400 tests
in just a couple seconds.
MALE SPEAKER: Wow.
BRIAN FORD: Yeah.
So it's all about being fast and about getting
immediate feedback so you can immediately
see the effects of your changes.
MALE SPEAKER: But you can also integrate this
into a continuous integration, I suppose?
BRIAN FORD: Yeah, exactly.
We also run this on our continuous integration server.
It has all sorts of plug-ins and hooks,
so you can get email notifications, it does Tap,
it does all of these sort of things.
We run it in like a Jenkins set up.
So it's very versatile.
It's an excellent tool.
MALE SPEAKER: So you actually-- this is not linked--
and you mentioned CoffeeScript-- in any way to Angular.
You can actually use it with Dart or other--
BRIAN FORD: Right, that's the idea.
The idea is that through a kind of a plug-in system,
Karma can automatically recompile or transpile,
or it can do some small subset of your
build process to get your web app going,
and then it can quickly iterate through and do these tests.
MALE SPEAKER: And these are mostly unit tests, right?
Do you have anything that goes beyond that
that could look like scenarios, integration tests, or anything?
BRIAN FORD: So at the moment, we do
have a scenario runner for Angular that works with Karma,
but another Googler, Julie, has been developing
this new tool called Protractor.
And Protractor is an Angular-specific, I guess,
scenario runner, but it's very cool.
And I think you can kind of take a look at it.
And perhaps in the future we'll extend it
so it's a bit more general.
But for now, it's very cool.
If you're developing an Angular app
and you want a better end-to-end experience, better
end-to-end testing experience, Protractor
is a very cool project.
MALE SPEAKER: So one of the reasons people--
one of the key features of Angular, I suppose,
is the dependency injections, which
makes it much more easy to test.
So how do you go about testing other languages and frameworks?
Is it any harder than it is to test Angular code?
BRIAN FORD: So it really depends.
Like you said, Angular's kind of been
designed from the ground up, so that way you
can easily decompose it into its parts
and test each in isolation.
So as long as you've done a good job separating your concerns,
it's not too hard to test in Karma.
But one of the cool things is, because Karma
is using real browsers, you can do things,
you can manipulate the Dom, you can run parts of your app
just as they would run in production,
and then make those kind of checks on it.
So it depends.
I know that other libraries-- Backbone, jquery apps--
people have written plug-ins and people have written helper
libraries to make testing with Karma easier.
But really, as long as you do a good job architecting your app,
there's no reason you can't use Karma with it.
MALE SPEAKER: Great.
So this is a standalone project.
Where does it stand, in terms of versions,
and then what's ahead for the project?
BRIAN FORD: So I don't know what the actual version number is
for it, but at the moment, it's very stable.
We just kind of have bug fixes at this point.
I'm not sure what Vojta's plans are for the future of it.
Again, it's got kind of this more
of a horizontal architecture.
So at this point, future development
is more or less about adding plug-ins
to add more options for yourself.
MALE SPEAKER: BuilD the ecosystem.
BRIAN FORD: Right, right.
But it's not something that, really, you
need to add too much more to the core of besides
if we can make it faster, or if we can make it more stable,
somehow.
MALE SPEAKER: So what's a good place to start?
What kind of URL can you share with us?
BRIAN FORD: Let's see, I think it's--
MALE SPEAKER: Thekarmarunner?
BRIAN FORD: Karma-runner.github.io,
or something like that.
Just search for it on GitHub.
That's the best way to find it.
Karma Runner.
MALE SPEAKER: Great, well, Brian, thanks.
That's all the time we have for.
Thanks for answering my questions.
BRIAN FORD: No, thank you for having me.
MALE SPEAKER: Cool.
Cheers.