Teammates: FeedbackSessionQuestionTypeTest.json: fix malformed question metadata

Created on 8 Feb 2018  路  5Comments  路  Source: TEAMMATES/teammates

Discovered while looking into https://github.com/TEAMMATES/teammates/issues/8415#issuecomment-364003271. The test data of one question is malformed (it's an MSQ question with msqChoices but numOfMcqChoices instead of numOfMsqChoices in the metadata):
https://github.com/TEAMMATES/teammates/blob/85faa7829f4edf19383b033e2d59825652b4b835/src/test/resources/data/FeedbackSessionQuestionTypeTest.json#L711

To investigate whether there are other similar cases, and why the deserialisation does not fail.

a-Testing help wanted p.Low

All 5 comments

Seems to me that no where does FeedbackQuestionAttributes::metaData get checked semantically when DataBundle is used.

I guess it's only used when constructing question details, e.g. when displaying feedback results.

I just investigated this and found that the jsonid : qn2InSession2InCourse1 which has the MSQ question is ~never~ used once but that is for submission and hence it never references numOfMsqChoices for checking and hence deserialization does not fail.

https://github.com/TEAMMATES/teammates/blob/85faa7829f4edf19383b033e2d59825652b4b835/src/test/resources/data/FeedbackSessionQuestionTypeTest.json#L706-L712

I think we can proceed to fix this and add some tests using it.

On searching where I could add a test for the question, I couldn't find any, cause the place where the question has been used is in InstructorFeedbackEditSaveActionTest.java where it doesn't require checking of numOfMsqChoices for submission.

The actual testAndExecuteProcess() test in InstructorFeedbackQuestionEditTest has been done very comprehensively with other msq question from the dataBundle. I can add a similar test for another question but it will be redundant and unnecessary.

@whipermr5 Do you have any suggestion where test regarding the msq question can be added?

I guess we can just do the simple fix numOfMcqChoices -> numOfMsqChoices then.

Was this page helpful?
0 / 5 - 0 ratings