Integration Tests - WoWAnalyzer/WoWAnalyzer GitHub Wiki

Historically, we have used handwritten example logs with known outputs in our tests. This makes testing very laborious, however---especially when multiple modules interact to produce some of the more advanced output. This page describes how to use real logs in your tests.

Obtaining Test Logs

For a test to use a real log, it must be downloaded and saved in the repository. A script has been provided to do so. If you know the log ID, fight ID, and player ID (all obtainable from pulling up the log on the analyzer), then this command downloads and saves the log for later use:

node scripts/test-tools/download-log.js <desired-filename> <report-code> <fight-id> <player-id>

For example, this command downloads the example log for Protection Paladins:

node scripts/test-tools/download-log.js protection-paladin-example YngbjftpzhCAQFPL 1 1

Adding Integration (Consistency) Tests

The easiest kind of test to implement is the consistency test, which simply checks that the output hasn't changed and gives you a diff if it has. You can instrument your entire spec's CombatLogParser with the integrationTest tool. For example, this is the CombatLogParser.test.js in the Protection Paladin analyzer:

import integrationTest from 'parser/core/tests/integrationTest';
import CombatLogParser from './CombatLogParser';

describe('The Protection Paladin Analyzer', integrationTest(
  CombatLogParser, // <-- the uninstantiated CLP class to test
  'prot-pally-example', // <-- the filename of the log to test against
));

To recap, adding integration tests for your spec requires two steps:

  1. Downloading the log with download-log.js
  2. Adding the integrationTest to your CombatLogParser.test.js.

Property Tests

To be written

⚠️ **GitHub.com Fallback** ⚠️