Personal tools
You are here: Home > CS 342 Blog Entries > Folder with blog entries for Cooper Walbrun > Blog Entry for Week Ending April 21

Blog Entry for Week Ending April 21

by Walbrun, Cooper last modified Apr 21, 2017 04:01 PM

This week, I went through the difficult task of implementing unit tests for my gamification features (which I added last week). I wrote tests that check to see whether badges are rewarded for various triggers, e.g. when a user creates his/her first page, he/she will get the "Author" badge. All of those tests were rather easy to implement (1 per content type). However, when it came time to test the experience and level implementation of our add-on, I ran into a lot of problems.

The first difficulty came in the fact that in order to properly test our add-on on an integration level, we must branch out on GitHub and push commits repeatedly to the branch so Travis can build our add-on and run the tests on it. This is a very long process because each commit will build for about 4 minutes, meaning in order to diagnose an error, I had to wait 4 minutes. After I had sorted out all of the logical flaws in my test code, I found out that the experience values were not being written to the Zope database at all when I wanted them to be. As it turns out, this is due to the way our unit tests are implemented: each creates a "sandbox" Zope Portal object in which it creates users and content objects (including badges). For reasons I still cannot explain, modifying custom member properties (e.g. experience, level) has no permanence in the sandbox, therefore whenever I checked to see if a particular user's experience had increased for creating a new content object, the value had never changed. It seems that whatever values the custom properties are initialized to in the database are the values they remain indefinitely. Eventually, I physically went into my Plone site with the add-on enabled and created some content, just to see if my experience would increase, and sure enough it did. Thus, for the time being, I have removed any experience/level-related unit tests from our source, as they seem to throw false negatives due to the nature of the sandbox and not the actual implementation.

In other news, Levi managed to get our badge display features working. (Finally! That issue had been in our tracker for over a month!) We have arranged as a group -- Cory, Levi, and myself -- to collectively work on completing the final component of our add-on: "pretty" displays of a user's badges, level, and experience. This arrangement is taking place on the coming Wednesday, though with the way things have gone so far, I doubt we will finish all in one night. Still, I am optimistic about our progress and despite the apparent simplicity of what we have implemented until now, there are a lot of underlying complexities. Every day that we work with Plone, we get better at it. Anyways, as of right now, badges are displayed for a given user; our remaining task is to assign default graphics to preset badge types (e.g. the "Author" badge I presented earlier), as well as work in the custom user properties I created for the add-on's gamification.

by Walbrun, Cooper last modified Apr 21, 2017 04:01 PM
CS emphasis accredited by

ABET logo

Contact Us

Computer Science Department
UW Oshkosh
800 Algoma Blvd.
Oshkosh, WI 54901

Phone: (920) 424-2068
Fax: (920) 424-0045
Building: Halsey Science Hall

Rooms: 229 (general office), 221 (David Furcy, chair)

Email: Send mail to chair at