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

Capture global scope #405

Open
pdawyndt opened this issue Jul 26, 2023 · 1 comment
Open

Capture global scope #405

pdawyndt opened this issue Jul 26, 2023 · 1 comment
Labels
core Core of TESTed (including test suite specification) dsl

Comments

@pdawyndt
Copy link
Contributor

pdawyndt commented Jul 26, 2023

TESTed could capture the global scope before and after running a test (main call, expression, statement) such that this global scope could also be evaluated by a custom oracle (the default behavior being that any global scope is accepted; no expected value can be set and no built-in oracle is needed). The global scope could be represented as a mapping of variable names (string) onto strongly typed objects (maybe also the storage location of the objects must be captured to allow testing identity). Custom oracles receive the state of the global scope before and after running the test, so the two can be compared, for example to see that no new global variables have been defined as a side-effect of running a test, that glopbal variables have not been modified, or that global variables have been created or modified).

@pdawyndt
Copy link
Contributor Author

pdawyndt commented Jul 26, 2023

Think about how this could enable simple exercise like:

The variable x is assigned an array [1, 2, 3, 4]. Add the integer 5 (int) to the end of this array.

So a possible test suite might look like:

- statement: 'x = [1, 2, 3, 4]'  # setup: storage location of list must be captured in global scope
- <execute submisson>            # insert submission at this position in test script
- expression: 'x'                # test script
  return: [1, 2, 3, 4, 5]
  oracle: 'custom'               # checks both equality and identity of list

This requires some form of setup (code executed before the submission itself is executed). It also requires a way to explicitly put the submission at some place in the test script (by default it is automatically inserted as the first statement/expressoin in the script). This may also serve some other purposes:

  • embed the submission in skeleton code (i.e. add a prefix and or suffix to the submission) provided in the test suite (e.g. student is only asked to complete a commando line: prefix is given, submission is used as a prefix; so-called fill-in-the-gaps exercise; we could also allow to modify the submission in a programmed way, as we do with test oracles)
  • allow multi-part submissions where individual parts can be inserted, executed and tested separately

@pdawyndt pdawyndt added dsl core Core of TESTed (including test suite specification) labels Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core of TESTed (including test suite specification) dsl
Projects
None yet
Development

No branches or pull requests

1 participant