{"id":20065800,"url":"https://github.com/inflectra/rapise-elasticsearch-integration","last_synced_at":"2026-05-12T14:41:33.710Z","repository":{"id":98238433,"uuid":"97940146","full_name":"Inflectra/rapise-elasticsearch-integration","owner":"Inflectra","description":"Rapise and Elasticsearch integration example","archived":false,"fork":false,"pushed_at":"2017-07-21T12:16:31.000Z","size":564,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-05T07:37:07.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Inflectra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-21T11:20:02.000Z","updated_at":"2017-07-21T11:28:35.000Z","dependencies_parsed_at":"2023-05-18T20:30:22.792Z","dependency_job_id":null,"html_url":"https://github.com/Inflectra/rapise-elasticsearch-integration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Inflectra/rapise-elasticsearch-integration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inflectra%2Frapise-elasticsearch-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inflectra%2Frapise-elasticsearch-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inflectra%2Frapise-elasticsearch-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inflectra%2Frapise-elasticsearch-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Inflectra","download_url":"https://codeload.github.com/Inflectra/rapise-elasticsearch-integration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inflectra%2Frapise-elasticsearch-integration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32944275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T13:52:48.554Z","updated_at":"2026-05-12T14:41:33.694Z","avatar_url":"https://github.com/Inflectra.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rapise and Elasticsearch Integration\n\n## About Rapise\n[Rapise](http://www.inflectra.com/Rapise/) is a test automation platform for desktop, web and mobile applications. It is designed for building [automated and manual](https://www.inflectra.com/Ideas/Whitepaper/Incorporating-Automated-and-Manual-Testing-In-An-Effective-Test-Plan.aspx) end-to-end UI tests and fits any [TestOps](https://www.inflectra.com/ideas/entry/161.aspx) infrastructure.\n\n## About Elasticsearch\nQuote: *[Elasticsearch](https://www.elastic.co/products/elasticsearch) is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data so you can discover the expected and uncover the unexpected.*\n\n## Why Integrate?\nElasticsearch can be a great tool for log analysis and monitoring. It may help easily answer important questions arising in test automation projects:\n\n1. How did a particular test behaved over time? Does it produce stable results or is it [flaky](https://testing.googleblog.com/2016/05/flaky-tests-at-google-and-how-we.html)?\n2. How [tests executed on a production system](https://dojo.ministryoftesting.com/lessons/the-future-of-software-testing-part-one) feel at the moment?\n3. Are there any problems caught by [synthetic monitoring](https://martinfowler.com/bliki/SyntheticMonitoring.html)?\n4. Are there [specific words or patterns](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) in logs?\n\n## Integration\nElasticsearch provides REST API for other applications to send data. Rapise has a built-in REST client, so we can use it to send log messages and results of test execution to Elasticsearch.\n\nWe've put integration code into this GitHub repository. So you can easily clone it and try for yourself.\n\n### Elastic Indexes\nCreate [indexes](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html) for test execution status and logs in Elasticsearch. Easiest way is to do this via [Kibana](https://www.elastic.co/products/kibana).\n\n**Index for test execution status**\n```json\nPUT rapise\n{\n  \"mappings\": {\n    \"regression\": {\n      \"properties\": {\n        \"timestamp\": {\n          \"type\":   \"date\",\n          \"format\": \"yyyy-MM-dd'T'HH:mm:ss.SSS\"\n        },\n        \"testname\": {\n          \"type\": \"string\"\n        },\n        \"status\": {\n          \"type\": \"integer\"\n        }\n      }\n    }\n  }\n}\n```\n\n**Index for logs**\n```json\nPUT rapiselog\n{\n  \"mappings\": {\n    \"regression\": {\n      \"properties\": {\n        \"timestamp\": {\n          \"type\":   \"date\",\n          \"format\": \"yyyy-MM-dd'T'HH:mm:ss.SSS\"\n        },\n        \"testname\": {\n          \"type\": \"string\"\n        },\n        \"message\": {\n          \"type\": \"string\"\n        }\n      }\n    }\n  }\n}\n```\n\n### REST Client\nIn Rapise [create REST client](http://www.inflectra.com/Ideas/Entry/466.aspx) and implement endpoints for sending status and log messages to corresponding indexes in Elasticsearch.\n\n\u003cimg src=\"Media/RapiseElasticREST.png\" width=\"813\"/\u003e\n\n### Source Code\nWrite code for sending the data to Elasticsearch.\n\n**Test execution status**\n```javascript\nfunction GetFormattedDate()\n{\n    var d = new Date();\n    d = new Date(d.getTime() + d.getTimezoneOffset() * 60000); // elastic expects UTC\n    var dateString =  d.getFullYear() \n        + \"-\" +  (\"0\"+(d.getMonth()+1)).slice(-2) \n        + \"-\" + (\"0\"+d.getDate()).slice(-2) \n        + \"T\" + (\"0\" + d.getHours()).slice(-2) \n        + \":\" + (\"0\" + d.getMinutes()).slice(-2) \n        + \":\" + (\"0\" + d.getSeconds()).slice(-2) \n        + \".\" + (\"0\" + d.getMilliseconds()).slice(-3);\n    return dateString;\n}\n\nfunction SendTestStatusToElastic()\n{\n    Global.DoLoadObjects('%WORKDIR%/../Elastic/Elastic.objects.js');\n    g_restRoot = Global.GetCurrentDir() + \"\\\\..\\\\Elastic\";\n\n    // Calculate timestamp\n    var dateString = GetFormattedDate();\n\n    // Test name\n    var testName = g_scriptFileName.split('\\\\').slice(-1);\n    \n    // Test status\n    var status = Tester.GetTestStatus();\n\n    // Prepare log record\n    var record = \n    {\n      \"timestamp\": dateString,\n      \"testname\": testName,\n      \"status\": status\n    }\n\n    // Post to ElasticSearch\n    var Elastic_SEED=SeS('Elastic_SEED');\n    Elastic_SEED.SetRequestBodyObject(record);\n    Elastic_SEED._DoExecute(record);\n}\n```\n\n**Log message**\n```javascript\nfunction ElasticLog(msg)\n{\n    function _initializeLogging()\n    {\n        for (var i = 0; i \u003c 5; i++)\n        {\n            // Set all verbose levels\n            if (i \u003c= g_verboseLevel)\n                eval(\"l\" + i + \"=true;\");\n            else\n                eval(\"l\" + i + \"=false;\");\n        }\n    }\n\n    var verboseLevel = g_verboseLevel;\n\n    // Suppress logging to avoid recursion    \n    g_verboseLevel = 0;\n    _initializeLogging();\n\n    Global.DoLoadObjects('%WORKDIR%/../Elastic/Elastic.objects.js');\n    g_restRoot = Global.GetCurrentDir() + \"\\\\..\\\\Elastic\";\n\n    // Calculate timestamp\n    var dateString = GetFormattedDate();\n\n    // Test name\n    var testName = g_scriptFileName.split('\\\\').slice(-1);\n    \n\n    // Prepare log record\n    var record = \n    {\n      \"timestamp\": dateString,\n      \"testname\": testName,\n      \"message\": msg\n    }\n\n    // Post to ElasticSearch\n    var Elastic_LOG=SeS('Elastic_LOG');\n    Elastic_LOG.SetRequestBodyObject(record);\n    Elastic_LOG._DoExecute(record);\n    \n    // Resume logging\n    g_verboseLevel = verboseLevel;\n    _initializeLogging();\n}\n```\n\n### Usage\nIn order to use the integration in your test follow these simple steps.\n\n1. Clone this GitHub repository.\n2. Place your test and `Elastic` test from the repository into the same parent folder.\n3. In your test `*.user.js` file include the integration code.\n```javascript\neval(File.IncludeOnce('%WORKDIR%/../Elastic/ElasticIntegration.js'));\n```\n4. In your test main file override `Log` function and call status sending function at the end.\n```javascript\nfunction Test()\n{\n    // Override Log function to redirect logging to Elasticsearch\n    Log = ElasticLog;\n\n    // Your test code\n    Tester.Assert(\"2 + 2 = 4\", (2 + 2) == 4);\n\n    // Send test execution status to Elasticsearch\n    SendTestStatusToElastic();\n}\n```\n5. The list of libraries in your test must include `Web Service`.\n```javascript\ng_load_libraries=[\"Web Service\"];\n```\n\n### Analysis\nAfter executing tests you can analyze the results in Kibana.\n\n#### Flaky Test\nBy filtering on a test name, getting results from status index and visualizing via pie chart you can get this nice looking donut.\n\n\u003cimg src=\"Media/RapiseKibanaFlaky.png\" width=\"1105\"/\u003e\n\n#### Logs\nBy filtering on a specific substring get all relevant log messages instantly.\n\n\u003cimg src=\"Media/RapiseKibanaLog.png\" width=\"1027\" /\u003e\n\n## Conclusion\nRapise and Elasticsearch can be good friends and form a very powerful tandem in any test automation process. Both tools can be easily integrated so you can spend most of your time testing and analyzing results.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finflectra%2Frapise-elasticsearch-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finflectra%2Frapise-elasticsearch-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finflectra%2Frapise-elasticsearch-integration/lists"}