From 999ef42e81849665e2b85d7777201a3cb8362d19 Mon Sep 17 00:00:00 2001 From: Christian Loitsch Date: Fri, 8 Jul 2016 15:45:53 +0200 Subject: [PATCH] doc: explain how to run tests --- bin/dart-petstore.sh | 3 ++ samples/client/petstore/dart/README.md | 58 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 samples/client/petstore/dart/README.md diff --git a/bin/dart-petstore.sh b/bin/dart-petstore.sh index 292af62977f..9f59540a5a7 100755 --- a/bin/dart-petstore.sh +++ b/bin/dart-petstore.sh @@ -28,4 +28,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart" +# for dart vm lib generation: +#ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart --additional-properties browserClient=false" + java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/dart/README.md b/samples/client/petstore/dart/README.md new file mode 100644 index 00000000000..17343a5c026 --- /dev/null +++ b/samples/client/petstore/dart/README.md @@ -0,0 +1,58 @@ +# To run these tests: + +Simply start the dart server: `pub serve` + +then open http://127.0.0.1:8080/tests.html + + +This already starts the tests. There is _NO_ feedback! + +Open the javascript / dart console of your browser to verify all tests +passed successfully. + +You should have the following output: +``` +Observatory listening at http://127.0.0.1:39067/ +unittest-suite-wait-for-done +GET http://petstore.swagger.io/v2/pet/957639 404 (Not Found) +GET http://petstore.swagger.io/v2/pet/525946 404 (Not Found) +GET http://petstore.swagger.io/v2/store/order/29756 404 (Not Found) +GET http://petstore.swagger.io/v2/user/Riddlem325 404 (Not Found) +PASS: Pet API adds a new pet and gets it by id +PASS: Pet API doesn't get non-existing pet by id +PASS: Pet API deletes existing pet by id +PASS: Pet API updates pet with form +PASS: Pet API updates existing pet +PASS: Pet API finds pets by status +PASS: Pet API finds pets by tag +PASS: Pet API uploads a pet image +PASS: Store API places an order and gets it by id +PASS: Store API deletes an order +PASS: Store API gets the store inventory +PASS: User API creates a user +PASS: User API creates users with list input +PASS: User API updates a user +PASS: User API deletes a user +PASS: User API logs a user in + +All 16 tests passed. +unittest-suite-success +``` + + +You may also run the tests in the dart vm. + +Either generate the test-package for a vm: +- change bin/dart-petstore.sh and uncomment the vm options line +- run bin/dart-petstore.sh + +or + +- in `lib/api_client.dart` change `new BrowserClient()` to `new Client()` +- in `lib/api.dart` remove the line `import 'package:http/browser_client.dart';` + + + +Then run `test/tests.dart`. + +Have fun. \ No newline at end of file