Skip to content

Commit

Permalink
Merge pull request #13 from gemini-testing/rebranding
Browse files Browse the repository at this point in the history
chore: hermione -> testplane
  • Loading branch information
KuznetsovRoman authored Apr 8, 2024
2 parents f33aa8f + 3f51e95 commit d16741f
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 138 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The following authors have created the source code of "hermione-test-repeater"
The following authors have created the source code of "@testplane/test-repeater"
published and distributed by YANDEX LLC as the owner:

Dmitriy Dudkevich <[email protected]>
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ New contributions are welcomed. Follow this guide if you want to make one.
Follow [Github guide](https://help.github.com/articles/creating-a-pull-request) to fork a repo
and create a pull request.

All bug fixes and new features should go to the [`master`](https://github.com/gemini-testing/hermione-test-repeater/tree/master) branch.
All bug fixes and new features should go to the [`master`](https://github.com/gemini-testing/testplane-test-repeater/tree/master) branch.

## Commit messages

Expand Down Expand Up @@ -37,7 +37,7 @@ If you are fixing the bug, add a test that fails without your patch and passes w

When submitting an issue please do following:

1. [Search](https://github.com/gemini-testing/hermione-test-repeater/issues) for same issues on github in order to prevent duplicates
1. [Search](https://github.com/gemini-testing/testplane-test-repeater/issues) for same issues on github in order to prevent duplicates
2. Provide the most detailed issue description so we will additional info to work with

Note that if no response for contributors questions will be provided in 1 week then issue may be considered as irrelevant/resolved and may be closed.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# hermione-test-repeater
# @testplane/test-repeater

The plugin for [hermione](https://github.com/gemini-testing/hermione).
The plugin for [Testplane](https://github.com/gemini-testing/testplane).

Use the `hermione-test-repeater` plugin to run the same test (or group of tests) the required number of times.
Use the `@testplane/test-repeater` plugin to run the same test (or group of tests) the required number of times.

See full documentation in various languages here:
* [English](./docs/en/hermione-test-repeater.md)
* [Русский](./docs/ru/hermione-test-repeater.md)
* [English](./docs/en/testplane-test-repeater.md)
* [Русский](./docs/ru/testplane-test-repeater.md)
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# hermione-test-repeater
# @testplane/test-repeater

## Overview

Use the [hermione-test-repeater][hermione-test-repeater] plugin to run the same test (or group of tests) the required number of times.
Use the [@testplane/test-repeater][@testplane/test-repeater] plugin to run the same test (or group of tests) the required number of times.

This plugin can be useful in cases when you need to make sure that the written tests are stable. The plugin guarantees that the tests will be run as many times as you set, regardless of the results of their run in each attempt. In addition, the plugin allows you to run tests every time in a new browser session. This eliminates the impact of browser degradation or any other side effects that could occur during repeated runs in the same browser session.

## Install

```bash
npm install -D hermione-test-repeater
npm install -D @testplane/test-repeater
```

## Setup

Add the plugin to the `plugins` section of the `hermione` config:
Add the plugin to the `plugins` section of the `testplane` config:

```javascript
module.exports = {
plugins: {
'hermione-test-repeater': {
'@testplane/test-repeater': {
enabled: true,
repeat: 50,
minRepeat: 10,
maxRepeat: 100,
uniqSession: true
},

// other hermione plugins...
// other testplane plugins...
},

// other hermione settings...
// other testplane settings...
}
```

Expand All @@ -46,29 +46,29 @@ module.exports = {

### Passing parameters via the CLI

All plugin parameters that can be defined in the config can also be passed as command line options or through environment variables during Hermione startup. Use the prefix `--test-repeater-` for command line options and `hermione_test_repeater_` for environment variables. For example:
All plugin parameters that can be defined in the config can also be passed as command line options or through environment variables during Testplane startup. Use the prefix `--test-repeater-` for command line options and `testplane_test_repeater_` for environment variables. For example:

```bash
npx hermione --test-repeater-repeat 5
npx testplane --test-repeater-repeat 5
```

```bash
hermione_test_repeater_repeat=5 npx hermione
testplane_test_repeater_repeat=5 npx testplane
```

## Usage

### Option --repeat

The plugin also adds a special `--repeat` option to Hermione's [CLI][cli], with which you can run the test the right number of times in a more convenient way. For example:
The plugin also adds a special `--repeat` option to Testplane's [CLI][cli], with which you can run the test the right number of times in a more convenient way. For example:

```bash
npx hermione --repeat 5
npx testplane --repeat 5
```

## Useful links

* [hermione-test-repeater plugin sources][hermione-test-repeater]
* [@testplane/test-repeater plugin sources][@testplane/test-repeater]

[hermione-test-repeater]: https://github.com/gemini-testing/hermione-test-repeater
[@testplane/test-repeater]: https://github.com/gemini-testing/testplane-test-repeater
[cli]: https://en.wikipedia.org/wiki/Command-line_interface
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# hermione-test-repeater
# @testplane/test-repeater

## Обзор

Используйте плагин [hermione-test-repeater][hermione-test-repeater], чтобы запустить один и тот же тест (или группу тестов) требуемое количество раз.
Используйте плагин [@testplane/test-repeater][@testplane/test-repeater], чтобы запустить один и тот же тест (или группу тестов) требуемое количество раз.

Данный плагин может пригодиться в тех случаях, когда нужно убедиться в стабильности написанных тестов. Плагин гарантирует, что тесты будут запущены столько раз, сколько вы задали, независимо от результатов их прогона в каждой попытке. Кроме того, плагин позволяет запускать тесты каждый раз в новой сессии браузера. Это исключает влияние деградации браузера или еще какие-либо побочные эффекты, которые могли бы возникнуть при повторных прогонах в одной и той же сессии браузера.

## Установка

```bash
npm install -D hermione-test-repeater
npm install -D @testplane/test-repeater
```

## Настройка

Необходимо подключить плагин в разделе `plugins` конфига `hermione`:
Необходимо подключить плагин в разделе `plugins` конфига `testplane`:

```javascript
module.exports = {
plugins: {
'hermione-test-repeater': {
'@testplane/test-repeater': {
enabled: true,
repeat: 50,
minRepeat: 10,
maxRepeat: 100,
uniqSession: true
},

// другие плагины гермионы...
// другие плагины testplane...
},

// другие настройки гермионы...
// другие настройки testplane...
}
```

Expand All @@ -46,31 +46,31 @@ module.exports = {

### Передача параметров через CLI

Все параметры плагина, которые можно определить в конфиге, можно также передать в виде опций командной строки или через переменные окружения во время запуска гермионы. Используйте префикс `--test-repeater-` для опций командной строки и `hermione_test_repeater_` &mdash; для переменных окружения. Например:
Все параметры плагина, которые можно определить в конфиге, можно также передать в виде опций командной строки или через переменные окружения во время запуска testplane. Используйте префикс `--test-repeater-` для опций командной строки и `testplane_test_repeater_` &mdash; для переменных окружения. Например:

```bash
npx hermione --test-repeater-repeat 5
npx testplane --test-repeater-repeat 5
```

```bash
hermione_test_repeater_repeat=5 npx hermione
testplane_test_repeater_repeat=5 npx testplane
```

## Использование

### Опция --repeat

Также плагин добавляет к [CLI][cli] гермионы специальную опцию `--repeat`, с помощью которой можно запустить тест нужное количество раз более удобным образом. Например:
Также плагин добавляет к [CLI][cli] testplane специальную опцию `--repeat`, с помощью которой можно запустить тест нужное количество раз более удобным образом. Например:

```bash
npx hermione --repeat 5
npx testplane --repeat 5
```

[cli]: https://ru.wikipedia.org/wiki/Интерфейс_командной_строки

## Полезные ссылки

* [Исходники плагина hermione-test-repeater][hermione-test-repeater]
* [Исходники плагина @testplane/test-repeater][@testplane/test-repeater]

[hermione-test-repeater]: https://github.com/gemini-testing/hermione-test-repeater
[@testplane/test-repeater]: https://github.com/gemini-testing/testplane-test-repeater
[cli]: https://ru.wikipedia.org/wiki/Интерфейс_командной_строки
2 changes: 1 addition & 1 deletion lib/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const {root, section, option} = require('gemini-configparser');
const defaults = require('./defaults');
const {assertBoolean, assertNonNegativeInteger, assertPositiveIntegerOrInfinity} = require('../validators');

const ENV_PREFIX = 'hermione_test_repeater_';
const ENV_PREFIX = 'testplane_test_repeater_';
const CLI_PREFIX = '--test-repeater-';

const getParser = () => {
Expand Down
30 changes: 15 additions & 15 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const Repeater = require('./repeater');
const {assertNonNegativeInteger} = require('./validators');
const {logger} = require('./utils');

module.exports = (hermione, opts) => {
module.exports = (testplane, opts) => {
const pluginConfig = parseConfig(opts);
let cliTool;

if (!pluginConfig.enabled || hermione.isWorker()) {
if (!pluginConfig.enabled || testplane.isWorker()) {
return;
}

hermione.on(hermione.events.CLI, (cli) => {
testplane.on(testplane.events.CLI, (cli) => {
cliTool = cli;
cli.option(
'--repeat <number>',
Expand All @@ -23,35 +23,35 @@ module.exports = (hermione, opts) => {
);
});

hermione.on(hermione.events.INIT, () => {
testplane.on(testplane.events.INIT, () => {
const repeat = cliTool && cliTool.repeat || pluginConfig.repeat;

if (!repeat) {
return;
}

resetBrowserConfig(hermione, pluginConfig);
resetBrowserConfig(testplane, pluginConfig);

const repeatCounter = RepeatCounter.create();
const repeater = Repeater.create(hermione, repeatCounter);
const repeater = Repeater.create(testplane, repeatCounter);
const repeatCount = limitRepeatCount(repeat, pluginConfig.minRepeat, pluginConfig.maxRepeat);

hermione.on(hermione.events.AFTER_TESTS_READ, (testCollection) => {
testplane.on(testplane.events.AFTER_TESTS_READ, (testCollection) => {
repeater.setTestCollection(testCollection);
});

hermione.on(hermione.events.BEGIN, () => {
testplane.on(testplane.events.BEGIN, () => {
repeater.repeat(repeatCount);
});

hermione.on(hermione.events.TEST_PASS, (test) => repeatCounter.testExecuted(test));
hermione.on(hermione.events.RETRY, (test) => repeatCounter.testExecuted(test));
testplane.on(testplane.events.TEST_PASS, (test) => repeatCounter.testExecuted(test));
testplane.on(testplane.events.RETRY, (test) => repeatCounter.testExecuted(test));

hermione.intercept(hermione.events.TEST_FAIL, ({event, data}) => {
testplane.intercept(testplane.events.TEST_FAIL, ({event, data}) => {
const repeatsLeft = repeatCounter.getRepeatsLeft(data);

return repeatsLeft > 0
? {event: hermione.events.RETRY, data: Object.assign(data, {retriesLeft: repeatsLeft})}
? {event: testplane.events.RETRY, data: Object.assign(data, {retriesLeft: repeatsLeft})}
: {event, data};
});
});
Expand All @@ -78,9 +78,9 @@ function limitRepeatCount(repeat, minRepeat, maxRepeat) {
return limitedRepeat;
}

function resetBrowserConfig(hermione, {uniqSession}) {
hermione.config.getBrowserIds().forEach((browserId) => {
const browserConfig = hermione.config.forBrowser(browserId);
function resetBrowserConfig(testplane, {uniqSession}) {
testplane.config.getBrowserIds().forEach((browserId) => {
const browserConfig = testplane.config.forBrowser(browserId);
browserConfig.retry = 0;

if (uniqSession) {
Expand Down
6 changes: 3 additions & 3 deletions lib/repeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = class TestRepeater {
return new this(...args);
}

constructor(hermione, repeatCounter) {
this._hermione = hermione;
constructor(testplane, repeatCounter) {
this._testplane = testplane;
this._repeatCounter = repeatCounter;
this._tests = null;
}
Expand All @@ -24,7 +24,7 @@ module.exports = class TestRepeater {
this._repeatCounter.addTest(test, repeatCount);

for (let i = 0; i < repeatCount; i++) {
this._hermione.addTestToRun(test, test.browserId);
this._testplane.addTestToRun(test, test.browserId);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

exports.logger = {
info: (msg) => console.info(`[hermione-test-repeater]: ${msg}`)
info: (msg) => console.info(`[@testplane/test-repeater]: ${msg}`)
};
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hermione-test-repeater",
"version": "1.0.0",
"name": "@testplane/test-repeater",
"version": "0.0.1",
"description": "Plugin for repeat tests the specified number of times",
"main": "lib/index.js",
"scripts": {
Expand All @@ -14,19 +14,20 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/gemini-testing/hermione-test-repeater.git"
"url": "git+https://github.com/gemini-testing/testplane-test-repeater.git"
},
"keywords": [
"testplane",
"hermione",
"plugin",
"repeater"
],
"author": "Dmitriy Dudkevich <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/gemini-testing/hermione-test-repeater/issues"
"url": "https://github.com/gemini-testing/testplane-test-repeater/issues"
},
"homepage": "https://github.com/gemini-testing/hermione-test-repeater#readme",
"homepage": "https://github.com/gemini-testing/testplane-test-repeater#readme",
"dependencies": {
"gemini-configparser": "^1.0.0",
"lodash": "^4.17.21"
Expand Down
Loading

0 comments on commit d16741f

Please sign in to comment.