GitHub - comick/node-robotremoteserver: A node.js module providing the robot framework remote library interface (original) (raw)

robotremote

Node Robot Remote Server CI

A node.js module providing the robot framework remote library interface. Also provide convenient remote library interface client.

Installation

Install robot framework first. Then:

$ npm install robotremote

Example

Just little example with main features. Test folder contains better extensive examples for more features.

examplelibrary.js:

'use strict';

const { readdir } = require('fs').promises; const robot = require('../lib/robotremote'); const assert = require('assert');

var lib = module.exports;

/**

/**

// Run this keyword library if the library itself is called explicitly. if (!module.parent) { const server = new robot.Server([lib], { host: 'localhost', port: 8270 }); }

remote_tests.robot:

*** Settings *** Library Remote http://localhost:${PORT}

*** Variables *** ${HOST} localhost ${PORT} 8270

*** Test Cases ***

Count Items in Directory items1=CountItemsInDirectory{items1} = Count Items In Directory items1=CountItemsInDirectory{CURDIR} items2=CountItemsInDirectory{items2} = Count Items In Directory items2=CountItemsInDirectory{TEMPDIR} Log items1itemsin′{items1} items in 'items1itemsin{CURDIR}' and items2itemsin′{items2} items in 'items2itemsin{TEMPDIR}'

Failing Example Strings Should Be Equal Hello Hello Strings Should Be Equal not equal

Run the remote server:

$ node example/examplelibrary.js

Then launch tests:

$ pybot example/remote_tests.robot

Using botclient.js:

The botclient.js command line utility can be useful to test keywords of any compliant running robot remote server.

An example session with the example keywords library follows:

$ node ./bin/botclient.js localhost 8270 Connected to remote server at "localhost:8270" Available keywords: stopRemoteServer, countItemsInDirectory, stringsShouldBeEqual localhost:8270> keywords.countItemsInDirectory { [Function] args: [ 'path' ], docs: 'Returns the number of items in the directory specified by path.' } localhost:8270> keywords.stringsShouldBeEqual { [Function] args: [ 'str1', 'str2' ], docs: '' } localhost:8270> keywords.stringsShouldBeEqual('ciao', 'ciao').done(console.log) undefined localhost:8270> { output: 'WARN Comparing 'ciao' to 'ciao'\n', status: 'PASS', return: '' }

Keywords are available in context in the keywords dictionary. When called they return an A+ promise.

License

Copyright (c) 2013-2022 Michele Comignano mcdev@playlinux.net

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.