Installations
npm install typelearn1
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
16.14.2
NPM Version
8.5.0
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (74.85%)
JavaScript (25.15%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
automatekitbox
Download Statistics
Total Downloads
2,650
Last Day
3
Last Week
11
Last Month
46
Last Year
395
GitHub Statistics
1 Stars
13 Commits
4 Forks
1 Watching
1 Branches
1 Contributors
Bundle Size
668.08 kB
Minified
195.72 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.2.5
Package Id
typelearn1@0.2.5
Unpacked Size
70.77 kB
Size
12.04 kB
File Count
22
NPM Version
8.5.0
Node Version
16.14.2
Total Downloads
Cumulative downloads
Total Downloads
2,650
Last day
50%
3
Compared to previous day
Last week
-59.3%
11
Compared to previous week
Last month
0%
46
Compared to previous month
Last year
-35.2%
395
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
testrail-integration tool
Please use below version to support only testrail APi's without cucumber
You can try with the new version also
1 2npm i testrail-integration@0.1.7 3
#Upcoming features
- Going to support Mocha integration
Highlights
- It supports CommonJS, ES, ECMACScript and TypeScript
- Supports all Testrail api's that are available
- Pretty easy to use this library for JS and non JavaScript developers
- It supports Cucumber, Mocha and other frameworks as well
- It helps integration testing with all testing frameworks
- Handled all exceptions, so no need to use try catch blocks
- Well managed responses
- Interfaces already implemented, so use it directly
- more customized options for step results
- async and awaits are supported
- Actively maintained
-Please check API reference: https://www.gurock.com/testrail/docs/api
Please refer below git urls for Cucumber Integration with testrail
- it supports Protractor , WebdriverIO and other tools which supports cucumber framework
1Testrail integrations with CUCUMBER scenarios by just adding cucumber tags ex: @c1234 @Bug-DSS-3467
- https://github.com/automatekitbox/testrail-api-integration/blob/main/README.md
- https://github.com/automatekitbox/testrail-api-integration/blob/main/cucumbertestrail.png
#Tip
1 Always update test result after execution of test case 2 Use After hook 3 You will not miss previous testcase results if something aborts in the middle of test execution
#Handling right error messages
1{ 2 "message": "Response code 400 (Bad Request)", 3 "name": "HTTPError", 4 "host": "inc1.testrail.io", 5 "url": "https://inc1.testrail.io/index.php?/api/v2/add_result_for_case/1/156789", 6 "path": "/index.php?/api/v2/add_result_for_case/1/156789", 7 "body": "\"{\\\"error\\\":\\\"Field :case_id is not a valid test case.\\\"}\"" 8} 9
Ex: handle error with catch
1 try { 2 await testrail.getCased(caseId); 3 } catch ( err) { 4 console.log( err); 5 }
Sample code for JS and TS(typescript)
- Refer interfaces to know what data needs to be passed otherwise use implemented interfaces directly
- https://github.com/automatekitbox/testrail-api-integration/blob/main/testrail.interface.ts
- Sample code
1 const {INewTestResultImpl } = require("testrail-integration"); 2 const content = new INewTestResultImpl(); 3 content.comment = "FIRST COMMENT"; 4 content.version = "Build#1"; 5 content.defects = "DSS-123"; 6
getTests(run_id: number)
1 const { TestRailClient } = require("testrail-integration"); 2 3(async () => { 4 const options = { 5 username: "abc@gmail.com", 6 password: "pwd", 7 url: "https://my.testrail.io" 8 } 9 const client = new TestRailClient(options); 10 const res = await client.getTests(1); 11 console.log(JSON.stringify(res)); 12})();
TypeScript
1import {TestRailClient} from "testrail-integration"; 2 3 const options = { 4 username: "abc@gmail.com", 5 password: "pwd", 6 url: "https://my.testrail.io" 7 } 8 const client = new TestRailClient(options); 9 const res = await client.getTests(1); 10 console.log(JSON.stringify(res));
addResultForCase(runId: number, caseId: number, content: INewTestResult)
1 const { TestRailClient } = require("testrail-integration"); 2 3(async () => { 4 const options = { 5 username: "abc@gmail.com", 6 password: "pwd", 7 url: "https://my.testrail.io" 8 } 9 const client = new TestRailClient(options); 10 const content = { 11 comment: "FIRST COMMENT", 12 version: "Build#1", 13 defects: "DSS-123", 14 status_id: 5 //fail 15 } 16 const testResult = await client.addResultForCase(1, 2, content ); 17 console.log("Test Results property wise" + testResult.status_id + testResult.comment + testResult.defects); 18 console.log("Test Results" + JSON.stringify(testResult)); 19})();
using Interface - better approach
1 const { TestRailClient, INewTestResultImpl } = require("testrail-integration"); 2 3(async () => { 4 const options = { 5 username: "abc@gmail.com", 6 password: "pwd", 7 url: "https://my.testrail.io" 8 } 9 const client = new TestRailClient(options); 10//Using Interface implentation 11 const content = new INewTestResultImpl(); 12 content.comment = "FIRST COMMENT"; 13 content.version = "Build#1"; 14 content.defects = "DSS-123"; 15 status_id: 1; //pass 16 const testResult = await client.addResultForCase(1, 2, content ); 17 console.log("Test Results property wise" + testResult.status_id + testResult.comment + testResult.defects); 18 console.log("Test Results" + JSON.stringify(res1)); 19})();
addResultsForCases(runId: number, results: INewTestResults[]) ==> update test result for multiple cases
- Sending content directly
1 const { TestRailClient } = require("testrail-integration"); 2 3(async () => { 4 const options = { 5 username: "abc@gmail.com", 6 password: "pwd", 7 url: "https://my.testrail.io" 8 } 9 const client = new TestRailClient(options); 10 const content = [{ 11 case_id: 4, 12 comment: "FIRST COMMENT", 13 version: "Build#1", 14 status_id: 1 //pass 15 }, { 16 comment: "SECOND COMMENT", 17 version: "Build#1", 18 defects: "DSS-124", 19 status_id: 5 //fail 20 } ] 21 const res1 = await client.addResultsForCases(1, content ); 22 console.log("Test Results property wise for each case" + res1[0].status_id + res1[1].status_id ); 23 console.log("Test Results" + JSON.stringify(res1)); 24})();
Using Interface to update multiple testcase results
1 const { TestRailClient, INewTestResultsImpl } = require("testrail-integration"); 2 3(async () => { 4 const options = { 5 username: "abc@gmail.com", 6 password: "pwd", 7 url: "https://my.testrail.io" 8 } 9 const client = new TestRailClient(options); 10 const newTestResults = []; 11 const firstCaseResult = new INewTestResultsImpl(); 12 firstCaseResult.case_id = 1; 13 firstCaseResult.comment = "ARRAY!"; 14 firstCaseResult.status_id = 5; 15 16 newTestResults.push(firstCaseResult); 17 18 const secondCaseResult = new INewTestResultsImpl(); 19 secondCaseResult.case_id = 19; 20 secondCaseResult.comment = "ARRAY!"; 21 secondCaseResult.status_id = 5; 22 23 secondCaseResult.push(secondCaseResult); 24 25 const res = await client.addResultsForCases(1, newTestResults ); 26 console.log("Test Results" + JSON.stringify(res)); 27})();
addRun(projectId: number, content: INewTestRun):
- Provide suite_id if it is applicable Note: Free trail , we will not see suites, so we create testcases without suite
1//Free Trial testrail 2 const myNewRun = { name: "My TESTRUN!", description: "MY NEW RUN ONE" }; 3 const addRun = await client.addRun(1, myNewRun); 4 5//Official testrail, your testcases belongs to suite, so suite_id is mandatory 6 const myNewRun = { suite_id: 2, name: "My TESTRUN!", description: "MY NEW RUN ONE" }; 7 const newRunResult = await client.addRun(1, myNewRun); 8 console.log("New Run Details" + JSON.stringify(newRunResult));
//----- ADD RUNS AND Cases
- supported wrapper to get run_id
getRunId(projectId: number, runName: string):
addRun(projectId: number, content: INewTestRun)
getRun(runId: number)
getRuns(projectId: number)
updateRun(runId: number, content: INewTestRun)
getCase(caseId: number): returns
getCases(projectId: number, caseFilters: ICaseFilters)
addCase(sectionId: number, content: ICase)
updateCase(caseId: number, content: ICaseUpdate)
deleteCase(caseId: number)
deleteCases(projectId: number, suiteId: number, soft: number = 1, caseIds: number[])
// ----- Case Fields -----
getCaseFields()
// ----- Case Types -----
getCaseTypes()
// ----- Configurations -----
getConfigs(project_id: number)
addConfigGroup(project_id: number, content: IConfigurationUpdate)
addConfig(config_group_id: number, content: IConfigurationUpdate)
updateConfigGroup(config_group_id: number, content: IConfigurationUpdate)
updateConfig(config_id: number, content: IConfigurationUpdate)
deleteConfigGroup(config_group_id: number)
deleteConfig(config_id: number)
// ----- Milestones -----
getMilestone(milestone_id: number)
getMilestones(project_id: number, filters: IMilestoneFilters)
addMilestone(project_id: number, content: INewMilestone)
updateMilestone(milestone_id: number, content: IMilestoneUpdate)
deleteMilestone(milestone_id: number)
// ----- Plans -----
getPlan(plan_id: number)
getPlans(project_id: number, filters: any)
addPlan(project_id: number, content: any)
addPlanEntry(plan_id: number, content: any)
updatePlan(plan_id: number, content: any)
updatePlanEntry(plan_id: number, entry_id: number, content: any)
closePlan(plan_id: number)
deletePlan(plan_id: number)
deletePlanEntry(plan_id: number, entry_id: number)
// ----- Priorities -----
getPriorities()
// ----- Projects -----
getProject(project_id: number)
getProjects(filters: IProjectFilters)
addProject(content: IProjectUpdate)
updateProject(project_id: number, content: IProjectUpdate)
deleteProject(project_id: number)
// ----- Results -----
getResults(test_id: number, filters: ITestResultFilters)
getResultsForCase(run_id: number, case_id: number, filters: ITestResultFilters)
getResultsForRun(run_id: number, filters: ITestResultsForRunFilters)
addResult(test_id: number, content: INewTestResult)
addResults(run_id: number, content: INewTestResult[])
// ----- Result Fields -----
getResultFields()
// ----- Sections -----
getSection(section_id: number)
getSections(project_id: number, filters: any)
addSection(project_id: number, content: INewSection)
updateSection(section_id: number, content: ISectionUpdate)
deleteSection(section_id: number)
// ----- Statuses -----
getStatuses()
// ----- Suites -----
getSuite(suite_id: number)
getSuites(project_id: number)
addSuite(project_id: number, content: INewSuite)
updateSuite(suite_id: number, content: INewSuite)
deleteSuite(suite_id: number)
// ----- Templates -----
getTemplates(project_id: number)
----- Tests -----
getTest(test_id: number)
getTests(run_id: number, filters?: { status_id?: number | number[] })
----- Users -----
getUser(user_id: number) getUserByEmail(email: string) getUsers()
Publishing changes
Document is in progress! Queries at letautomate@gmail.com
License
Please see LICENSE.md.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
26 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-px4h-xg32-q955
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
1.7
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More