L'interface graphique de l'outil de test collaboratif Ludwig.
Publishing this package through NPM will automatically build assets.
If you need to manually rebuild assets, run npm run prepublish
(or grunt build
if you have grunt-cli
installed).
The ludwig-ui
package exposes a single function that takes a Configuration object (defined below) and returns an Express app.
Once built, the content is best served with the following pattern to ensure frontend and backend routes match:
app.use(config.baseUrl, require('ludwig-ui')(config));
Where app
is an Express app.
A Ludwig configuration object has to contain the items below.
A good idea might be to store it in a JSON file and
require
that file.
The possible configuration values are:
scenarioTemplatePath
: path to the template that will be displayed for each test, as defined below. If relative, will be resolved against the file that sets up the server.baseUrl
: route on which the tests UI will be served.baseApiPath
: route on which theludwig-api
is served. Defaults tobaseUrl
.defaultDescription
: a text to fill the description field for tests.
Create an Angular template to display each test's results:
angular.module('ludwig').directive('scenario', function(config) {
return {
scope: { test: '=' },
template: 'Test: {{ test.scenario | json }}'
}
});
The config
dependency can be used to obtain the server configuration object on the frontend.
Each test will be passed a test
object containing the object that is stored in the database, as described in ludwig-api
.