Exist a busser gem for chefspec - testing

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.

Related

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.

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

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.

How create unit test using chefspec for a chef cookbook method

I am trying to create a unit test using chefspec, but I can not find the correct way. Here is the piece of chef code
def printMessage(message)
log 'Debuggin' do
message "#{message}"
level :info
action :write
end
end
My question is, what is the correct way to test that chef cookbook method?
The most common way is to not test it directly, just test the recipes you use it in as per normal. For testing it directly, it would depend on how you're patching things in to the DSL.

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

I want to start at the same time more than one cucumber test with the help of watir-webdriver using tags. How can I get(start) it? Is it possible?

How can I get start it? Is it possible? Can you give me some simple example?
For example i use following command to launch defined tagged tests:
parallel_cucumber features/ -p [#critical]
And all tests are launched after that, including untagged.
The solution was found :
parallel_cucumber features --test-options '--tags #critical' .
Only features with tags #critical will be launched in this case.