-
Notifications
You must be signed in to change notification settings - Fork 14
Adding test cases for autorest.testserver
-
The test server swagger should be in
{your repo}./node_modules/@microsoft.azure/autorest.testserver/swagger. If there is no such directory in your repo, runnpm install. -
Script
scripts/testserver_codegen.pyis used to regenerate test code for each check-in. To add a new test case, you just need to add the name swagger file (exclude the file extension '.json' to this array in the script.files=( "head" "body-file" "report" "xms-error-responses" "body-integer") -
The generated files will be under a new directory
{your repo}/test/integration/generated -
Drag the folder containing the Package.swift of the generated code to the XCode workspace under AutorestSwiftTest to create dependency.
-
In the
AutorestSwiftTesttarget Build Phases, add the new test package in the sectionLink Binary with Libraries. -
Open the
Package.swiftfile for AutorestSwift and add a line todependenciesfor the new test case. It will look like:.package(name: "AutoRestHeadTest", path: "./test/integration/generated/head/"), -
Also in
Package.swift, add the name of the test package to the.testTargetdependencies forAutorestSwiftTest. -
Add a new test case in AutorestSwiftTest. The naming convention is {Package name created}Test.swift. Add your test logic to the new test case.