How to integrate the mocha with Robot framework

297 views
Skip to first unread message

jag m

unread,
Aug 26, 2018, 12:05:41 PM8/26/18
to robotframework-users
Hi ,

 I am trying to run the nodejs with mocha through robot framework . I tried using the cheerio and  node robotremote server , which doesn't help much . 


Could you please help me out on this ?


Warm Regards,
Jagadeesan.M

Tatu Aalto

unread,
Aug 29, 2018, 2:20:11 AM8/29/18
to jagade...@gmail.com, robotframework-users
Ugh

Robot Framework has an API[1] which allows users to create their own library keywords. If you want to use other than Python or Java (depends on the interpreter you use) as your programming language, then looking to the remote library API [2] is useful.

-Tatu
Send from my mobile
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

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

David

unread,
Aug 29, 2018, 8:52:34 PM8/29/18
to robotframework-users
cheerio/node remote server can only execute keywords written in node.js. Mocha is a unit testing framework itself, which wouldn't lend itself to direct integration with RF for integration.

Your best options:

* rewrite the mocha tests to be node.js function calls wrapped or called by cheerio / node remote server that RF can call. Then do all your assertions via RF not (in node like you did with mocha). The node code would only be to invoke the code under test but not to assert it, assert through RF side.

* run mocha tests "as is" but you call it via RF using OperatingSystemLibrary or SSH/TelnetLibrary calling mocha like a shell call through RF, not invoking node.js code based interfacing. From here, either store return code from mocha into RF variable and use it to validate pass/fail or store the stdout output (or the output files) from mocha test run into variable and then validate pass/fail by regex analysis of the results (does it contain any fail messages, etc.)
Reply all
Reply to author
Forward
0 new messages