Can testcafe afterEach() fixture calls know whether the test passed or not? - automation

My Fixture looks like this:
fixture`Admitted: Happy Path`
.page(environment.admitted)
.requestHooks(logger)
.afterEach(logErrors);
logErrors logs all the API errors from that test, however I would only like to log them if the test failed. Is there a way to tell if the test that just finished succeeded in fixture.afterEach()?

I've provided several approaches to solve this issue in the following question.
Please refer to it.

Related

Is it possible to call a test feature from a MockServer feature(matched) in KarateDSL?

I'm trying to do something that I don't know if it is even remotely possible or not.
I've a Mock server, and I'd like that when it receives a given request, it "starts another test", calling a test feature. I tried some stuff, including the one bellow. But turns out that this Mockserver scenario do not respond.
Scenario: pathMatches('/ideas')
* def xx = call read('SimpleStart.feature')
* def response = $ideas.*
Is there an elegant way to make this work? AN workaround or a suggestion you can give me?
The use case is:
Perform tests, some tests, make some external services invoke the mockserver, and if the mockserver is requested it triggers other tests.
Thanks in advance.
Yeah Karate certainly isn't designed to do that. The pattern should be set up your mocks and tests from a Java "runner" for maximum control and that's what most teams do.
In short, "orchestrate" things from Java code.
That said, see if this gives you some other creative ideas: https://twitter.com/getkarate/status/1417023536082812935

Cypress tagged hooks with mocha

I have been building ui automation frameworks with Cypress for some time, but always using the Cypress-Cucumber-Preprocessor.
Now I need to build one without cucumber, just plain ol' mocha, but I found a problem. Seems like I can't use tagged hooks to execute code for specific tests (scenarios in Cucumber)
The scenario is basically this. I have a spec file with several tests. I have a "before" hook that seeds test data to a Mongo db, and eventually I might need to add a hook or hooks to execute something (whatever) before a specific test.
With Cucumber you have a way to tag a given scenario (#tag) and then you can create a hook that will be executed ONLY before or after that specific scenario
#tag
Scenario: Tagged scenario
Given condition
When I do this
Then I should see that
before({tag : '#tag'}, () => {
code
})
I haven't found a way to do this with mocha in Cypress... Anyone has found a way?
thx
You can use BeforeEach or Before, that does predominantly the same thing in Mocha.

Getting the error while trying to run the code for selenium/selenide script to execute script on browserstack

Error description -
java.lang.IllegalArgumentException: The class org.openqa.selenium.remote.RemoteWebDriver of the given context doesn't implement io.appium.java_client.FindsByIosNSPredicate nor io.appium.java_client.FindsByFluentSelector. Sorry. It is impossible to find something
Please help me if someone have any idea about it.
will add more details, if someone wants.
Looks like the element locator strategy FindsByIosNSPredicate and FindsByFluentSelector is not being captured by the default appium version. Can you try explicitly mentioning the appium version capability and pass the same as passed while executing your tests locally on a real device. You may refer to this: https://www.browserstack.com/automate/capabilities or https://www.browserstack.com/app-automate/capabilities ( for App )

Preventing asserts from failing tests in Codeception

I've just started exploring automated testing, specifically Codeception, as part of my QA work at a web design studio. The biggest issue I'm experiencing is having Codeception fail a test as soon as an assert fails, no matter where it's placed in the code. If my internet connection hiccups or is too slow, things can become difficult. I was wondering if there were methods to provide more control over when Codeception will fail and terminate a test session, or even better, a way to retry or execute a different block or loop of commands when an assert does fail. For example, I would like to do something similar to the following:
if ( $I->see('Foo') )
{
echo 'Pass';
}
else
{
echo 'Fail';
}
Does anyone have any suggestions that could help accomplish this?
You can use a conditional assertion:
$I->canSeeInCurrentUrl('/user/miles');
$I->canSeeCheckboxIsChecked('#agree');
$I->cantSeeInField('user[name]', 'Miles');
The codeception documentation says:
Sometimes you don't want the test to be stopped when an assertion fails. Maybe you have a long-running test and you want it to run to the end. In this case you can use conditional assertions. Each see method has a corresponding canSee method, and dontSee has a cantSee method.
I'm not sure, if I understand it correctly, but I think, you should try to use Cest.
$ php codecept.phar generate:cest suitename CestName
So you could write one test in one test function. If a test fails, it will abort. You can also configure codeception, that it will not abort and show only the one test which fails in a summary at the end of all tests.
See here in the documentation: https://github.com/Codeception/Codeception/blob/2.0/docs/07-AdvancedUsage.md
Maybe it's better to use:
$I::dontSee('Foo');
Regards

Exist a busser gem for chefspec

I'm working on my cookbook's tests using Test-Kitchen and I executed with serverspec, using busser-serverspec. But I wanna try to make some test with Chefscpec but if I use Test-Kitchen I don't know what is the structure of my test folders, I know what is the structure for bats and serverspec, all this thanks to Seth Vargo.
I execute the test using the rspec syntax like said Sethvargo on this source. I wanna try something more automated with Test-Kitchen.
Maybe I'm confused.
My question is : exist something like busser-chefspec
ChefSpec is unit testing, not integration testing. There is no busser-chefspec, and if there was, it wouldn't work.