RallyTools / rally-node

A Node.js Toolkit for Accessing Rally's Webservice API
MIT License
53 stars 25 forks source link

examples of adding test case result for type script #50

Open nvora opened 4 years ago

nvora commented 4 years ago

let rally = require("rally"), restApi = rally({ apiKey: 'mKxxxHRSqiC3ct6WsdJ1iyrxEhOtEyhl6cQyCBWic', //preferred, required if no user/pass, defaults to process.env.RALLY_API_KEY apiVersion: 'v2.0', //this is the default and may be omitted server: 'https://rally1.rallydev.com', //this is the default and may be omitted requestOptions: { headers: { 'X-RallyIntegrationName': 'Waas Test Consumer App UI Test', //while optional, it is good practice to 'X-RallyIntegrationVendor': 'Mastercard', //provide this header information } } });

async function updateTestCaseResult(env: string, verdict: string, scenario) { let testcaseId:string = await getTestCaseID(scenario) if (testcaseId != null && browser.params.updateRally == true ) { console.log("Test Case Update Started") restApi.create ({ ref: "https://rally1.rallydev.com/slm/webservice/v2.0/testcase/" + testcaseId , data: { type: 'TestCaseResult', Build: env, //the data with which to update the specified object Verdict: verdict, Notes: "created using automation code", scope: { project: '/project/374073459708d' }, } }, await function (error, result) { if (error) { console.log(error); } else { console.log(result.Object); } }); } }

code is not getting execute when i am running, can you please provide example on how to use this with typescript