1# Running Tests {#sec-running-nixos-tests}
2
3You can run tests using `nix-build`. For example, to run the test
4[`login.nix`](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/login.nix),
5you just do:
6
7```ShellSession
8$ nix-build '<nixpkgs/nixos/tests/login.nix>'
9```
10
11or, if you don't want to rely on `NIX_PATH`:
12
13```ShellSession
14$ cd /my/nixpkgs/nixos/tests
15$ nix-build login.nix
16…
17running the VM test script
18machine: QEMU running (pid 8841)
19…
206 out of 6 tests succeeded
21```
22
23After building/downloading all required dependencies, this will perform
24a build that starts a QEMU/KVM virtual machine containing a NixOS
25system. The virtual machine mounts the Nix store of the host; this makes
26VM creation very fast, as no disk image needs to be created. Afterwards,
27you can view a pretty-printed log of the test:
28
29```ShellSession
30$ firefox result/log.html
31```