Skip to content

BRJS Bundler Testing Strategy

sospirited edited this page Feb 6, 2014 · 6 revisions

Overview

By default, version 1.0 of BRJS will support the NodeJS code style.

However, it will also continue to support the 'namespaced-style' bundling behavior used by Caplin Trader 3 and BladeRunner

This page details the types of tests we will be writing to cover the various bundling concerns of BRJS.

Bundling 'node' level concerns

  • Aspect
  • Bladeset
  • Blade
  • Workbench
  • SDK BladeRunner library
  • SDK Thirdparty library
  • Application Thirdparty library
  • User Library
  • JS Patches directory
  • Unbundled-resources

Bundler Plugins

  • JS Namespaced style bundling
  • JS Node style bundling
  • CSS/Image bundling
  • XML bundling
  • Alias bundling

Further 'MODE' permutations

  • dev
  • prod

All the above can be combined with each other in a matrix for happy/unhappy path tests.

Testing Strategy Proposal

Separating out the tests into the various concerns that they have from a bundling perspective

Type A - Model/Bundle-level concerns (testing the 'engine' of the model)

  • Covers tests where, given a model/directory structure, assert the outcome of a bundle response
  • Covers model concerns regarding class references

Covers the following areas:

  • Bundling tests at the aspect level for various resources/sources (spec.bundling.aspect)
  • AspectTestPack level tests
  • BladesetTestPack level tests
  • BladeTestPack level tests
  • Workbench level tests
  • Useful logging tests

These tests will also cover edge cases where 'nodes' have bad references to blades, bladesets, sdk libs etc

Type B - Plugin level concerns

  • Interested in specific outputs from the plugin, given whichever bundleset (these tests take place AFTER we have validated what BRJS is going to bundle)
  • Mostly using the same node to test (probably Aspect level)

Plugins Tests to cover:

  • CompositeJsBundlerPluginTest.java
  • NamespacedJsBundlerPlugin.java
  • NodeJsBundlerPluginTest.java
  • XmlBundlerPluginTest.java
  • CssBundlerPluginTest.java
  • HtmlBundlerPluginTest.java
  • AliasBundlerPluginTest.java (although technically this is a type A test as it's a model concern)

Type C - API Model Tests

Tests which exercise the Java API we have to ascertain that given the various API calls on the model, that the correct bundlable resources and SourceModule values are returned. Like Type A, but interested at the Java API level.

libs/
| - jquery/ 
|   | - library.manifest (jquery.js and stuff.js) 
|   | - jquery.js 
|   | - stuff.js 
| - emitr/*
|   | - package.json
|   | - lib/
|   |   | - emitr1.js
|   |   | - emitr2.js
|   |   | - emitr3.js
| - br/
|   | - resources/
|   | - stuff.html
|   | - dir/
|   |   | - more-stuff.html
|   | - src/
|   |   | - Class1.js
|   |   | - Class2.js
|   |   | - pkg/
|   |   |   | - Class3.js

jquery is a BRJS thirdparty library

Source modules:

  • jquery (jquery.js & stuff.js)

Asset locations:

  • libs/jquery

emitr is a NodeJS library

Source modules:

  • emitr (emitr1.js & emitr2.js)
  • emitr/emitr1
  • emitr/emitr1
  • emitr/emitr3

Asset locations:

  • libs/emitr

br is a BRJS comformant library

Source modules:

  • br/Class1
  • br/Class2
  • br/pkg/Class3

Asset locations:

  • libs/br/resources
  • libs/br/src
  • libs/br/src/pkg
  • libs/br/src/pkg: libs/br/src
  • libs/br/src: libs/br/resources
Clone this wiki locally