Skip to content

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

Closed
wants to merge 8 commits into from
Closed

Data-driven e2e tests #86

wants to merge 8 commits into from

Conversation

echeran
Copy link
Contributor

@echeran echeran commented May 14, 2020

This isn't complete (hence Draft PR), but I could use feedback, even on Rust basics (ex: code organization, module declarations).

@echeran
Copy link
Contributor Author

echeran commented May 14, 2020

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 Vec<String>?

There is also the separate question of whether defining a locale subtag as Vec<String> is the right choice -- also open to discussion on that, etc.

@zbraniecki
Copy link
Member

Would it be useful to add serde serializer/deserializer as a feature for locale like zbraniecki/unic-locale@1450d0a ?

@sffc sffc self-requested a review May 14, 2020 17:37
use serde::{Deserialize, Serialize};

#[derive(Debug, PartialEq, Serialize, Deserialize)]
enum TestOp {
Copy link
Member

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

Copy link
Contributor Author

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.

@echeran
Copy link
Contributor Author

echeran commented May 14, 2020

Would it be useful to add serde serializer/deserializer as a feature for locale like zbraniecki/unic-locale@1450d0a ?

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.

@sffc
Copy link
Member

sffc commented May 14, 2020

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.

@echeran
Copy link
Contributor Author

echeran commented Jun 18, 2020

I have a commit to make Locale serializable just like LanguageIdentifier (shameless mimicking for now). In the process of doing that, I noticed that some of the tests are brittle -- testing error conditions require use the exact error message. If we have specific error types in the future, then that can be made less brittle.

@coveralls
Copy link

coveralls commented Jun 18, 2020

Pull Request Test Coverage Report for Build 19669b18f620d505037fc6863d92afb51bd011e4-PR-86

  • 194 of 203 (95.57%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+3.2%) to 90.423%

Changes Missing Coverage Covered Lines Changed/Added Lines %
components/e2etests/src/lib.rs 14 16 87.5%
components/locale/src/serde/locale.rs 51 54 94.44%
components/e2etests/src/runner/runner.rs 42 46 91.3%
Totals Coverage Status
Change from base Build 24f4b5d15940198185fe7cf8fc0e90b80b9583b5: 3.2%
Covered Lines: 897
Relevant Lines: 992

💛 - Coveralls

@echeran echeran marked this pull request as ready for review June 25, 2020 03:46
@echeran echeran requested review from nciric, zbraniecki and a team as code owners June 25, 2020 03:46
@sffc sffc self-requested a review July 10, 2020 17:20
@echeran echeran changed the title WIP data-driven e2e tests Data-driven e2e tests Jul 10, 2020
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be tied in with #177. This will let you load the test data from the new /data top-level directory. I don't think we should move forward on this PR until I have a solution to #177 checked in. I will try to get that ASAP to unblock your work.

"#;

let act_test_output: LocaleTestOutput =
serde_json::from_str(data).expect("cannot parse sample LocaleTestOutput");
Copy link
Member

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

@sffc
Copy link
Member

sffc commented Aug 28, 2020

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.

@sffc sffc marked this pull request as draft August 28, 2020 05:43
@sffc sffc added the discuss Discuss at a future ICU4X-SC meeting label Sep 3, 2020
@echeran echeran mentioned this pull request Sep 3, 2020
@echeran echeran linked an issue Sep 3, 2020 that may be closed by this pull request
@sffc sffc added the waiting-on-author PRs waiting for action from the author for >7 days label Sep 16, 2020
@sffc sffc removed the discuss Discuss at a future ICU4X-SC meeting label Oct 30, 2020
Base automatically changed from master to main March 4, 2021 18:40
@echeran echeran closed this Jul 29, 2021
@echeran echeran deleted the e2etests branch June 8, 2023 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author PRs waiting for action from the author for >7 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

End-to-end testing
5 participants