eluna2014: developing and testing an open source web application

38
Developing and Testing an open source web application ELUNA 2014 Montreal Michael Cummings, GWU

Upload: michael-cummings

Post on 13-Jul-2015

104 views

Category:

Data & Analytics


4 download

TRANSCRIPT

Page 1: ELUNA2014: Developing and Testing an open source web application

Developing and Testing an

open source web application

ELUNA 2014 Montreal

Michael Cummings, GWU

Page 2: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Agenda

Developing a customized library

catalog using API’s

User Interface Testing

with Phantomjs and Casperjs

Agenda

Page 3: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Development: Software

• The Django application framework

• Programming in Python on Ubuntu Linux

• Tested with Apache Bench

• Multiple API’s (OpenLibrary, Google, Summon,

OpenURL, Worldcat)

• Oracle SQL, Z39.50

• Phantomjs, Casperjs

Page 4: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Environment: Systems

Open Library API 360 Link APIGoogle Book API

Innovative

Interfaces

Sierra

SQLPlus query Z39.50 query

WRLC

Z39.50 query

All of these sources may be accessed in the background to retrieve title, holding,

status, and other information using API’s, Z39.50, or Oracle SQL.

LINK360

Book covers,

full text online

Journal Coverage date,

providerILL links for titles not

held in consortium

Holding, item status

& bibliographic detail

Holding, item status Holding, item status

Page 5: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Request: URL patterns

http://findit.library.gwu.edu/

item/3171945

item/3171945.json

item/3171945/marc.json

isbn/096139210X

issn/1448-4404

oclc/ocm46792617

The application responds to http requests.

...and will compile consortium holdings with their

real-time availability in a single view

Page 6: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Item response example

Page 7: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Request: OpenURL

OpenURL request example

http://findit.library.gwu.edu/item/2388242?ctx_ver=Z39.88-2004

&ctx_enc=info:ofi/enc:UTF-8

&rfr_id=info:sid/ProQ:abiglobal

&rft_val_fmt=info:ofi/fmt:kev:mtx:journal

&rft.genre=article&rft.jtitle=Library%20Hi%20Tech

&rft.atitle=Developing%20and%20completing%20a%20library%20mobile

%20technology%20survey%20to%20create%20a%20user-

centered%20mobile%20presence

&rft.au=Becker,%20Danielle%20Andre;Bonadie-Joseph,%20

Ingrid;Cain,%20Jonathan

&rft.aulast=Becker&rft.aufirst=Danielle

&rft.date=2013-10-01

&rft.volume=31&rft.issue=4&rft.spage=688&rft.isbn=&rft.btitle=

&rft.title=Library%20Hi%20Tech

&rft.issn=07378831#

360

Page 8: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014OpenURL example

Page 9: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API’s

• OpenLibrary covers

• OpenLibrary book

• Worldcat

• Google Books

• 360 Link*

• Summon Search*

* Requires subscription key

How to use API’s

Page 10: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: OpenLibrary Cover

Covers are displayed when they are available from

OpenLibrary’s covers API.

OpenLibrary cover API syntax

Example: http://covers.openlibrary.org/b/isbn/0521800900-M.jpg

See: http://openlibrary.org/dev/docs/api/covers

Page 11: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014

Example:

http://openlibrary.org/api/books?format=json&jscmd=data

&bibkeys=LCCN:11025443

API: OpenLibrary book

While processing the request we check the

OpenLibrary to see if a full text is available online.

If so, we generate a link to the full text.

Open Library Book API

See: http://openlibrary.org/dev/docs/api/books

Page 12: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: Worldcat

There was a search by

/oclc/37478754

No match found in the

consortium catalog;

We show results found in

Worldcat.

Page 13: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: Worldcat

Worldcat books API syntax

Example: http://www.worldcat.org/webservices/catalog/content/37478754

?wskey={your web services key}

Page 14: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: Google books

Google books API syntax

Example: https://www.googleapis.com/books/v1/volumes?q=lccn:12022977

&printType=books&maxResults=1&filter=full

Page 15: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: 360 Link

The 360 Link XML API provides

‘From – to’ date range and

Database provider name

From 2003 to present

Directory of Open Access Journals

