Skip to content

Instantly share code, notes, and snippets.

@mikealexander
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikealexander/9824e676aa0c8a603967 to your computer and use it in GitHub Desktop.
Save mikealexander/9824e676aa0c8a603967 to your computer and use it in GitHub Desktop.
Node script for generating boring user stories for ExamCloud
var fs = require('fs');
fs.writeFile('output.txt', '', function(){ });
var write = function(o) {
fs.appendFile('output.txt', (o + '\n'), function (err) {
if (err) {
log.info("Problem appending to file.");
}
});
}
var constraints = [
{
name: "room",
types: [
{
name: "Request-Only Rooms",
type: "ListEditor",
entityType: "room"
},
{
name: "Specific Period Use",
type: "ContainerListEditor",
entityType: "period",
constraintType: ""
}
]
},
{
name: "room",
types: [
{
name: "Order",
type: "ContainerListEditor",
entityType: "exam",
constraintType: ""
},
{
name: "Different Period Use",
type: "ContainerListEditor",
entityType: "exam",
constraintType: ""
},
{
name: "Same Period Use",
type: "ContainerListEditor",
entityType: "exam",
constraintType: ""
},
{
name: "Same Room Use",
type: "ContainerListEditor",
entityType: "exam",
constraintType: ""
},
{
name: "Exclusive Room Use",
type: "ContainerListEditor",
entityType: "exam",
constraintType: ""
},
{
name: "Specific Room Use",
type: "ContainerListEditor",
entity: "exam",
constraintType: "room"
}
]
},
{
name: "period",
types: [
{
name: "Period Weightings",
type: "Weightings",
entity: "period"
},
{
name: "Least Perferable Periods",
type: "ContainerListEditor",
entity: "period",
constraintType: "day"
}
]
},
{
name: "Alt. Reqs",
types: [
{
name: "Extra Time",
type: "ContainerListEditor",
entity: "student",
constraintType: "AltReq"
},
{
name: "Rest Break per Hour",
type: "ContainerListEditor",
entity: "student",
constraintType: "AltReq"
},
{
name: "Start Time",
type: "ContainerListEditor",
entity: "student",
constraintType: "AltReq"
},
{
name: "Start Time",
type: "ContainerListEditor",
entity: "student",
constraintType: "AltReq"
}
]
},
{
name: "invigilator",
types: [
{
name: "Assign Invigilator",
type: "ListEditor",
entity: "invigilator"
},
{
name: "Invigilator Avoidance",
type: "ContainerListEditor",
entity: "exam",
constraintType: "invigilator"
},
{
name: "No Alternative Requirements",
type: "ListEditor",
entity: "invigilator"
},
{
name: "Invigilator Period Avoidance",
type: "ContainerListEditor",
entity: "period",
constraintType: "invigilator"
},
{
name: "Can be Lead Invigilator",
type: "ListEditor",
entity: "invigilator"
}
]
}
];
for(var i = 0; i < constraints.length; i++) {
write("As a user, I should be able to view the " + constraints[i].name + " constraints overview page, displaying all the currently applied " + constraints[i].name + " constraints. \n\n");
for(var j = 0; j < constraints[i].types.length; j++) {
var item = constraints[i].types[j];
write("As a user on the " + item.name + " editor, I should see all the available " + item.entityType + "s in tabular format.");
if (item.type === "ListEditor") {
write("As a user on the " + item.name + " editor I should be able to toggle a " + item.entityType + " on/off by clicking it.");
} else if (item.type === "ContainerListEditor") {
write("As a user on the " + item.name + " editor, I should be able to create a new constraint collection, and name it.");
if (item.constraintType === "") {
write("As a user on the " + item.name + "editor, I should be able to edit a constraint collection's name.");
} else {
write("As a user on the " + item.name + "editor, I should be able to edit a constraint collection's name and " + item.constraintType);
}
write("As a user on the " + item.name + " editor, I should be able to select a constraint collection, and the " + item.entityType + "s applied to it should be highlighted.");
write("As a user on the " + item.name + " editor, with a constraint collection selected, I should be able to toggle a " + item.entityType + "'s inclusion by clicking on it.");
write("As a user on the " + item.name + " editor, I should be able to delete constraint collections.")
} else if (item.type === "Weightings") {
write("As a user on the " + item.name + " editor, I should be able to control the weighting of a particular period using a slider control.")
}
write('\n');
}
write('\n\n ');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment