L2. Coding with requirements


Assignment 2. Working with requirements and tests

  • Terms: Individual assignment, no code may be copied from other students or any other source. Grade assigned from requirement fullfillment, the more requirements fullfilled the better grade.
  • Starts: When the assignment is published on the course web.
  • Deadline: See deadline document
  • Examination: Automatic assessment of completed requirements.
  • Feedback: Help is given during tutoring time and slack.

After completing the assignment the student should have...

  • ...worked with tools and servers
  • ...read and successfully implemented requirements with PHP
  • ...tested those requirements carefully.
  • ...created an application with functionality similar to the example application.


Examiner sets the degree using the following:

  • Requirement fulfillment through manual and automated testing

The set of minimum requirements for approved is:

  • Solution has been submitted before the deadline
  • Code should be available on a public git repository.
  • The application must be deployed on a public web server, the server must be available to the examiner for the rest of the course.
  • The Assignment is done individually! You are not allowed to copy or take solutions from others.
  • No code is copied from others, student has worked alone
  • No external code except the code given in task, no libraries are used
  • No javascript is used
  • HTML follows web standards
  • Application can be tested with the automated test application.
  • Code has one single page (index.php)
  • Your solution will/may be shared with other students after the deadline.
  • The application is written in PHP.

Requirement fulfillment

  • The more testcases that are fullfilled, the better
    • 50%->59% Grade E
    • 60%->69% Grade D
    • 70%->84% Grade C
    • 85%->95% Grade B
    • 95%->100% Grade A
  • Test-cases should be manually and automatically testable (using the test application).
  • The application is well tested even outside of the explicit tests
  • Application works as the example implementation

Task 1. Explore requirements, example application, and test-cases.

The requirements of the application consists of four use-cases.

Use Cases

For each of the use-cases there are a number of test-cases. The test cases are given in the following format.

  • Input, steps to do. In some cases another test-case, if so do the input steps of that test-case.
  • Output, things you should observe or not observe if the test-case is successful.
  • Image, an image of the result after Input steps are done.

Testing of the application requires two different browsers, and a tool to manipulate cookies, like "firebug".

Test Cases, These are the test cases for the corresponding use-cases

Example Solution. This is an example solution for assignment 2. It fulfills all the test-cases above, if your solution works as this you are ok.

Automated tests Application. This is an automated acceptance test system to speed up the testing process.

Task 2. Copy the code and get your servers set up.

Now its time to implement the requirements using use-cases and test-cases.

Get the startup code

The assignment will be tested using a Automated unit test application. To allow this we will first copy the interface application for that project on GitHub.

  • Download https://github.com/dntoll/1dv610/blob/master/assignments/A2_resources/startup.zip
  • On your GitHub account, create a new repository
  • Clone that repository
  • Add the content of the zip file to your repository, commit and push to origin master
    • Unzip the files into your repository
    • git add -A .
    • git commit -m "first commit"
    • git push origin master
  • Browse your files on github You should see the files from startup.zip

Get the startup code running locally

You are going to develop locally and make "releases" to a public server. This means you need to setup both a local server and a public server.

  • Startup a local PHP server and configure it
  • browse to local server(For example http://localhost:8080/ ) and check that you see the correct output with a header of "Assignment 2".
  • Test Application With startup code. This is an deployment of the startup code, it does not fulfill more than 5% of the requirements. When you deploy the startup code it should look like this.

Make a release to a public web server

In order to hand in this project you must have a public web-server that is online 24-7. There are many possible solutions

  • you could host yourself if you have a public IP-adress and wants to keep a server up and running
  • you could buy hosting from a web-hotel
  • you could use a free hosting such as http://www.000webhost.com/ (PHP 5.2)

Test your release

  • Transfer your files to the server, for example by FTP, SFTP, or git.
  • Browse to the server and make sure you see the output of the PHP-scripts
  • Go to http://csquiz.lnu.se:25083/index.php and enter your server adress with your user-id
    • press Check
    • you should get a "Estimated score on assignment: X%." and a LOT of errors

Task 3. Implement the requirements.

  • while (you have requirements to implement)
    • Implement a requirement
    • Test locally using the manual test-cases
    • Commit and push to repository
  • Release code to server

Assignment submission

Välkommen till CoursePress

en utav Linnéuniversitets lärplattformar. Som inloggad student kan du kommunicera, hålla koll på dina kurser och mycket mer. Du som är gäst kan nå de flesta kurser och dess innehåll utan att logga in.

Läs mer lärplattformar vid Linnéuniversitetet


För att logga in behöver du ett studentkonto vid Linnéuniversitet.

Läs mer om att hämta ut studentkonto

Inloggning LNU