CSC/ECE 517 Fall 2015/oss 35156

From Expertiza_Wiki
Revision as of 16:28, 30 March 2017 by Zpdelong (talk | contribs) (→‎Testing Strategy)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

What is Syndicat?

Syndicat is a RSS reader written in Javascript. In its final form it will consist of three parts: a front-end UI, a back-end implemented in NodeJS, and a daemon that manipulates the back end for scheduled tasks (such as retrieving feeds.)


TinyTinyRSS is the project Syndicat is based on. Our goal is to refactor TinyTinyRSS’s code to a more modern format and to take advantage of the inherent performance improvements that can be had from asynchronous design. A secondary goal of the project is to provide an upgrade path to existing users of TinyTinyRSS. Ideally, they would be able to use the same database they were already using and just drop our new webapp on top of it to get started immediately. A tertiary goal of the project is to provide an upgrade path to TinyTinyRSS users so we can upgrade and refactor the database and other parts of the application and users will not lose data.

Our submission is a redesign of several models in the back-end. Written in Sequelize and tested using Mocha, there are a set of models that were already created (in the slow branch of the main fork) but these prototype models run extremely slowly.


Our contribution

The Ask

We were asked to refactor the models for Feed, FeedCategory, and Entry. See above for a commentary on the motivations and locations of old code.

Feed

This model can be found in /models/Feed.js. The tests for this model can be found in /tests/models/Feed_test.js. "RSS" (Rich Site Summary) is a format for delivering regularly changing web content. Many news-related sites, weblogs and other online publishers syndicate their content as an RSS Feed to whoever wants it, so that people can save a lot of time by skipping browsing the webpages, instead parse the feed and get the information they need. The relation between users and feeds is one-to-many, a feed also has urls(icon, site, etc.), and some time intervals(update, purge), and more specifically can refer to the source code in the repository.

We redesign feed model and exclude unnecessary attributes and class methods which degrades the performance. We also thoroughly tested Feed model with Mocha and Chai, the tests includes association tests(between user model and feed model), primary key uniqueness and auto-increment, and assertion of default value of missing attributes.

Feed Category

This model can be found in /models/FeedCategory.js. The tests for this model can be found in /tests/models/FeedCategory_test.js. Feed Categories are simply categories that can be applied to a particular feed. They have a label and are associated with a specific user. They can also be nested, a single feed can have may “child” feeds, all of which are tested for in the specified tests file.

Entry

This model can be found in /models/Entry.js. It’s corresponding tests can be found in /tests/models/Entry_test.js. Entries are simply a single entry from a feed. They contain the title, link, and content for an individual feed entry.

For the Entry model we tested with Mocha and chai. There are a total of 17 tests. The primary test consists of validating insertion of model into database and retrieving expected field values. We also tested to ensure that all required fields are present and contain valid values. The id which serves as the primary key for the model was tested to ensure uniqueness, and auto increment on insertion.


Setup

To set up this project, you will need a recent version of Node. Any from 4-7 should work. You will also need NPM, and it should handle installing any further dependencies related to Node. You will also need a version of make for your system. Any version should do, but it was tested extensively on OSX using cmake and on Linux using the version prepackaged with Ubuntu 16.04. You can clone the repository here [1]

Testing Strategy

The primary strategy for testing on this project is validating that our models were properly defined and insertion and retrieval were working as predicted. We also wanted to validate that performance for insertion and retrieval was as expected. In order to achieve this a connection with a test database was established where we would store different models and validate different things. We validated the following:

  • Models were inserted and retrieved properly from the database
  • Required fields needed to be present for a model insertion attempt
  • Valid foreign keys present
  • Valid field type values were provided before insertion attempt

Running tests

You can lint this project by typing `make lint` or simply `make`. You can run all tests by typing `make test`. There is not yet a working build for this project.


Next Steps

Good next steps for this project would be:

  • Finishing building the models in the TinyTinyRSS Schema
  • Buildout of Feed syncing code
  • Buildout of new UI