Example data field code, and tests replaying activity scenarios.

Hello,

I made a data field in 2021, to help me with ultra-distance cycling. I didn't really know what I was doing, but it seemed to work pretty well. Like most people I found the dev process pretty clunky, even if the code itself is easy.

In the last few days a user contacted me with a query about inaccurate data (it's now 2025). That prompted me to learn a bit more, rewrite the app, and republish it as a new version. It's been an informative process, though I readily accept I still don't know very much Slight smile

Anyway, I have made my repo public. In particular I found writing and using tests hard to figure out. So hopefully this can help someone else.

https://github.com/thisdougb/SinceStopped

What I was able to do was take scenarios where my data field appeared to be incorrect, and generate Activity.info data to replay those scenarios as tests. So I can generate 5 minutes of movement, then 2 minutes of stationary, etc. Because I am supplying the time as a value, the tests run near instantly.

Once I figured out how to use tests to replay scenarios it made the dev process quicker because I didn't have to rely on the simulator. I still don't really understand how to get the simulator to function predictably.

  • I think a literal replay would give the opportunity to use the device to record various test scenarios. Which would be pretty useful.

    For sure. (But then you have the thorny issue of how events like timer start/stop, lap, next workout step, and next multisport leg should be handled....)