@@ -13,12 +13,16 @@ This repository contains code of a NodeJS based microservice. The developer of t
### Prerequisites ###
* Install [NodeJS v8](https://nodejs.org/en/) LTS on your system
* Open a CLI and change into the folder
* Open a CLI (**C**ommand-**L**ine **I**nterface) and change into the folder
* Run `npm install`
### Where to start? ###
As we're developing our application with NodeJS, we're using [npm](https://docs.npmjs.com/) as a **task runner**. Have a look at the file [package.json's](https://git.informatik.uni-leipzig.de/meissner/fixit_students/blob/master/package.json) script section to obtain an overview of available commands. Some are:
As we're developing our application with NodeJS, we're using [npm](https://docs.npmjs.com/) as a **task runner**. Have a look at the file [package.json's](https://git.informatik.uni-leipzig.de/meissner/fixit_students/blob/master/package.json) script section to obtain an overview of available commands.
**Head over to the file `TODO.md` and do the listed tasks.**
Some of these are:
```
# Run syntax check and lint your code
...
...
@@ -51,4 +55,4 @@ You want to **checkout how this service works in production**? Simply start the
---
Continuous Integration (CI) and possibly Continuous Delivery (CD) is currently setup by using Gitlab CI. Have a look at the [Gitlab CI Documentation](https://docs.gitlab.com/ce/ci/) to gain an overview about CI and CD and to learn about possibilities.
A widely known alternative i the (for OSS projects) free to use web application [Travis-CI](https://travis-ci.org/). This is the default CI for Github and many more resource hosting services.
A widely known alternative to Gitlab CI is the (for OSS projects) free to use web application [Travis-CI](https://travis-ci.org/). This is the default CI for Github and many more resource hosting services.
This is a list of tasks you should solve in order to understand software tests, service APIs and Continuous Integration (CI).
This is a list of tasks to complete in order to understand software tests, service APIs, Continuous Integration (CI) and Continous Delivery (CD).
### Precondition ###
### Prerequisites ###
Fork the Repository to your own user account at Github.
Fork the Repository to your own user account at Gitlab.
Log into [https://travis-ci.org](https://travis-ci.org) and enable your Repository for Continuous Integration. Exchange the badge URLs in the README and push these changes to Github. Wait for CI to finish and have a look at the output.
Go to the newly forked project and enable the CI runner "SWT pcai042 runner" at "Settings>CI/CD>Runner Setting>Specific Runners". Exchange the URLs of the first badge in the README and push these changes to Gitlab (see "Settings>CI/CD>General Pipeline Settings" for correct URLs). Wait for CI to finish and have a look at the job output.
### 1 ###
Execute the following statement at the command-line and have a look at the output. Fix Errors!
It's easier to fullfill the listed tasks if you clone the repository to your computer. See `README.md` for instructions to setup the development environment.
Remember to push your changes after you've fulfilled each task.
### Task 1 ###
Execute the following statement at the CLI and have a look at the output. Try to fix any issues!
`npm run lint`
### 2 ####
### Task 2 ####
Execute the following statement at the command-line and have a look at the output. Fix failing tests!
Execute the following statement at the CLI and have a look at the output. Try to fix all failing tests!
`npm run test:integration`
**Hint**: use `npm start` to run the application and head over to [http://localhost:3000/documentation](http://localhost:3000/documentation) in order to have a look at the API description.
**Hint**: use `npm start` to run the application and head over to [http://localhost:3000/documentation](http://localhost:3000/documentation) in order to have a look at the API description and to test the API.
Add this step to the file `.travis.yml`, so CI executes tests automatically.
Add this step to the file `.gitlab-ci.yml`. CI will execute tests automatically in the future.
### 3 ###
### Task 3 ###
Add tests for *delete basket items* in a separate file by copying `tests/integration_PostNewItem.js`. Subsequently modify these tests.
Have a look at the code coverage by executing `npm run coverage`. Head to the `coverage` folder and search for the file `index.html`. Open it in a browser and dig through the code coverage report.
### 4 ###
### Task 4 ###
Have a look at the code coverage by executing `npm run coverage`. Head to the `coverage` folder and search for the file `index.html`. Open it in a browser and dig through the code coverage report.
Count your current Lines of Code (LOC) by executing `npm run countLOC:details`.
### 5 ###
### Task 5 ###
Count your current Lines of Code (LOC) by executing `npm run countLOC:details` and look at the file
Add tests for "delete basket items" in a separate file by copying `tests/integration_PostNewItem.js`. Subsequently modify these tests.
### Solutions ###
Each of the recent commits introduced new bugs to the code. By going through these commits, you'll be able to see what has changed and what is the correct solution, except for task #3.
See branch "solution" at the [repository](https://git.informatik.uni-leipzig.de/meissner/fixit_students).