|
1 | | -# elstack-qa-monitoring |
2 | | -A demo of the elastic stack used for test monitoring |
| 1 | +# Monitor your automation test results with logstash, elastic search and kibana |
| 2 | + |
| 3 | +## Intro |
| 4 | +As QA you are always required to provide the best possible transparancy for your test automation. To always know what was tested when and with what result will benefit your stackholders as well as your team members. |
| 5 | +This demo project should show how the elastic stack can be use as a monitoring tool for automation test results. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +You need to have [docker](https://www.docker.com/) installed. |
| 10 | + |
| 11 | +To later send seed demo data as test results you can either use |
| 12 | +* [Postman](https://www.getpostman.com/), |
| 13 | +* [Newman](https://github.com/postmanlabs/newman#getting-started), |
| 14 | +* or [cURL](https://curl.haxx.se/) |
| 15 | + |
| 16 | +## How to run it |
| 17 | + |
| 18 | +git clone this repository |
| 19 | + |
| 20 | +Build and run the docker container |
| 21 | +``` |
| 22 | +docker build -t el-qa-mon . |
| 23 | +docker run -d --name qa-mon-elastic-stack -p 80:80 -p 8060:8060 -p 9200:9200 el-qa-mon |
| 24 | +``` |
| 25 | + |
| 26 | +## Explore Kibana and Logstash |
| 27 | + |
| 28 | +In your browser go to http://localhost:80 to see the Kibana frontend. (Not much to see yet without data) |
| 29 | + |
| 30 | +In your browser go to http://localhost:8060 to check if the logstash http input plugin is listening (it takes 2 mins to come up after the docker container has been started) |
| 31 | +Once it's running it'll show "ok". |
| 32 | + |
| 33 | +## Send seed data - demo test reports |
| 34 | +* Either open with Postman the collection QA-Monitoring-demo-seed-data.postman_collection.json and execute it. |
| 35 | +* or use Newman |
| 36 | +``` |
| 37 | +newman run QA-Monitoring-demo-seed-data.postman_collection.json |
| 38 | +``` |
| 39 | +* or send the following cURLs |
| 40 | +``` |
| 41 | +curl -X POST \ |
| 42 | + http://localhost:8060/ \ |
| 43 | + -H 'Cache-Control: no-cache' \ |
| 44 | + -H 'Content-Type: application/json' \ |
| 45 | + -H 'Postman-Token: 1b71cf1e-cb7f-44d2-87cd-0bb9d7754e6a' \ |
| 46 | + -d '{ |
| 47 | + "environment" : "Staging", |
| 48 | + "test_title" : "the-test-test", |
| 49 | + "result" : "PASS", |
| 50 | + "report" : "All test steps have passed." |
| 51 | + |
| 52 | +}' |
| 53 | +curl -X POST \ |
| 54 | + http://localhost:8060/ \ |
| 55 | + -H 'Cache-Control: no-cache' \ |
| 56 | + -H 'Content-Type: application/json' \ |
| 57 | + -H 'Postman-Token: 764d202c-5f1f-4068-9f39-2359e024e63d' \ |
| 58 | + -d '{ |
| 59 | + "environment" : "Production", |
| 60 | + "test_title" : "the-test-test", |
| 61 | + "result" : "PASS", |
| 62 | + "report" : "All test steps have passed." |
| 63 | + |
| 64 | +}' |
| 65 | +curl -X POST \ |
| 66 | + http://localhost:8060/ \ |
| 67 | + -H 'Cache-Control: no-cache' \ |
| 68 | + -H 'Content-Type: application/json' \ |
| 69 | + -H 'Postman-Token: d4eea417-95d8-49aa-bcd7-e3d75a499573' \ |
| 70 | + -d '{ |
| 71 | + "environment" : "Staging", |
| 72 | + "test_title" : "the-test-test", |
| 73 | + "result" : "FAIL", |
| 74 | + "report" : "Test failed on step 23\nCould not find UI object." |
| 75 | + |
| 76 | +}' |
| 77 | +``` |
| 78 | + |
| 79 | +## Find data in Kibana |
| 80 | + |
| 81 | +In your browser go to http://localhost:80 to see the Kibana frontend. |
| 82 | + |
| 83 | +1. Create an index pattern "*" |
| 84 | + |
| 85 | + |
| 86 | +2. Index creation step 2 - Time filter = @timestamp |
| 87 | + |
| 88 | + |
| 89 | +3. Go to discover and select the fields you are interested in to have a less convoluted view. |
| 90 | + |
| 91 | + |
| 92 | +4. Build some nice visualisations in the Visualize section |
| 93 | +I highly recommend using a [tutorial](https://www.digitalocean.com/community/tutorials/how-to-use-kibana-dashboards-and-visualizations) to get into this. |
| 94 | + |
| 95 | + |
| 96 | + |
0 commit comments