-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APIs for starting a test session #14
Comments
We are in the process of documenting the APIs on the website, but I'll try to do explain it briefly here. The OpenTest server exposes two APIs that can be used to start a test session: API 1: Create a session passing the list of tests
The body of this POST request looks like this:
All the properties in the JSON payload are mirroring the details you are passing when you start a test session from the OpenTest server UI. API 2: Create a session from a templateThis API allows you to start a test session based on a test session template file, that you have already prepared and saved in the
The body of this POST request looks like this:
Session template files are YAML files that describe the details of a test session (the same ones I already talked about: the list of tests, the environment etc.). Here's an example:
You can take a look in the If you want to integrate OpenTest in a CI pipeline, you can use one of these APIs to kick off a test session. The second API is better, because it doesn't require you to specify the full lists of tests in the API call. You can use a tool like curl to make the API call, something like this:
We are in the process of adding some new command-line options to make this process even easier, which will probably be delivered beginning of August. |
Hi @adrianth, |
@joannalaine Unfortunately, this is not possible just yet, but some other team had some similar requests and this feature will be available in the next OpenTest release. I will add a comment to this issue with the details, when it becomes available. |
Hey @joannalaine, starting with version 1.0.4, we support starting a session from a template file and overriding the properties in the template by using the "create session" API call ( This renders the Please note that version 1.0.4 works with Appium 1.8.0 or later. It will also work with previous versions, with a small caveat: the iOS swiping in Appium 1.7.X is relative to the position of the element being swiped, whereas in 1.8.X it is defined in absolute screen coordinates, so you'll see some issues there. This can be fixed by upgrading Appium to the latest version (preferred) or by using the Let me know if you have any questions. |
Hi @adrianth, I finally got a chance to try this out for both templates and individual tests. It works great! Thanks for new utility! |
@adrianth --It works pretty good....I could invoke / integrate opentest in my deployment scripts using curl. Thanks a lot! |
Hi @reinaldo-dias. Glad to hear you were able to make good use of the updated API. |
Hi @adrianth We're applying CI integration over here and there's question we couldn't find an answer to. Is it possible to call a template with curl and change the session label with a variable? Our goal is to print the current application build as the session label when executing the tests in a template. We've tried this: curl -H "Content-Type: application/json" -d "{"sessionLabel": $build, "template": {"name": "SmokeTest", "path": "/"}}" http://testurlhere When running it this way, the label given to the session is a copy of its id number. What could be done differently to make it work? Thanks in advance. |
Hi @johnnydutra, the OpenTest server will use the session ID as the session label if:
It looks like your "SmokeTest" template doesn't contain a session label property and the $build variable doesn't contain a value either (or you're not running the latest OpenTest version). Please make sure that you are using the latest version of OpenTest (customizing the session label in the API call was not possible before v1.0.4), and check that your $build variable really contains a value. For troubleshooting purposes, you could try to hardcode the session label in the curl command line, to confirm that the label is correctly assigned by the OpenTest server. |
Hello @adrianth, We ran some tests following the inputs you provided there, but still couldn't make it happen. Thanks for the support. |
Oh, I understand now. I had assumed you were using the /api/session API,since you didn't specify the URL in your curl command example. Sorry, I should have mentioned the API too. The "from-template" API is deprecated now that the /api/session API can do the same thing (and more). |
I am looking for api list to post - sessions id - want to execute appium test cases directly from code
The text was updated successfully, but these errors were encountered: