Skip to content
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

Create a data-driven test case framework #102

Open
dogweather opened this issue Apr 5, 2022 · 3 comments
Open

Create a data-driven test case framework #102

dogweather opened this issue Apr 5, 2022 · 3 comments
Assignees

Comments

@dogweather
Copy link
Member

dogweather commented Apr 5, 2022

The Idea: enable non-programmers to write test cases.

Context: The English version has its tests in rome_statute_test.py. Each language would need its own test file. Eventually these could be refactored together. But regardless, a programmer would need to do this work.

But we can allow people with good language skills to contribute if we completely remove the expected output from the test file and store it separately. Maybe in a spreadsheet or YAML file which the Python test file would read. This separate "database" would be 2-dimensional. One dimension are the tests such as "document title". The other dimension is the human languages such as English, Russian, etc.

See also:

@dogweather
Copy link
Member Author

dogweather commented Apr 5, 2022

Complications

Not all tests simply look for a string.

The second one above should make no difference. But the one that looks for a List[str] ... one idea is to re-write it to combine the two lines into one string.

@dogweather
Copy link
Member Author

dogweather commented Apr 5, 2022

Thoughts about the database:

  • Something that's committed into the Repo?
  • Some kind of schema-checking in CI? That'd be YAML or JSON. But a table form would be more intuitive, I think. Going with it, YAML could look like:
Tests:
  Title Works Correctly:
    French:  Statut de Rome de la Cour pénale internationale
    English: Rome Statute of the International Criminal Court

  Language Works Correctly:
    French:  fr-FR
    English: en-US

A bonus with YAML is that it supports values of list of strings.

The "schema checking" could be just a few lines of Python that attempts to read in the data. Or, it could be a JSON-schema.

  • It could be Python code using a list of NamedTuple or DataClass:
add(TestCase(
    test_name = "Title works correctly",
    french    = "Statut de Rome de la Cour pénale internationale",
    english   = "Rome Statute of the International Criminal Court"
))

add(TestCase(
    test_name = "Language Works Correctly",
    french    = "fr-FR",
    english   = "en-US"
))
  • Maybe an actual database? Because that'd do schema-checking as well, and with some front-end would show the contents in a table form.

@dogweather dogweather changed the title Create a no-code test case framework Create a data-driven no-code test case framework Apr 5, 2022
@dogweather
Copy link
Member Author

Idea for testing the tests:

Create a NullParser which simply returns blank strings. if a test case is written, every test should fail when run with this parser.

This wouldn't provide a lot of assurance, but it'd be some. (?)

@dogweather dogweather added good first issue Good for newcomers $$ labels Apr 5, 2022
@dogweather dogweather changed the title Create a data-driven no-code test case framework Create a data-driven test case framework Apr 5, 2022
@dogweather dogweather self-assigned this Apr 5, 2022
@dogweather dogweather removed good first issue Good for newcomers $$ labels Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant