EDCD / EDMarketConnector

Downloads commodity market and other station data from the game Elite: Dangerous for use with all popular online and offline trading tools.
GNU General Public License v2.0
988 stars 155 forks source link

Sequences of API events to store for testing #661

Open A-UNDERSCORE-D opened 4 years ago

A-UNDERSCORE-D commented 4 years ago

See the testing card for more information

The intent here is to be read left to right, entering indents, each additional indent is a step in a sequence

Supercruise

Docked at stations

Engineers

Synthesis

Normal space

Fleet Carriers

Mining

Athanasius commented 4 years ago

Engineers, effects on materials, not to mention modules after blueprints applied/upgraded. Edit: added to sequence above

Athanasius commented 4 years ago

Synthesis: Affect on materials, jump range, possibly ammo (do we track that?). Edit: added to sequence above

Athanasius commented 4 years ago

Fleet Carriers: Donate to tritium supply, possibly other events. Edit: added to sequence above

Athanasius commented 4 years ago

Mining (materials and cargo in, limpets out). Edit: added to sequence above

A-UNDERSCORE-D commented 4 years ago

we get the info, I dont think we specifically track it though

Athanasius commented 4 years ago

we get the info, I dont think we specifically track it though

Out of paranoia we should ensure it's included in the inputs then, so as to ensure it doesn't affect state/outputs.

A-UNDERSCORE-D commented 4 years ago

Oh yeah thats very much needed, Ive been trying to figure out how best to go about it, Im sitting on just copying lines out of the file as I/we do stuff, probably using chat messages as markers

Athanasius commented 4 years ago

Maybe this already occurred to you.

We could have test(s) driven by changing the configured journal directory and then copying/writing to files in the custom location to simply drive all the normal data code paths. Then inspect the internal state to see if it's as expected. This should definitely work for testing monitor.py as an import from it exposes everything. I'm less sure about how well it will work for the internal plugins due to how they're loaded.

Yes, I know this isn't how tests are meant to work, but right now we need to get something hooked up so we can test any refactored code for regressions. Then we can do the refactor to have small-as-possible functions that can be tested properly.

A-UNDERSCORE-D commented 4 years ago

I did not consider that particular method, though we could do that. Was thinking more just replacing monitor with a mocked version to avoid having to deal with threads and such (not to mention adding the complexity of the file watcher stuff), and calling the journal event callback directly.

Both work, Im not sure what would be easier/cleaner

Athanasius commented 4 years ago

I might have a play with it next week latest.

Indeed it would entail an extra module for import in EDMarketConnector.py and a thread in that extra module.

I'd probably make the loading and use of it depend on a command-line argument passed in, which could also be utilised to tell the testing module which test to run.

Easiest there is for it to be the name of a directory with standard file(s) that define the testing. Whether that's one standard input filename and one standard "state should be this line by line" file or something else yet to be determined.