Hi,

I am currently working on developing Publisher REST- API. Along with the
REST API development, I am writing test cases for REST endpoints using
jaggery-test framework.

I need to share a global variable(ex: asset-id) in few test Specs.

for example, one test spec will be to create a asset by posting to '*create
> asset REST end point*' and then use retrieved asset-id in next test spec
> to update the asset by posting to '*update asset REST end point*'. Here,
> both '*it'* specs for testing '*create*' & '*update*' are inside one
> 'describe' block.


jaggery-test framework is based on jasmine and when I look into jasmine
documentation[01], it says that,

>
> *..JavaScript scoping rules apply, so variables declared in a describe are
> available to any it block inside the suite...*

and

> *..Another way to share variables between a beforeEach, it, and afterEach
> is through the this keyword. ..*
>

Although I tried above both methods to share a variable in several
'*it'  *blocks
grouped in one describe block, it did not work.

This behavior should be due to the way that tests are executed by
jaggery-test framework. Seems like we have to update it in order to achieve
variable sharing/enabling scope rules.

Any thoughts?

[01] http://jasmine.github.io/2.0/introduction.html
-- 
*Ayesha Dissanayaka*
Software Engineer,
WSO2, Inc : http://wso2.com
<http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
20, Palmgrove Avenue, Colombo 3
E-Mail: [email protected] <[email protected]>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to