Jasmine	2.0
What	is	Jasmine?
• A	library	to	us	to	write	tests	a	JavaScript	based	app
• A	tool	to	use	to	write	human	readable	tests
• A	way	to	improve	your	software	documentation
File	Structure
• boots.js,	the	file	where	all	the	initialization	happens
• console.js,	the	file	responsible	for	the	string	output	in	the	HTML
report	page
• jasmine-html.js,	the	file	responsible	to	build	the	DOM	elements
of	the	HTML	report	page
• jasmine.js,	the	core	of	the	library
• jasmine.css,	the	file	that	specifies	the	formatting	rules	to	be
used	in	the	HTML	report	page
Run	the	Specs<head>
		<title>Jasmine	Spec	Runner	v2.0.0</title>
		<link	rel="shortcut	icon"	type="image/png"	href="lib/jasmine-2.0.0/jasmine_favicon.png">
		<link	rel="stylesheet"	type="text/css"	href="lib/jasmine-2.0.0/jasmine.css">
		<script	type="text/javascript"	src="lib/jasmine-2.0.0/jasmine.js"></script>
		<script	type="text/javascript"	src="lib/jasmine-2.0.0/jasmine-html.js"></script>
		<script	type="text/javascript"	src="lib/jasmine-2.0.0/boot.js"></script>
		<!--	include	source	files	here...	-->
		<script	type="text/javascript"	src="src/MyFile.js"></script>
		<!--	include	spec	files	and	helpers	here...	-->
Run	the	Specs<head>
		<title>Jasmine	Spec	Runner</title>
		<link	rel="shortcut	icon"	type="image/png"	href="lib/jasmine-2.0.0/jasmine_favicon.png">
		<link	rel="stylesheet"	type="text/css"	href="lib/jasmine-2.0.0/jasmine.css">
		
		<!--	include	source	files	here...	-->
		
		<!--	include	spec	files	here...	-->
		<script	data-main="specRunner"	src="lib/require/require.js"></script>
		<!--	Clean	HTML	specs	loader,	long	live	to	clean	coders!	^	-	^	-->
specRunner.jsrequire.config({
				urlArgs:	'cb='	+	Math.random(),
				baseUrl:	'',
				paths:	{
								'jquery':							'../lib/jquery/jquery-2.0.0.min',
								'jasmine':						'../lib/jasmine-2.0.0/jasmine',
								'jasmine-html':	'../lib/jasmine-2.0.0/jasmine-html',
								'boot':									'../lib/jasmine-2.0.0/boot',
								'spec':									'spec/'
				},
					shim:	{
						'jasmine':	{
								exports:	'window.jasmineRequire'
						},
specRunnerrequire(['boot'],	function(boot)	{
				var	specs	=	[];
				specs.push('spec/PlayerSpec');
				require(specs,	function(spec)	{
						window.onload();
				});
});
describe()
• Describe	your	tests
• Group	together	related	tests
it()
it("and	so	is	a	spec",	function()	{
			//	Expectations
		});
• A	function	that	can	contain	any	executable	code	to	be	run	to
test	our	software
Matchers
•
• toBe()
• toEqual()
• toMatch()
• toBeUndefined()
• toBeNull()
• toBeTruthy()
• toContain()
Expectations
it("and	has	a	positive	case",	function()	{
				expect(true).toBe(true);
});
		
it("and	can	have	a	negative	case",	function()	{
				expect(false).not.toBe(true);
});
• Describe	the	desired	behavior
• Chained	with	a	matcher

Jasmine 2.0