Class TestRailClient


  • public class TestRailClient
    extends Object
    • Constructor Detail

      • TestRailClient

        public TestRailClient​(String base_url)
    • Method Detail

      • getPassword

        public String getPassword()
        Get/Set Password

        Returns/sets the password used for authenticating the API requests.

        Returns:
        the password
      • setPassword

        public void setPassword​(String password)
      • getUser

        public String getUser()
        Get/Set User

        Returns/sets the user used for authenticating the API requests.

        Returns:
        the user
      • setUser

        public void setUser​(String user)
      • sendGet

        public Object sendGet​(String uri,
                              String data)
        Send Get

        Issues a GET request (read) against the API and returns the result (as Object, see below).

        Arguments:

        uri The API method to call including parameters (e.g. get_case/1)

        Returns the parsed JSON response as standard object which can either be an instance of JSONObject or JSONArray (depending on the API method). In most cases, this returns a JSONObject instance which is basically the same as java.util.Map.

        If 'get_attachment/:attachment_id', returns a String

        Parameters:
        uri - uri
        data - data
        Returns:
        the response
      • sendPost

        public Object sendPost​(String uri,
                               Object data)
        Send POST

        Issues a POST request (write) against the API and returns the result (as Object, see below).

        Arguments:

        uri The API method to call including parameters (e.g. add_case/1) data The data to submit as part of the request (e.g., a map) If adding an attachment, must be the path to the file

        Returns the parsed JSON response as standard object which can either be an instance of JSONObject or JSONArray (depending on the API method). In most cases, this returns a JSONObject instance which is basically the same as java.util.Map.

        Parameters:
        uri - uri
        data - data
        Returns:
        the response