Adding code to existing projects
TDK Feature
This is not supported in Testim's visual editor.
Adding TDK code to an existing project is rather simple and well supported.
As a separate sub-project
Since Testim tests are end-to-end and blackboxed it is preferred that you add those tests as a separate project in the same repository as your application under test. This essentially boils down to our getting started guide.
You might want to run code before/after your tests in order to start/stop your web application. You can pass Testim a configuration file with run hooks.
In the same project
If you wish - you can add TDK to an existing project. This makes sense only when the existing project is already a web project with Node.js and NPM.
You can run:
npm i @testim/testim-cli
In order to add the CLI as a dependency. Then add a sample test file to your project:
// e2e/test.js
const { it, go } = require('testim');
it('does end to end flow', async () => {
await go('http://example.com');
//
});
Then you can run the file with the Testim CLI similarly to tutorial:
$ npx testim -f ./e2e/test.js
Note: this will prompt you for your Testim Credentials (alternatively you can pass --project and --token directly to the Testim CLI).
Updated over 2 years ago