promptfoo
promptfoo copied to clipboard
Is there a way to see the time taken to run the entire test cases of a test suite from the UI?
Or could it be added via hooks? e.g.
const { logger } = require('../helper/logger');
async function extensionHook(hookName, context) {
if (hookName === 'beforeAll') {
context.suite.startTime = new Date();
} else if (hookName === 'afterAll') {
const endTime = new Date();
context.suite.totalTestTime = endTime - context.suite.startTime;
logger.info(`Total tests: ${context.results.length}`);
logger.info(`Total test time: ${context.suite.totalTestTime} ms`);
// Perform any necessary teardown or reporting
}
}
module.exports = extensionHook;
I don't think we display this anywhere, but in theory we have the timing of every test case so could add it up. If you want an informal timer I usually just run with time promptfoo eval on the command line. Doing it with hooks is a clever idea