Comments (3)
I see you're sending the case_ids
as an array of Strings. It might be necessary that you wrap your suite_id
with double quotes so that it is sent as a String in the request.
from testrail-api.
As @davidbrazilparker mentioned, this is likely an issue with the formatting of your request itself. Any IDs submitted in an API request should be treated as integers, so improper formatting could lead to failures parsing the request and the 400 error you received.
Your "case_ids" array should be an array of integers, as shown in the example documentation here.
Regards,
Jon
from testrail-api.
Hi I am having the same problem here, however I am working with Java and I am also passing thge Suite ID: Here is my code:
int PROJECT_ID = 1;
Long SUITE_ID = (long) 1286;
APIClient client = null;
@BeforeSuite
public void createSuite(ITestContext ctx) throws IOException, APIException {
client = new APIClient("https://testrail.net");
client.setUser("[email protected] );
client.setPassword("########");
Map data = new HashMap();
data.put("include_all",true);
data.put("name","Test Run "+System.currentTimeMillis());
JSONObject c = null;
c = (JSONObject)client.sendPost("add_run/"+PROJECT_ID,data);
long suite_id = SUITE_ID;
ctx.setAttribute("suiteID" ,suite_id);
}
@BeforeMethod
public void beforeTest(ITestContext ctx,Method method) throws NoSuchMethodException {
Method m = TestNGProject.class.getMethod(method.getName());
if (m.isAnnotationPresent(TestRail.class)) {
TestRail ta = m.getAnnotation(TestRail.class);
System.out.println(ta.id());
ctx.setAttribute("caseId",ta.id());
}
}
@AfterMethod
public void afterTest(ITestResult result, ITestContext ctx) throws IOException, APIException {
Map data = new HashMap();
if(result.isSuccess()) {
data.put("status_id",1);
}
else {
data.put("status_id", 5);
data.put("comment", result.getThrowable().toString());
}
String caseId = (String)ctx.getAttribute("caseId");
Long suiteId = (Long)ctx.getAttribute("suiteId");
client.sendPost("add_result_for_case/"+suiteId+"/"+caseId,data);
}
Error Message:
RemoteTestNG] detected TestNG version 7.4.0
FAILED CONFIGURATION: @BeforeSuite createSuite(org.testng.TestRunner@1f2586d6)
com.uitesting.testRail.APIException: TestRail API returned HTTP 400("Field :suite_id is a required field.")
from testrail-api.
Related Issues (20)
- Dotnet get_attachments issue
- No ruby sample code for add_attachment HOT 1
- Feature request - Add sortable indexes on user defined entites (test runs, cases, plans, test inside of a test run) HOT 1
- python bindings has error handing issues and path name issues. HOT 1
- {"error"=>"Field :suite_id is a required field."} HOT 1
- is there a testrail-api nuget package available? HOT 1
- com.qa.utils.APIException: TestRail API returned HTTP 400("Field :suite_id is a required field.") HOT 8
- com.qa.utils.APIException: TestRail API returned HTTP 400("Field :case_id is not a valid ID.") HOT 3
- TestRail API returned HTTP 400 Field :suite_id is a required field - JAVA HOT 3
- Add Bindings For Dart HOT 5
- TestRail API returned HTTP 500("Undefined property: stdClass::$sso_enabled") HOT 1
- Consider Publishing to Maven Central
- Unexpected character encountered while parsing value: �. Path '', line 0, position 0. HOT 2
- Screenshots not accessible/downloadable through the API's methods
- PyTest to update test case results to TestRails by providing the RunID
- error when hit GET /get_plan using API v2 HOT 29
- get_results_for_run cannot be filtered to return the last set of results
- Failed to retrieve cases
- rate limit policy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testrail-api.