This guide is for coding a test using the Testim Dev Kit. The feature has not been made generally available in Testim production or the trial version.
The Dev Kit enables programmers to create or edit tests in code. There are several advantages to creating or editing your test in code. First, you can store and manage your tests as code next to your application code. When you make a change to your application that might affect your test, you can quickly edit the test, keeping them in sync. Second, some people just think and work better when they can see the logical structure of a test as written in code. Finally, there are some things that you can do with your IDE such as search, refactoring, code complete, that are difficult to do in a visual editor.
Even if you want to write tests in code, we recommend that you start by recording a test with the Testim Chrome Extension so that you leverage Testim's AI-based Smart Locators. You can then export it to code where you can edit it in your IDE. This way, you get the benefits of fast authoring and AI-based stability with the flexibility to edit and store as code.
The Dev Kit includes:
- Example tests to help you get started
- Robust root cause analysis tools to help you troubleshoot
- Export recorded tests to code to jumpstart your coding and to leverage Smart Locators for maximum stability. They also help eliminate vendor lock-in.
Testim also includes an advanced recorder that uses AI to identify hundreds of attributes for each visual element, weigh them and assign a Smart Locator that helps keep your tests stable even when code changes. Recorded tests can be exported to code where they can be edited in your IDE. You can store them next to your application code in your Version Control System (e.g. GitHub) and keep them in sync with branches, commits, PRs and releases.
The Dev Kit offers similar functionality to tools like Selenium, Puppeteer and Cypress with some key differences aimed at improving authoring speed, stability, user experience, and debuggability.
Install testim with NPM:
npm install -g @testim/testim-cli
Initialize a new project:
testim init 'my-awesome-project'
Link the project to your Testim account:
The credentials can be found under the ⚙️settings page in your Testim account
Edit your tests:
Run tests directly in VSCode or WebStorm with the built-in support or use:
The output of the code will also include a URL containing live results which you can use to gain more insight into your tests.
Updated 3 months ago