Files
novelWriter/tests
Veronica Berglyd Olsen bb1a778277 Merge Novel Layouts (#837)
* Merge novel layouts and simplify the Tokenizer class
* Fix core tests
* Delete auto-layout code
* Remove no longer needed item layouts
* Remove references to deleted item layouts in test
* Make some minor changes to Tokenizer class and update tests
* Update test reference files
* Update sample project
* Fix a few issues with the Tokenizer
* Centre some text in the sample documents
* Make some minor changes to how new projects are generated
* Add support for New Page and VSpace commands to the Tokenizer
* Remove Title and Page layouts and add codes for page break and vertical space
* Add document layout and fix some issues in index class with new title formats
* Update tests and reference files
* Bump the project file version and fix a minor issue in items class
* Update tests and test coverage
* Clean up some warnings and issues in tests
2021-08-02 23:44:35 +02:00
..
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-08-02 23:44:35 +02:00
2021-04-23 21:54:03 +02:00
2021-07-04 17:57:54 +02:00

novelWriter Tests

The test suite uses PyTest for testing.

Dependencies

  • python3-pytest for the basic framework (required)
  • python3-pytestqt for Qt support (required)
  • python3-pytest-cov for code coverage reports (optional)
  • python3-pytest-xvfb for headless tests (optional)

HowTo

Basic Usage

To run all tests, type:

pytest-3 -v

The -v switch enables verbose mode, with one test per line. For a more compact view, omit this switch.

Headless

To run tests in headless mode, either use the Qt offscreen mode:

export QT_QPA_PLATFORM=offscreen

or run with xvfb:

xvfb-run pytest-3 -v

Test Coverage

To add test coverage, run the following:

pytest-3 -v --cov=nw --cov-report=html

The --cov-report switch generates an html report, omit it to print a coverage summary to the terminal. The html coverage report will be available in the htmlcov folder.

Test Markers (Categories)

To run with specific test markers, add the -m switch:

pytest-3 -v -m core

Available markers are:

  • base for unit tests covering the non-gui classes of the nw folder..
  • core for unit tests covering the classes in the nw/core folder.
  • gui for unit and integrations tests covering the classes in the nw/gui folder.

You can filter tests further with the -k switch, all the way down to a single test. You can for instance run only dialog tests with -k testDlg or tools with -k testTool.