|
| 1 | +# To run these tests: |
| 2 | + |
| 3 | +Simply start the dart server: `pub serve` |
| 4 | + |
| 5 | +then open http://127.0.0.1:8080/tests.html |
| 6 | + |
| 7 | + |
| 8 | +This already starts the tests. There is _NO_ feedback! |
| 9 | + |
| 10 | +Open the javascript / dart console of your browser to verify all tests |
| 11 | +passed successfully. |
| 12 | + |
| 13 | +You should have the following output: |
| 14 | +``` |
| 15 | +Observatory listening at http://127.0.0.1:39067/ |
| 16 | +unittest-suite-wait-for-done |
| 17 | +GET http://petstore.swagger.io/v2/pet/957639 404 (Not Found) |
| 18 | +GET http://petstore.swagger.io/v2/pet/525946 404 (Not Found) |
| 19 | +GET http://petstore.swagger.io/v2/store/order/29756 404 (Not Found) |
| 20 | +GET http://petstore.swagger.io/v2/user/Riddlem325 404 (Not Found) |
| 21 | +PASS: Pet API adds a new pet and gets it by id |
| 22 | +PASS: Pet API doesn't get non-existing pet by id |
| 23 | +PASS: Pet API deletes existing pet by id |
| 24 | +PASS: Pet API updates pet with form |
| 25 | +PASS: Pet API updates existing pet |
| 26 | +PASS: Pet API finds pets by status |
| 27 | +PASS: Pet API finds pets by tag |
| 28 | +PASS: Pet API uploads a pet image |
| 29 | +PASS: Store API places an order and gets it by id |
| 30 | +PASS: Store API deletes an order |
| 31 | +PASS: Store API gets the store inventory |
| 32 | +PASS: User API creates a user |
| 33 | +PASS: User API creates users with list input |
| 34 | +PASS: User API updates a user |
| 35 | +PASS: User API deletes a user |
| 36 | +PASS: User API logs a user in |
| 37 | +
|
| 38 | +All 16 tests passed. |
| 39 | +unittest-suite-success |
| 40 | +``` |
| 41 | + |
| 42 | + |
| 43 | +You may also run the tests in the dart vm. |
| 44 | + |
| 45 | +Either generate the test-package for a vm: |
| 46 | +- change bin/dart-petstore.sh and uncomment the vm options line |
| 47 | +- run bin/dart-petstore.sh |
| 48 | + |
| 49 | +or |
| 50 | + |
| 51 | +- in `lib/api_client.dart` change `new BrowserClient()` to `new Client()` |
| 52 | +- in `lib/api.dart` remove the line `import 'package:http/browser_client.dart';` |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +Then run `test/tests.dart`. |
| 57 | + |
| 58 | +Have fun. |
0 commit comments