telegram-bot
telegram-bot copied to clipboard
Add integration test to ease continuous integration
The development of this library is horribly slow; not due to the developers but due to me maintaining it. The problem is that merging code every few months requires me to re-understand the whole library and Telegram-API in order to decide if the changes are valid. This is the reason for why this library is bit-rotting :disappointed:
To finally ease development, I suggest to add a very good integration test. This test should test all features of the API with a real bot, if somehow possible. I want to be able to merge immediately if the code looks clean and all tests passed.
Any comments? What do you think @knsd @dns2utf8 @neuschaefer @rockneurotiko?
I like the idea, but I am not sure how we can do it.
Can we redesign the lib as a whole? To make the structure simpler and increase the maintainability?
If we rewrite the lib, can we do it with TDD?
CC: @knsd @neuschaefer @rockneurotiko
Can we redesign the lib as a whole? To make the structure simpler and increase the maintainability?
I'm not sure if this library needs a rewrite -- the API is OK I guess. But maybe we as developer need said rewrite to boost motivation and maintainability (as you said) :stuck_out_tongue:
So I would be OK with rewriting everything, but I'd like to do it in a rather short time (e.g. not over a whole month) and together with someone else. I do have time to work on this from Saturday (or maybe Monday) on for a few weeks at least.
So I'd love to rewrite this with someone else. Do you, @dns2utf8, want to help? What about your time? Apparently we live in the same time zone, which eases development :wink:
I'll help with any rewrite and/or tests all I can (If I don't answer in some time don't worry, this month I'm in a village almost without internet).
I've never made any tests in Rust, how is the best way to go? The language test attribute? Some library? (I found stainless and https://github.com/kriomant/mockers/ but both needs nightly).
I've never made any tests in Rust, how is the best way to go? The language test attribute?
I think language test attribute should be enough since Api
is quite simple and immutable.
Can we redesign the lib as a whole?
Want to propose new api for messages, something like:
let chat = api.chat(chat_id); // Or from input message
chat.message("Any message").web_page_preview(false).reply_to(message).send();
chat.action(ChatAction::Typing).send();
...
So there are two changes:
- Populate
Chat
type with a hidden fieldtoken
, so we doesn't need to to passchat_id
in everysend_*
function. Not sure about it. Same things withMessage
. - Make
Message
type a builder, so we doesn't need to pass fourNone
s and remember whichNone
is what.
Also we can migrate to serde
from rustc-serialize
.
The language test attribute?
Yes, I'd like to go with the built in feature, which is more than enough for simple to medium-sized test-suites. We might want to think about another solution for the integration test (which will perform real network-IO), but I think Rust's default testing system is fine for that, too.
Also we can migrate to
serde
fromrustc-serialize
.
Not sure about this. I've never worked with serde
, I want to avoid nightly, want to use the easy of macros and I'm skeptical about syntex
...
Want to propose new api for messages, something like:
I'm fine with a new API, but I'd say we shouldn't discuss it here. First I want to discuss how we discuss those topics and work on it.
So first, [1] I'd like to know from you nice people if you want to help ...
- discuss API design
- doing the first big chunk of programming
- help improving it once the biggest chunk of functionality is implemented
For (1.) I'd propose another media of communication than GitHub. Transparency is awesome, but sometimes a quick back and forth discussion is needed IMO. I guess we all have a Telegram account, so that would be a sensible choice :wink:
Secondly, [2] please tell me when you can spare some time. Just on the weekend? The whole week, but weekends? As I already mentioned, I am available from Monday on (the whole week) for a few weeks.
Looking forward to work with you!
I would like to help :smiley:
The bot using this lib has a handwritten parser which I developed with the integrated test suite: https://github.com/coredump-ch/coredumpbot/blob/master/src/user_input_compiler.rs#L383
I made a Telegram group, if this is ok with everybody: https://telegram.me/joinchat/AvMyLj-VkTBoU8DAcv-JeA
[1]
- yes
- yes
- in september or later
[2] currently I am preparing myself for my exams in august so I should not invest more than a day :wink: But that day can be any in the next 5 days, including the rest of today.