Page 16: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: Summon Search

Page 17: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014API: Summon Search

Page 18: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Software repository

• The code is managed with git

• The ‘about Launchpad page’ at github is

http://gwu-libraries.github.io/launchpad/

• Available on github repository

https://github.com/gwu-libraries

• The code is available as open source

• Updates are released on a regular schedule

Page 19: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014UI Testing

User Interface Testingwith

Phantomjs and Casperjs

Page 20: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014PhantomJS

Page 21: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014PhantomJS script

Page 22: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014PhantomJS result

Page 23: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS

Page 24: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS test module

Page 25: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS with shell script

# OK run casper test

#casperjs test $1.js --includes=config.js --xunit=log-$1.xml

# Usage: sh issue.sh NNN

# Description: This script invokes casperjs test on a given file, NNN.js

# which should be in the current working directory.

# The target server url is defined in a separate configuration file

# which should be in the current working directory.

# The test results are displayed on screen.

# Test results are also saved in an xml file named log-NNN.xml

## where NNN is the issue number

Page 26: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS configuration

// Config_template

// Use this file to configure a server setting

// This file should be included when calling casperjs

// $1.js is the name of the test script file, e.g., 248.js

// Example:

// casperjs test $1.js --includes=config.js

// identity one SERVER path

// - - - - - - - - - - - - - - - - - - - - - - - - -

//

var SERVER='http://gwdev-cummings.wrlc.org';

Page 27: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS use case#1

Page 28: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS script#1

// m16_003 #555, 569

//

//

casper.test.begin('m16_003 #555, 569 GT location SCS not eligible for CLS',

2, function suite(test)

{

casper.echo("Test environment: "+SERVER);

var USECASE='/isbn/9781454816454';

var ENTITY=SERVER+USECASE;

casper.start(ENTITY, function() {

test.assertTextExists('Basic contract law' , 'page title Basic contract law... found');

test.assertTextDoesntExist('CLSReqForm?' , 'Verified there is no Request link.');

}).run(function() {

test.done();

});

});

Page 29: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS script#1 result

Page 30: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS log as XML

Page 31: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS use case #2

Page 32: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS script#2

// m16_001 #473

// this test employs xPath to locate an id

casper.test.begin('m16_001 #473 add google analytics to track tab click', 5, function

suite(test) {

casper.echo("Test environment: "+SERVER);

var USECASE='/item/2256589';

var ENTITY=SERVER+USECASE;

var x = require('casper').selectXPath;

casper.start(ENTITY, function() {

test.assertTextExists('Sociology and architectural design' , 'page title verified');

test.assertSelectorHasText('li', 'Availability');

test.assertExists('.nav', 'found a class named "nav"');

test.assertExists('.active', 'found a class named "active"');

test.assertExists(x('//*[@id="holdings"]'), 'xPath found the holdings div');

}).run(function() {

test.done();

});

});

Page 33: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS script#2 result

Page 34: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS use case#3

All formats (205)

.46 seconds

Page 35: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS script#3

// projects/casperscripts/caspertests/mcgill.js

//

casper.test.begin('mcgill', 3, function suite(test) {

casper.echo("Test environment: "+SERVER);

var USECASE="ticonderoga";

var SUFFIX="&qt=results_page&dblist=638&scope=2&oldscope=2&fq=";

var ENTITY=SERVER+USECASE+SUFFIX;

casper.echo("Test: "+ENTITY);

casper.start(ENTITY, function() {

test.assertTextExists('Fort Ticonderoga' , 'found title Fort Ticonderoga

in results');

test.assertTextExists('All Formats (205)' , 'Check whether still has 206

in all formats');

test.assertTextExists('.46 seconds' , 'Check whether it took .46 seconds');

}).run(function() {

test.done();

});

});

Page 36: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014CasperJS script #3 result

Page 37: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Demo

Page 38: ELUNA2014: Developing and Testing an open source web application

ELUNA 2014 Montreal Developing and testing an open source web application

ELUNA 2014Software: Learn more

http://phantomjs.orgAbout Phantomjs

https://casperjs.org

About Casperjs

Contact

Michael CummingsLibrary Systems Coordinator

The George Washington University Libraries

[email protected]