acammies
2018-04-16 2717b25869b619c2b9e1cee5c5e6be818e33cf59
Added in API pipeline testing
3 files added
1 files modified
25 ■■■■■ changed files
exercises/3-revenge-of-the-automated-testing/README.md 25 ●●●●● patch | view | raw | blame | history
exercises/images/exercise3/api-build-step.png patch | view | raw | blame | history
exercises/images/exercise3/api-fail-build.png patch | view | raw | blame | history
exercises/images/exercise3/api-post-build.png patch | view | raw | blame | history
exercises/3-revenge-of-the-automated-testing/README.md
@@ -90,7 +90,30 @@
2. Rerun the `dev-todolist-fe-build` job. It should have failed and not run any other builds. 
![new-gitlab-proj](../images/exercise3/jenkins-with-failing-build.png)
2. Undo the changes you made to the `ListOfTodos.spec.js` file, commit your code and rerun the build. This should trigger a full `build --> bake --> deploy`.
2. Undo the changes you made to the `ListOfTodos.spec.js` file, commit your code and rerun the build. This should trigger a full `build --> bake --> deploy` of `todolist-fe`.
2. We're now going to do the same for the api. Head to the `configure` panel of the `dev-todolist-api-build` job.
2. Add `scl enable rh-nodejs8 'npm run test:ci'` above `npm run build:ci`.
![new-gitlab-proj](../images/exercise3/api-build-step.png)
2. [break me up and add screenshots] Scroll to the `Post-build Actions` section and click `Add post-build action`. Select `Publish xUnit test result report`.
2. Click the `Add` button under `Publish xUnit test result report` and select `JUnit`. In the pattern field enter `reports/server/mocha/test-results.xml`. In the `Failed Tests Thresholds`  input box enter 0 under `Red Ball Total`. It should look a little something like this:
![new-gitlab-proj](../images/exercise3/api-post-build.png)
2. We're now going to deliberately fail a test again to ensure that `bake` and `deploy` jobs aren't triggered if any tests fail. Go to `todo.spec.js` in `/server/api/todo` and head to `line 35`. Replace `false` with `true`.
![new-gitlab-proj](../images/exercise3/api-fail-build.png)
2. Push this to Gitlab and rerun the build job.
```bash
$ git add .
$ git commit -m "Deliberately failed test to test the pipeline stops me deploying broken code"
$ git push
```
2. If successful this will fail the build and not run the `bake` or `deploy` jobs. Don't forget to remove the changes that you made to your tests!
<!-- 2. TODO - add tests to jenkins with screenshots etc. -->
exercises/images/exercise3/api-build-step.png
exercises/images/exercise3/api-fail-build.png
exercises/images/exercise3/api-post-build.png