Issue Details (XML | Word | Printable)

Key: CONTRIB-689
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Anthony Borrow
Reporter: Süreç Özcan
Votes: 0
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Non-core contributed modules

This is a new junit-question-type-plugin used in a quiz

Created: 28/Aug/08 05:27 PM   Updated: 04/Feb/09 05:46 AM
Return to search
Component/s: QuestionType: Sojunit
Affects Version/s: 1.9.1
Fix Version/s: None

File Attachments: 1. Text File fixes.patch.txt (4 kB)
2. Zip Archive sojunit 2008_10_10.zip (136 kB)
3. Zip Archive sojunit.zip (664 kB)
4. Zip Archive tracker_modules.zip (157 kB)

Environment:
I have been developing this on Linux, but it should work on Windows as well. I have tried it out on Firefox. It should definitely work on Moodle 1.9.2+ and with some changes described in help.txt-file it should work on 1.8.2+ (haven't tested it again though).

Database: MySQL
URL: http://moodle.org/mod/forum/discuss.php?d=102690#p460596
Participants: Anthony Borrow, Süreç Özcan and Tim Hunt
Security Level: None
Resolved date: 26/Oct/08
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
I have developed a new question-type called sojunit and want to share it with the community.

Tim Hunt suggested me putting it into the contrib-tracker in order to have the latest version to work on - while still debugging.
I want to thank Tim Hunt for his great help while implementing this question-type!

Note:
In the question-type there is a section that includes 'Source Code' and 'Selected Source Code'. This won't work without installing the Source-Code-question-type (see attachment).
I have been thinking about creating quizzes for computer science classes and created a new architecture for this purpose with following idea:
In computer science classes the usage of source codes is essential. Corresponding to a given Source-Code-question-type (which I am still working on) which simply displays a nicely syntax-highlighted source code you can create a following group of questions. So the idea is to separate the source code from the questions.
You may display a Source-Code with its corresponding questions on one page and make a page break before the next group while organizing the questions for a quiz.
You may reference from this single question e.g. to special code lines of code fragments of the displayed Source Code to ask questions. Be creative! wink
Maybe this feature matches more for for example the multichoice or regexp question types (which I will post soon). But I wanted to enable this also in this question type.

The following is a copy of my Readme.txt-file inside of my plugin - this way you can get an idea of what it does:

For computer science courses this question type allows a student to type source code for a given interface in Java.

In case the student response compiles the response gets graded automatically. This way the teacher can save time for corrections. Otherwise the teacher needs to grade the student response manually (in Results-tab -> Overview-tab -> click on a students attempt -> a questions "Make comment or override grade"-link) in order to give partial scores instead of none.

After the quiz has been taken the given source code can be seen nicely syntax-highlighted in the gradings. In the quizzes "Results->Item analysis" the compiler or execution output get displayed for each students attempt. This way you can get a better overview about the problems of your students in coding.

There is also a security manager which checks for non-proper student-responses. This way you should not worry about the student messing up the system.
General Quiz settings

It is required to leave the quiz in Adaptive Mode in order to get the compiler outputs displayed. In dependence of the Adaptive Mode used you need to leave "Penalty factor" to "0" in question-settings. This way the student won't get penalties subtracted when pressing the "Submit"-button in order to see if his/her code compiles.

For an "exam" and "exercise with grading" in quiz-options set e.g. "Attempts allowed" to "1 attempt" and "Grading method" to "Last attempt". This way the student can send in their final answer once using "Submit all and finish"-button but because of the Adaptive Mode they can "Submit" their code several times for compilation tests.

If several Junit-questions used in a quiz - for usability reasons it is recommended to put one question on a page at a time using "page breaks". It is also possible to put several Junit-questions on one page though.

The idea of which output to display at what time for which test type is as follows:

compiler output:
    * Types: exams, exercise-sheets with grading and exercises without grading:
       gets displayed always

execution output:
    * Types: exams, exercise-sheets with grading:
      Gets displayed allways after the quiz has been taken.
      Settings: In "Students may review" in quiz-options uncheck in "Immediately after the attempt" "Feedback" so that the execution output does not get displayed and the student does not get extracted or demotivated while taking an exam. In the "exercise-sheets with grading" the student should not get to see this until after the quiz.

    * Type: exercises without grading:
      Display "immediately after the attempt" to student.
      Settings: In "Students may review" in quiz-options in "Immediately after the attempt" leave "Feedback" selected in order to display also the execution output after an attempt to the student.


Given code for student:
Make sure the class and method names used in "Given code for student" are identical with the ones in your test class you want to use for this question. Otherwise the student response won't be executed and you will have to grade each student response manually.

The class names need to be non-public in order to allow several classes to be used in one JUnit-test-file.


Load test class:
In order to get an automatic grading for this question you need to create and implement a JUnit test-file. This file needs to match exactly the class and function names used in the source code written in the "Given code for student" HTML-editor.

The number of your implemented test cases need to match the number in "Default question grade". For each test case the student can get 1 point. If you have for example five test cases in your test-file you should set the "Default question grade" to "5". If the response of the student passes all test cases he/she will get 5 points out of 5. Otherwise each failed test case will subtract 1 point of the possible.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Tim Hunt added a comment - 28/Aug/08 05:45 PM
Anthony,

There have been a number of threads about this question type:

http://moodle.org/mod/forum/discuss.php?d=97086
http://moodle.org/mod/forum/discuss.php?d=102690

where you can see my opinions. In summary, I like it and I think it should be in contrib. However, I have lots of other things to do, so it would be great if you could work with Süreç to make that happen.


Tim Hunt added a comment - 29/Aug/08 01:19 PM
This patch does the following:

1. It makes a separate file question/type/sojunit/config.php to store the paths, so it is easier to update the rest of the questiontype code without overwriting the paths you have carefully set up in the past.

2. It makes a small change in save_question_options, to fix a notice I was getting when editing existing questions. (I think this may only make a difference on Postgres, but worth having.)

3. Changes the handling of blank responses in grade_responses, to fix the problem with submitting a multi-page quiz before you have been to every page.

4. It comments out the remove_dir($del_temp_folder); that for some reason was causing Submit all and finish to break for all but one question. Obviously this needs to be changed further because the temp files need to be cleaned up somehow.


Süreç Özcan added a comment - 10/Oct/08 08:12 PM - edited
The zip-folder "sojunit 2008_10_10.zip" is the last version of the JUnit-question type for now.

Anthony, is there a way to get this question type into the Moodle Modules and Plugins page?


Anthony Borrow added a comment - 26/Oct/08 08:42 AM
Süreç - Sorry, I got behind on emails and other things. I would be happy to add the code. I'm currently at the GSOC Mentor's summit and see several files. I'm guessing that the sojunit 2008_10_10.zip is the latest and the one that should be uploaded but I don't have time to read the whole thread at the moment and will come back later. Peace - Anthony

Anthony Borrow added a comment - 26/Oct/08 08:55 AM
moving to QuestionType: Sojunit component

Anthony Borrow added a comment - 26/Oct/08 08:59 AM
Marking this as resolved. I've uploaded the code to CVS and bumped Süreç Özcan's privileges in the tracker to manage any issues related to the QuestionType: Sojunit component. Just apply for CVS write access at http://moodle.org/cvs and then we should be finished. Let me know if you need anything or have any questions. Peace - Anthony

Süreç Özcan added a comment - 27/Oct/08 06:52 PM
Hi Anthony,
yes, 2008_10_10.zip is the correct one to upload.
I have just applied for CVS write access.
By doing this, will the question type be listed automatically in the "Moodle Modules and Plugins" page?
Thanks for your work!
Süreç

Anthony Borrow added a comment - 27/Oct/08 11:38 PM - edited
Süreç - I have approved your CVS access to:
contrib/plugins/question/type/sojunit

Just because the code is in CVS does not mean that it is automatically added. In fact there are several steps that I recommend to folks about how to share code. Please take a look at http://docs.moodle.org/en/Development:Guidelines_for_contributed_code to give yourself a bit of a checklist of things to do. You will want to make sure it is in Modules and Plugins and also that you have some documentation in Moodle Docs. Let me know if you have any questions and thanks again for all your work and willingness to share this code.

Peace - Anthony


Süreç Özcan added a comment - 27/Jan/09 11:52 PM
Hi Anthony,
thanks for your advice above!
Finally I have found time to work through the "guidelines for contributed code". While creating a new entry for "Modules and Plugins" it asks me to type in the link for the downloading link (in this case: Download for Moodle 1.9).
Which link do I have to type in there? How do I create this link?
Can I create a new entry at the moment leaving the download link blank and filling it later?
I would appreciate your help,
Süreç

Süreç Özcan added a comment - 28/Jan/09 01:03 AM
final version for 1.9.2

Süreç Özcan added a comment - 28/Jan/09 01:09 AM - edited
Hi Anthony,

I have created an entry in Plugins and Modules here: http://moodle.org/mod/data/view.php?rid=2104&page=187

I have created documentation and I think I have managed to link to the zip-file.

sojunit.zip is my final version for this question type. Can you put this zip-file into cvs or will I have to go through cvs-configuration for eclipse?

Thanks in advance,
Süreç


Anthony Borrow added a comment - 28/Jan/09 11:18 PM
Süreç - I am glad to hear that you have had an opportunity to read through the Guidelines for Contributed Code. Your question reminds me that I need to explain better how to determine the location of the automatically created zip file for a patch or plugin. The URL you are looking for is:

http://download.moodle.org/download.php/plugins/question/type/sojunit.zip

Any changes that you wish to make should be made by changing the files on the CVS server.Then every 24 hours the zip file on Moodle's download server will be updated to incorporate those changes. You may want to try making a small change to the README.txt file just to make sure your CVS access is working correctly.

I have approved the M&P entry and updated the download link to include the download.php which simply allows Moodle to collect statistics about the download. The link you had worked fine but was the direct link.

Let me know if you have any other questions and thanks for your work on sharing this question type with the Moodle community.

Peace - Anthony


Süreç Özcan added a comment - 29/Jan/09 11:59 PM
Hi Anthony,

thanks for your help! So far I have checked out the whole contrib-package from eclipse. I replaced my new junit-folder and wanted to try to commit a changed help-file. Following error was thrown:
The server reported an error while performing the "cvs commit" command. "commit" requires write access to the repository.

Do I have to configure ssh in order to commit anything? If yes I wanted to follow the instructions on http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-cvs-ssh2.htm but I didn't even know what to do on step 3: rsa or dsa key? I have tried out rsa key. Then on step 5 I don't know what to do - do you know? What does the text below step 6 mean? Should I be able to commit after step 6 or will I have to do something else?

Do you know what I could be missing?

Greetings,
Süreç


Süreç Özcan added a comment - 03/Feb/09 12:49 AM
Anthony - Another try today:

I think I have understood a little.
I have generated the ssh key-pair, put the public key onto my developers information through the "update my developer information" tab and saved the private key on my computer. Trying out a commit throws out the same error as above.

When I have changed my developer information it told me to wait for a prove from a developer to take account. I think I have to wait for a commit on my developer information and should try out again. Will I receive an email? If you think there is another reason for not being able to commit, please let me know!

Greetings, Süreç


Anthony Borrow added a comment - 03/Feb/09 09:19 AM
OK - I have approved the update and everything looked OK. In terms of your checkout, are you using the cvs.moodle.org server to checkout the code? I just want to make sure you did not get it anonymously from one of the mirrors. You should recieve an email that the update has been approved. So if you could give the commit another shot and let me know what message or error message you receive. Peace - Anthony

Süreç Özcan added a comment - 04/Feb/09 05:27 AM
Hi Anthony,
yeah - I think it has worked now! I think the last reason it didn't work was being anonymous. At least I can see what I have committed at http://cvs.moodle.org/contrib/plugins/question/type/sojunit/
First I have tried out a readme file and a picture. They seemed to be working so I have replaced the whole sojunit folder with my latest version.
Thank you very much for your help!
Süreç

Anthony Borrow added a comment - 04/Feb/09 05:46 AM
I noticed your commits and they are working fine. Keep in mind that usually in the commit comment we put a tracker issue number. It may seem like a pain to have to create an issue in the tracker for a fix but unless it really is trivial it is a good way to document things. Most commit comments begin with the tracker number and then that commit gets associated automatically with the issue. Also keep in mind, that with CVS you cannot really delete a file so if you create a file know that there will be a record of it permanently. You can remove it but the old history will still be there. I mention that just so that you are careful about saving files that may or may not be needed. It is one of the disadvantages/features of CVS. Let me know if you need anything else or have any questions. Peace - Anthony