0.3.1 : composite test that returns a json raises issus only for "in progress"

Issue #495 resolved
Thomas Guiot created an issue

Hi,

we have some composite tests that use a common dictionary encoded in another composite test. We used the “composite” type instead of “composite string” when we developed this in 0.3.0.

Now we’re in 0.3.1, and there’s the new “composite string/json” type, but we haven’t changed our code. And submitting test is fine.

however, we’ve tried to lately to submit a test as “in progress” and now the app raises an error about our dictionary composite test, that says “please enter a number”. So I figured the composte is supposed to return a numerical value.

I thus saved another composite/json test with our dictionary and put this one in the test list instead of the composite one. Now it’s fine.

This all makes sense, except for the fact that we never saw any error or exception raised before, while from the start, we shouldn’t have used a composite test for returning a dictionary.

It might be good to solve this at the higher level, while creating the test itself. There could be a check that the type of the returned variable is numeric. If not, raise an error. This would be particularly helpful since we cannot now change our original composite test to composite/json because tests have already been performed with it.

Another possibility is to check while performing the test list and submitting it, not only for an “in progress” submission but any submission.

best

thomas

Comments (3)

  1. Randle Taylor

    Hi Thomas, yes, this is not ideal and the fact that it kind of worked before was mostly an accident.

    “It might be good to solve this at the higher level, while creating the test itself. There could be a check that the type of the returned variable is numeric. If not, raise an error.”

    Given that Python has dynamic types, I don’t think that’s possible without actually running the code. Checking the type of composite tests (I think that’s the only test type this is relevant) at the point of submission is a good idea though.

  2. Randle Taylor

    Don't allow composite tests to return values not in (number, None, "")

    Previously there was a bug/feature that allowed you to return strings/json in a composite test results. This will now result in a form validation error. If you were relying on this behaviour, you will need to switch to using a string composite/json test instead.

    Fixes issue #495

    → <<cset e1e0e93c8ede>>

  3. Log in to comment