3

If I run a bunch of tests inside Testcafe, it may need a couple of times. Is it possible to add a function/callback to get the current test/step that Testcafe is processing?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
ingo
  • 776
  • 1
  • 10
  • 25

1 Answers1

2

Such information is available in custom reporter plugins. If you want to know which test is executed at this moment, you need to implement a custom reporter and plug it to TestCafe. See more information related to a custom reporter's implementation here.

mlosev
  • 5,130
  • 1
  • 19
  • 31
  • Yes this I read, but I already used he allure reporter. I do not think it is possible to use two, isn't it? – ingo Oct 24 '19 at 12:22
  • 1
    Yes, it's possible. See how to specify multiple reporters [here](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#using-multiple-reporters) – mlosev Oct 24 '19 at 13:01
  • Im very confused. After creating the own reporter I just got: { GeneralError: Multiple reporters attempting to write to stdout: "spec, uistatusreporter, allure". Only one reporter can write to stdout. – ingo Nov 01 '19 at 12:54
  • Could you please describe how you set up these reporters? – mlosev Nov 01 '19 at 13:10
  • Adding a dedicated output will cause an illegal operation. illegal operation on a directory, open '/Users/ingofoerster/Downloads/development/speedmaster/allure/allure-report' – ingo Nov 01 '19 at 13:15
  • .reporter(['spec', { name: 'uistatusreporter' }, { name: 'allure’,__basedir + '/allure/allure-report' }]) – ingo Nov 01 '19 at 13:17
  • The issue I do not understand is, that the allure reporter do not write to stdout. But also do not write to a default location. If allure will use stdout it have to write to console, too. But it do not. – ingo Nov 01 '19 at 13:18
  • It looks like I have to give allure reporter a physical file in output, that allure reporter will never use. Maybe a bug. – ingo Nov 01 '19 at 14:02
  • TestCafe suggests that a reporter plugin uses the [`write`](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/helpers.html#write) helper method. This method writes data into the file or stream specified in the [`output`](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#reporter) parameter. If this parameter is not specified, the `write` method outputs data into `stdout`. So, TestCafe considers that all reporters without the output parameters write data into `stdout`. – aleks-pro Nov 08 '19 at 12:38
  • The `testacafe-reporter-allure` plugin doesn't call the `write` helper method. It uses its custom logic to write data into a file. That's why the `output` parameter doesn't affect the reporter output. – aleks-pro Nov 08 '19 at 12:39