-
Notifications
You must be signed in to change notification settings - Fork 213
Data-driven e2e tests #86
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
Conversation
Also, have people used type aliases with SerDe? serde::json maps structs to JSON objects, which makes sense, but what if I want to define a locale subtag as There is also the separate question of whether defining a locale subtag as |
Would it be useful to add serde serializer/deserializer as a feature for locale like zbraniecki/unic-locale@1450d0a ? |
components/e2etests/src/lib.rs
Outdated
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, PartialEq, Serialize, Deserialize)] | ||
enum TestOp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these go in a common shared crate instead? #88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see what you're saying. Yes, I agree. I left my comments in the issue.
Hmm, I think I understand, and yes that makes sense. IIUC, then that would make some of the E2E tests for Locale look like: JSON test data's input -> SerDe -> structured test data -> runner -> Locale API -> Locale, and then maybe have JSON test data's exp output -> SerDe -> Locale, and then compare. |
I'm not sure if we want serde to be merely a feature. It seems like a core piece of functionality when it comes to the data pipeline. |
I have a commit to make |
Pull Request Test Coverage Report for Build 19669b18f620d505037fc6863d92afb51bd011e4-PR-86
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"#; | ||
|
||
let act_test_output: LocaleTestOutput = | ||
serde_json::from_str(data).expect("cannot parse sample LocaleTestOutput"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use serde_json::json
macro - https://docs.serde.rs/serde_json/macro.json.html
Just revisiting this PR. Here's one model you could adopt: first, an IterableDataProvider that exports golden test data, and second, a unit test that checks that the current library output is consistent with the golden data. I expect that you can share most of the code between the golden data generator and the unit test framework. We should put our heads together and come up with a model that makes sense. For now, I'm going to switch this PR back to draft. |
This isn't complete (hence Draft PR), but I could use feedback, even on Rust basics (ex: code organization, module declarations).