Jump to content

Requesting advice on building Asset Tree & Analysis using TDD principles

Recommended Posts

Hi all,

I have built an analysis on an asset tree and an SDL program that is becoming widely used and important for my colleagues.

Usually, I would try to build such a tool using Test Driven Development. Years of experience of breaking things has taught me the benefits of this approach!

However, I am struggling to build a strategy here and was wondering if there are any recommendations for doing this with the spy library.


Link to comment
Share on other sites

  • Seeq Team

There are a few things that you are likely trying to verify whenever you make changes:

1. The asset tree contains the signals, conditions and scalars you expect.
2. The results of the calculations within the tree are what you expect.

For #1, I'd recommend creating a test (either in a notebook cell, or calling out to a separate .py file) that, after your tree has been pushed, utilizes `spy.search()` to "spot-check" important members of the tree that you expect to be there. You can use the `all_properties=True` flag if you'd like to check things like formulas.

For #2, I'd recommend creating another test that uses `spy.pull()` to spot-check calculations at hard-coded time intervals and ensure that you're seeing (roughly) the values you expect by looking at the min / max / avg of the returned data.

Although these are relatively "loose" tests, at least they will catch major regressions.

You can further implement TDD methodology whenever you fix a "bug" in your tree going forward: First add a test that "fails" and illustrates the problem, then fix it such that the test passes. Then make that test part of the suite that you run after updating the tree.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...