Skip to content

The reset contract runs for 115 of the 202 indicators #9726

Description

@mkzung

Expected Behavior

The contracts in CommonIndicatorTests<T> hold for every indicator in the assembly.

Actual Behavior

They run only for an indicator that has a test class deriving from CommonIndicatorTests<T>. There are 115 such classes, covering 115 of the 202 concrete indicators. The other 87 are never asked.

Six reset defects were merged this month out of that gap: #9686, #9687, #9688, #9694, #9705 and #9706. IntradayVwap had no test class, so nothing checked that a reset returned it to its default state.

Tests/Indicators/IndicatorTests.cs:163 already drives a test by reflection over the assembly, but it builds with Activator.CreateInstance(indicator, new object[] { 10 }), which reaches 52 of the 202, and passes over the rest with a bare continue inside one test method. Its own Log.Trace prints the reach.

Potential Solution

A fixture that constructs every indicator by reflection and asserts the reset contract on it: feed a series, reset, feed the same series, and compare the values and the ready flag; then assert the default state with TestHelper.AssertIndicatorIsInDefaultState. A TestCaseSource gives each indicator its own case, so a failure names it, and Assert.Ignore with a reason makes anything unreachable visible to the runner.

Worth running at more than one period. SuperTrend assigned its previous close on the early return it takes while the average true range warms up, so at any period above one that return fires first and hides it.

Reproducing the Problem

202  concrete public indicators in QuantConnect.Indicators
115  are named by a CommonIndicatorTests subclass
 87  are not

System Information

master, net10.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions