New to Jasmine.

256 views
Skip to first unread message

Sarfraz Wali Khan

unread,
Feb 6, 2018, 1:42:51 PM2/6/18
to Jasmine
Hi,

I am trying to integrate TestRail with Protractor. 
I am facing the problem of intercepting pass or fail from a test case.
For example how can I know that: 
expect(todoList.count()).toEqual(2) has passed or failed.

Based on the result I have to set the status of my test case on TestRail.

Thanks.

Sarfraz Khan.

Gregg Van Hove

unread,
Feb 7, 2018, 1:09:38 PM2/7/18
to jasmi...@googlegroups.com
Jasmine reports all of the expectations that are made in a spec to all reporters in the `specDone` event as part of the specResult (https://jasmine.github.io/api/edge/global.html#SpecResult). This includes a list of `failedExpecataions` and `passedExpectations` (https://jasmine.github.io/api/edge/global.html#Expectation).

Assuming that Protractor passes this information all the way through to any reporters you create yourself, you should be able to use that information to report on specific expectations.

Hope this helps. Thanks for using Jasmine!

-Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+unsubscribe@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at https://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Sarfraz Wali Khan

unread,
Feb 8, 2018, 3:28:17 PM2/8/18
to Jasmine
Hi Gregg,

Thanks for your help.

Now I am able to pass/fail my tests on Testrail from protractor based on the information you have passed.

Thanks again.


On Wednesday, February 7, 2018 at 1:09:38 PM UTC-5, Gregg Van Hove wrote:
Jasmine reports all of the expectations that are made in a spec to all reporters in the `specDone` event as part of the specResult (https://jasmine.github.io/api/edge/global.html#SpecResult). This includes a list of `failedExpecataions` and `passedExpectations` (https://jasmine.github.io/api/edge/global.html#Expectation).

Assuming that Protractor passes this information all the way through to any reporters you create yourself, you should be able to use that information to report on specific expectations.

Hope this helps. Thanks for using Jasmine!

-Gregg
On Tue, Feb 6, 2018 at 8:37 AM, Sarfraz Wali Khan <sarf...@gmail.com> wrote:
Hi,

I am trying to integrate TestRail with Protractor. 
I am facing the problem of intercepting pass or fail from a test case.
For example how can I know that: 
expect(todoList.count()).toEqual(2) has passed or failed.

Based on the result I have to set the status of my test case on TestRail.

Thanks.

Sarfraz Khan.

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.

Sarfraz Wali Khan

unread,
Oct 25, 2018, 3:14:45 PM10/25/18
to Jasmine
Hi Gregg,

I have updated the Angular Cli version to 7.0.2. Now, when I run my test cases I get the following TypeScript compile error:

error TS2339: Property 'results' does not exist on type 'typeof jasmine'.

These are the lines where the above 
let resultLeaker = {
  suiteStarted: function(result) { jasmine.results = {suite: result}; }, ------------------> Here
  specStarted: function(result) { jasmine.results.spec = result; } ------------------------> Here
};
jasmine.results.spec.fullName -------------------------------------------------------------> Here
jasmine.results.spec.failedExpectations.length --------------------------------------------> Here 
jasmine.results.spec.failedExpectations[0].message ----------------------------------------> Here 


My run fails and integration with TestRail fails.

Thanks and Regards,
sarfraz Khan.

Gregg Van Hove

unread,
Oct 25, 2018, 4:49:46 PM10/25/18
to jasmi...@googlegroups.com
Unfortunately, this is a bit beyond my area of expertise. Jasmine itself doesn't really know anything about TypeScript or any of the typings for that. That said, there isn't a `results` property on Jasmine out of the box, so if you want to save off your results for later use, you might want to use a different object that you define, or just as part of the reporter that you're adding.

Hope this helps. Thanks for using Jasmine!

- Gregg

Sarfraz Wali Khan

unread,
Oct 26, 2018, 7:53:00 AM10/26/18
to jasmi...@googlegroups.com
Hi Gregg,

Thanks for replying me back quickly. I also saw that there is no “result” property. I will try your solution.

Have a great day.

Thanks,
Sarfraz Khan.

You received this message because you are subscribed to a topic in the Google Groups "Jasmine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jasmine-js/pJ6Y5VflmHg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jasmine-js+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages