<file_sep>
var object = function() {
  this.book = '';
	this.book = '10min introduciton to BDD';
	this.price = '';
	};
	
// class methods

object.prototype.bookcost = function(bquantity) {
	
	this.price = bquantity * 12;
	return this.price;

};
<file_sep>bddbookshop
===========

introduction to BDD  hands on Javascript<file_sep>/*
* check the homepage index.html webpage has been displayed
*/
var casper = require('casper').create();

//casper.start();

var baseUrl = "http://localhost/sites/playground/bookshop/src/homepage.html";

casper.test.comment("Scenario: A user can view the home page");

casper.start(baseUrl, function() {
	this.test.comment('is the homepage is live on the web');
  this.test.assertHttpStatus(200, "Response is a success if 200 else a fail");
  this.test.assertTitle("Techmeetup - Aberdeen", "Title is as expected or else fail");
});

casper.then(function() {
	this.test.comment('header navigation');
	casper.test.assertExists('#header', 'the element exists');

});

casper.then(function() {
	this.test.comment('main content AJAX point');
	casper.test.assertExists('#maincontent', 'the element exists');
	
});

casper.then(function() {
	this.test.comment('the homepage footer');
	casper.test.assertExists('#footer', 'the element exists');
	
});

casper.then(function() {
	this.test.comment('does the quantity form exist');
	casper.test.assertExists('form#quantity', 'the element exists');
	
});


casper.then(function() {
	this.test.comment('fill two books quantity');
	this.fill('form#quantityinput', { 'quantityin': '2' }, true);
	
});

casper.then(function() {
	this.test.comment('click on the calculate total price button');
	   this.mouseEvent('click', '#totalprice');
	
});

casper.then(function() {
	this.test.comment('a new div totalvalue inserted ready to recieve value');
	casper.test.assertExists('#totalvalue', 'the new div element exists');
	
});


//casper.run();
casper.run(function() {
// need for exporting xml xunit/junit style
  //this.test.renderResults(true, 0, 'reports/test-casper.xml');
  //this.test.done();
	//this.exit();
	this.test.renderResults(true, 0, this.cli.get('save') || false);	
});
<file_sep>if ( typeof require != "undefined") {
    var buster = require("buster");
	 var object = require("../src/bookprice.js");
}

buster.spec.expose(); // Make spec functions global

var spec = describe("Create book object testing tdd style", function () {
    before(function () {
			newhybrid = {};
			newhybrid = new object;

			newbook = newhybrid.book;
			newprice = newhybrid.bookcost(2);
			
    });

    it("Please test if there is a new book in the library", function () {
			
        buster.assert.equals('10min introduciton to BDD', newbook);
    });
	
    it("What is the total cost given quantity for a book", function () {
			
        buster.assert.equals('24', newprice);
    });
	
		
		
	});  // closes spec