CSC/ECE 517 Spring 2018/E1813 Test Menu Items Model: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 9: Line 9:
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.
The TDD sequence can be can be summarized in following steps.
The TDD sequence can be can be summarized in following steps.
<br></br>
1. <b>Add a Test</b>
1. <b>Add a Test</b>
<br></br>
Advantages of using TDD:
Advantages of using TDD:
*Narrowing Problem Focus
*Narrowing Problem Focus

Revision as of 23:39, 24 March 2018

This wiki page is for the description of changes made under E1813 OSS Assignment for Spring 2018, CSC/ECE 517.

Introduction

Expertiza

Expertiza is an open source web application based on Ruby on Rails framework, supported by the National Science Foundation. It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.

Test Driven-Development

Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: Requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. This is opposed to software development that allows software to be added that is not proven to meet requirements. Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right. The TDD sequence can be can be summarized in following steps.

1. Add a Test

Advantages of using TDD:

  • Narrowing Problem Focus
  • Tidier Code
  • Not worrying about dependencies
  • Easier refactoring
  • Better Test coverage and fewer bugs

Unit Testing

Unit Testing is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.

Problem Statement

This project is to write unit tests using rspec for menu_items.rb model. It is to test all class and instance methods used in this file. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.

Files Involved

The files to be understood and created are:

1. app/models/menu_items.rb

2. spec/models/menu_items_spec.rb

Team Members

Students who collaborated to work on this problem statement are :

1. Harish Pullagurla ( hpullag@ncsu.edu )

2. Kalyan Ghosh (kghosh@ncsu.edu)

3. Sandeep Rajendran(srajend@ncsu.edu)

Plan Of Work

The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. For this purposes different sub tasks involved

1. Setting up the Expertiza environment

2. Understand the functionality of model file in menu_items.rb

3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id

4. Creating dummy entries for testing different functionalities.

5. Writing testing conditions for different functions and cross checking with the expected outputs.

Implementation Steps

Expertiza Environment Setup

.ovm image was used

Functionality of Menu Items model

<Write about what different functions in menu items do > < try to give an intuitive understanding about it >

Test Entries Creation

<Write about how to create test entries and what all attributes we created >

Testing Conditions

<Write about the equality conditions being tested in each function >

Conclusion and Learning Outcomes

<Write about coverage increase > and also include what we learnt by doing the project

References

  1. Expertiza on GitHub
  2. GitHub Project Repository Fork
  3. The live Expertiza website
  4. Expertiza project documentation wiki
  5. Rspec Documentation