seaotter
v1.0.4
Published
<h1>Sea Otter</h1>
Downloads
3
Readme
npm i -D seaotter
- Get the accompanying vscode extension for a superior experience (not yet published)
const config = {
testDirectory: "/Absolute/Path/To/Test/Directory",
fastFail: true,
random: false,
tests: ["asyncTest.js"],
};
Adjust the testDirectory to the absolute path of your test directory. Specify the tests you want to run in the tests array. Set fastFail to true for quicker test termination on the first failure, and toggle random to shuffle test execution order.
otter.explore`Create new User ${ MyTag }`(() => {
otter.test`Login with valid credentials`(async () => {
await simulateLogin("validUsername", "validPassword");
await verifyOnHomePage();
});
test`Login with invalid credentials`(async () => {
await simulateLogin(
"invalidUsername",
"invalidPassword"
);
const a = 10;
const b = 20;
const c = 5;
expect`${a} toEqual ${a}`;
expect`${a} toBeGreaterThan ${b}`;
expect`${c} toBeLessThan ${a}`;
});
import { otter } from "seaotter";
import config from "./config";
otter.wadeIn(config);
(async function () {
await otter.dive();
})();
This method offers a straightforward way to run your tests.
If you prefer more control over the test execution process, you can have the otter cruise through a generator. This approach allows you to perform additional processing after each test and before the next one begins. The generator provides valuable metadata about each test so that you can customize your workflow!
(async function () {
for await (const test of otter.cruise()) {
// do something with metadata
}
})();
If running the former way, and running tests in quiet mode you can listen for the failure events
otter.on('testFailure', (error) => {
doSomething(error)
});
export TEST_DIR="/absolute/path/to/test/dir"
# This is where your dive/cruise methods are used
export TEST_ENTRY="/absolute/path/to/entry"
otter <test(s)>