SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


I’m currently in process of selecting a charting framework. I’ve been evaluating SciChart for some time now and have a few questions.
One of them is how can I automate chart operations: both commands and querying. Do you expose some kind of API for End-To-End tests? I’m specifically interested in this kind of tests.

P.S. Alternatively is there any screenshot-comparing API over the charts? That could be a decisive alternative as well.

  • You must to post comments

Hi Gennady,

Thank you for your enquiry and for considering SciChart!

This question was asked recently here: SciChart automated testing for WPF. I don’t want to repeat too much from that question, save to say that:

  1. SciChart itself doesn’t have any UIAutomation testing endpoints because … it is largely based on Bitmaps and Textures and custom controls. It’s near impossible to automate non standard elements (elements that are not ComboBox, TextBox etc..). Even the big testing providers like Ranorex and Telerik Test Studio cannot automate controls other than the standard ones as it is a limitation in WPF UIAutomation itself…

  2. SciChart internally uses a screenshot comparison mechanism to test our charts. This is proprietary code but it is included in the source code edition of SciChart (source code customers will get it) and published on our Private Github Repo for Source-code customers.

Here are some examples of the sorts of tests we do.

public class SciChartSurface_ExportToBitmapSource_Tests : SciChartVisualBaseTest
    [TestCase(RenderSurfaceType.HighSpeed, "xynumeric_oneseries_exporttobitmap_hs.png")]
    [TestCase(RenderSurfaceType.HighQuality, "xynumeric_oneseries_exporttobitmap_hq.png")]        
    [TestCase(RenderSurfaceType.Vector, "xynumeric_oneseries_exporttobitmap_xaml.png")]
    [TestCase(RenderSurfaceType.DirectX, "xynumeric_oneseries_exporttobitmap_dx.png")] 
    public void WhenOneSeries_NumericXAxisYAxis_ShouldExportToBitmapSource(RenderSurfaceType rsType, string resourceName)
        DoTestBody(1, rsType, resourceName, (scs) =>
            // Modify the SciChartSurface for the test here. 
            var data1 = base.GetSinewave(1.0, 0.0, 100, 5);
            var xyData = new XyDataSeries<double, double>();
            xyData.Append(data1.XValues, data1.YValues);
            Scs.RenderableSeries.Add(new FastLineRenderableSeries() { Stroke = Colors.Red, DataSeries = xyData, StrokeThickness = 5 });

            // With XAxis, YAxis numeric 
            Scs.XAxis = new NumericAxis() { GrowBy = new DoubleRange(0.05, 0.05) };
            Scs.YAxis = new NumericAxis() { GrowBy = new DoubleRange(0.05, 0.05)};
        }, false);

Here’s an example of an expectation image.

enter image description here

The Visual Test generates an image from the same parameters and compares vs. the expected. When the tolerance of the image exceeds a certain amount, the test fails and it outputs the Expected, Actual, Diff to a predefined folder. Our teamcity build is setup to pick these up and output as Artifacts so you can see straight away what has failed and why.

For anyone with Source-Code Licenses who has signed up to our Github Repo

Links to the Visual Tests framework are as follows. NOTE Link will be HTTP404 if you are not a source-code customer.

  1. SciChartVisualTestBase and VisualTestBase – handles Export, Comparison and assertions
  2. SciChartSurface_ExportToBitmapSource_VisualTests – example test cases for various parameters. We test all sorts of things, including Series, Annotations, Styles, MVVM APIs etc…
  3. Expectations – expected images predefined for the tests.

It’s not the most amazingly reliable way of testing, however it certainly bites us when something is wrong, for instance, if an Annotation stops working, or a series type renders incorrectly, we know about it.

Finally, SciChart overall has some 6,200 unit, integration and visual tests , the vast majority of which are programmatic Unit/Integration tests. Our library is well architected, well structured and mockable (uses interfaces allowing mocking). We publish all our tests with the source-code version of SciChart so you can see if our stuff works and also get a notification if it doesn’t if you change the source 🙂

enter image description here

Hope this helps!

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.