---
id: intro
title: Intro
sidebar_label: Introduction
---

[Svelte Testing Library on GitHub][gh]

[gh]: https://github.com/testing-library/svelte-testing-library

```bash npm2yarn
npm install --save-dev @testing-library/svelte
```

> This library is built on top of [`dom-testing-library`][dom-testing-library]
> which is where most of the logic behind the queries is.

[dom-testing-library]: ../dom-testing-library/intro.mdx

## The Problem

You want to write tests for your Svelte components so that they avoid including
implementation details, and are maintainable in the long run.

## This Solution

The Svelte Testing Library is a very lightweight solution for testing Svelte
components. It provides light utility functions on top of `svelte`, in a way
that encourages better testing practices. Its primary guiding principle is:

> [The more your tests resemble the way your software is used, the more
> confidence they can give you.][testing-library-blurb]

So rather than dealing with instances of rendered Svelte components, your tests
will work with actual DOM nodes. See the
[`dom-testing-library`][dom-solution-explainer] for a more in-depth explanation.

[testing-library-blurb]:
  https://twitter.com/kentcdodds/status/977018512689455106
[dom-solution-explainer]: ../dom-testing-library/intro.mdx#this-solution

**What this library is not**:

1.  A test runner or framework.
2.  Specific to a testing framework.
