Xray does not provide yet a plugin for Teamcity. However, it is easy to setup Teamcity in order to integrate it with Xray.
Since Xray provides a full REST API, you may interact with Xray, for submiting results for example, by using it.
JUnit example
In this scenario, we want to get visibility of the automated test results from some tests implemented in Java, using the JUnit framework.
In order to submit those results, we'll just need to invoke the REST API (as detailed in Import Execution Results - REST).
Run automated tests
Our project is Maven based, therefore the first Build Step compiles and runs the JUnit automated tests.
Import execution results
In order to submit the results, we'll need to add a Build Step of type "Command Line", where we'll invoke the REST API, submitting the JUnit XML report generated in the previous step.
The complete script content of the "custom script" field above is:
curl -H "Content-Type: multipart/form-data" -u %jira_user%:%jira_password% -F "file=@java-junit-calc/target/surefire-reports/TEST-com.xpand.java.CalcTest.xml" "%jira_base_url%/rest/raven/1.0/import/execution/junit?projectKey=CALC&fixVersion=v3.0&revision=1234"
We're using "curl" utility that comes in Unix based OSes but you can easily use another tool to make the HTTP request.
Notice that we're using some parameters for storing Jira's base URL along with the credentials to be used in the REST API.
Actually, these parameters can be defined at multiple levels; in our example we defined them at the "Build Configuration" level but they could also have been defined at the project level.
The parameters can be hidden, such as the password, if you defined them as being of type "Password".