Skip to content

Import Tests From Source Code

Import end-to-end, API, or unit tests into Testomat.io. Import keeps a large test base manageable. Once imported, you can search across every test, map tests to specifications or Jira tickets, plan new test cases, and get reports.

Importing automated tests into Testomat.io makes your work visible to the whole team. It also keeps a large test base manageable. Once imported, you can search across every test, map tests to specifications or Jira tickets, plan new test cases, and get reports.

First, you need to have a project. Follow Start With Testomat.io to create it. Choose the project type - see Classical vs BDD.

This guide covers Classical projects. To import a BDD project, see Import Tests From Cucumber.

Testomat.io - Select type of project

When you create the project, add your repository URL (GitHub, GitLab, BitBucket, or self-hosted) and point it at the directory where your tests live. Testomat.io links each test case to its source.

Now import the source code into your project.

Testomat.io - Import test cases

  1. Go to the Tests tab.
  2. In the (...) menu, click Import automated tests.
  3. In the Import Project from Source Code menu, select:
  • your framework.
  • your language.
  • your operating system.
  1. Copy the command provided.

Testomat.io - Copy instructions

Finally, run the command you copied:

  1. Open a terminal.
  2. Go to your tests folder.
  3. Run a command.
  4. Reopen the project, your tests appear with their folders and files.

Testomat.io - Execute command in terminal, automated tests found and sent

A report of how many tests were found means the import worked. If you do not see that message, the default settings may not match your setup. The usual causes are a different file-naming format or the wrong import directory.

Every imported test is marked Automated. Open a test to see its code and a link to its repository. If the link is wrong, update the repository URL in project settings.

Testomat.io keeps one file as one suite. When a file has nested describe blocks, they are flattened on import. Each nested block becomes its own suite at the same level, named after its parent.

Testomat.io - Explain the block

This is expected behavior: it shows every test at once, so you do not expand block after block, and it fits the way most projects are organized - one file, one suite.

For example, this test file:

describe('ActionResult', () => {
it('holds result actions', () => {
// ...
});
describe('isMatchedBy', () => {
it('should match exact URL', () => {
// ...
});
});
});

Imported in Testomat.io like this:

ActionResult (action-result.test.ts)
- holds result actions
ActionResult > isMatchedBy (action-result.test.ts)
- should match exact URL

The inner isMatchedBy block is not nested under ActionResult - it becomes a separate suite named ActionResult > isMatchedBy. This format stays the same by design, so there is nothing to fix if you see it.

Testomat.io - Imported test in the Tests section in Testomat.io

You need to add the tag to the tests in your own code to import them. In code, the tag starts with @, for example @manual.

Then you can use the same tag in the import settings. To import an automated test as manual:

  1. Open Import Project from Source Code.
  2. Set your project parameters.
  3. Click Additional Settings.
  4. Enter the tag name (without the @).
  5. Run the command in your project.
  6. Click Finish.

On the Tests page, the tagged tests are listed as manual.

Testomat.io - Add tag name to import settings

  • Auto-Import - re-import on each commit to keep the project in sync with your code.
  • Run Reports - get detailed reports on each test execution.
  • Test Plans Overview - plan new tests, then automate from there.