-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easily adding objects/structures to test world #6
Comments
When I wrote it, I was thinking about placing these kind of methods in As a start, you have addRoomObject() which is quite generic but still more abstract than manipulating database directly. You can see some examples in world.tests.js but I don't think I ever used it for owned creeps or structures. If needed, it should be fairly easy (but quite time consuming) to implement more specific methods on top of it. The file grew up quite fast though, it may be better to split these functions into another one. I leave it to @pyrodogg for final decision. |
Thanks for the reply, I agree I don't mind implementing the specific methods. As it is I am already slated to write them for my own project because I feel it is necessary to write readable tests. Adding them to Just let me know your or @pyrodogg's preference. |
Its been on my mind to add more convenience functions for mocking room scenarios. Also, documentation and examples for how to use them. Putting it in something like |
Sounds good! I'll give it a try this weekend and open a PR with a first attempt. |
@brisberg if you manage to write readable tests using the mock server, I think it would be great if you published some examples of that, like I did with unit tests, using Jest. I can't really picture how these tests would look like and what's the benefit of using them, instead of unit tests. I'd love to see some concrete examples. |
@eduter Good idea, I'll definitely publish what I come up with. Just looked over your jest integration and it looks really good! I'll definitely make use of it for my unit testing. I am hoping that these tests will be broad enough that they give confidence that your AI can accomplish a very broad task. I am imagining things like: "Given an operating RCL4 Colony, Harvest energy from a remote room", "Given a storage full of energy, a set of creeps, and a handful of construction sites, Build all of the sites", "Given a spawn/extension set, a Creep, and a Storage full of energy, Fill all of the Spawns/Extensions". Hopefully these tests are mostly AI independent, so that you do not need to update them often, even with drastic changes to the AI. You can also set performance limits (CPU usage, Energy harvested / tick, number of ticks to distribute, etc) and ensure that your changes do not reduce efficiency in other aspects. Also Combat Scenarios would be very useful. See if your squads of units can defeat other squads of units, base can defend a drain attack, etc. These kinds of multi-tick engagements would be very difficult to Unit test effectively. |
First of all, thanks for taking over this project and moving it to the Screepers group. I was bummed that Integration testing didn't work out of the box a few months ago, so I am happy to have it back!
Anyways, my question is asking if there is an easy, out-of-the-box way to add Game Objects and Structures to the test world to set up realistic, repeatable scenarios.
From the samples, you can add a structure (a Spawn in this case) by directly executing a database update:
Not all of these fields are technically required (simply adding
type
,room
,x
,y
, anduser
will add a Spawn Structure with no storage), but all of these fields are required to create a Spawn structure that behaves exactly like a Spawn Structure on live.Is there a set of convenience methods on any of the Screeps projects to add structures/creeps as they exist on live?
If not, do you think this project would be a reasonable place to put such wrappers? That way they could be updated whenever the Screeps version is updated.
I am willing to put up a PR with these methods, if you guys think this would be a good place for them.
The text was updated successfully, but these errors were encountered: