-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic setup teardown functionality #90
Comments
I think we could maybe add two functions setup() and teardown() in the beginning and end of the test function. So it could be something like this var noop = function (){};
var setupTest = noop;
var tearDownTest = noop;
function test(title, f, options) {
if (typeof TUNEUP_ONLY_RUN !== 'undefined') {
for (var i = 0; i < TUNEUP_ONLY_RUN.length; i++) {
if (new RegExp("^" + TUNEUP_ONLY_RUN[i] + "$").test(title)) {
break;
}
if (i == TUNEUP_ONLY_RUN.length -1) {
return;
}
}
}
if (!options) {
options = testCreateDefaultOptions();
}
target = UIATarget.localTarget();
application = target.frontMostApp();
UIALogger.logStart(title);
try {
setupTest();
f(target, application);
UIALogger.logPass(title);
tearDownTest();
}
catch (e) {
UIALogger.logError(e.toString());
if (options.logStackTrace) UIALogger.logError(e.stack);
if (options.logTree) target.logElementTree();
if (options.logTreeJSON) application.mainWindow().logElementTreeJSON();
if (options.screenCapture) target.captureScreenWithName(title + '-fail');
UIALogger.logFail(title);
}
} In documentation we could ask them to modify |
Hi @anoopknayak, |
I would like to add basic setup teardown functionality to the tests.
I have a working code which checks if there is a setup, teardown function is defined it calls them before the execution, which is similar to the other unit test frameworks.
Any thoughts on this ? If we have to support for suite level setup teardown what should be the preferred approach ?
The text was updated successfully, but these errors were encountered: