Ignore Deprecation Notice in PHPUnit 9? - laravel

I running tests using PHPUnit 9 and when I do an assertRegExp I get a Warning
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.
How do I suppress the deprecation warning for the particular test?
Note: - I an using Laravel Dusk to run my test and I using the test helper assertPathIs.

From reading this blog post from the author of PHPUnit, there is no built in option to suppress these warnings:
PHPUnit reports a test that uses deprecated functionality with a warning because I know how developers use, or rather not use, PHP's E_DEPRECATED messages. ou cannot opt out of getting this information from PHPUnit.
This should not mark tests as failed with the default configuration:
By default, PHPUnit's command-line test runner exits with shell exit code 0 when the use of a deprecated feature is reported. This shell exit code is used to indicate that no error occurred. This information is used by continuous integration environments, for instance, to decide whether or not the build was successful. If you want your build to fail because the tests use deprecated functionality from PHPUnit, configure failOnWarning="true" in phpunit.xml. This instructs PHPUnit to exit with shell exit code 1 when deprecated assertions are used.

If you want to temporarily hide the deprecation warnings against the developers best wishes, comment out line 219 of vendor/bin/.phpunit/phpunit-9.5-0/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php. In case the file changes, the line to be commented reads: $this->displayDeprecations($groups, $configuration, $isFailingAtShutdown);

I had to set symphony env variable to hide these notices.
$ export SYMFONY_DEPRECATIONS_HELPER=weak
$ phpunit --debug --filter="testname"

Related

Cannot use object of type Illuminate\Support\Facades\Config as array error while running test commad with coverage report

I have one project with Laravel 9 and I am performing testing with coverage report on it, The test cases successfully passed but I'm getting the below error, and if I remove --coverage-html tmp/coverage from command it's working fine. It means this error are occurring while generating a coverage report.
Please help me to figure out this issue.
Command:
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html tmp/coverage
Error:
Generating code coverage report in HTML format ... Cannot use object of type Illuminate\Support\Facades\Config as array
Note: I haven't written any new test cases it has only default two test files which come with the default laravel setup.

Attribute error while executing jmeter script with robotframework

I am trying to execute jmeter with Robot Framework but getting attribute error when I tried to pass extra parameter. I tried below solution but it doesn't work.
How to pass values to the user defined variable in jmeter's jmx file via robot framework
Error:
robot TestCases/TC2_jmeter.robot
==============================================================================
TC2 jmeter
==============================================================================
Get_weather_info | FAIL |
AttributeError: module 'string' has no attribute 'split'
------------------------------------------------------------------------------
TC2 jmeter | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Sounds like usage of a deprecated string function
If you're using this library then it supposed to work with Python 2.7, I think you should be able to still get it, or alternatively identify and re-write the problematic piece of the library, it's open source in any case.
In general you should not need any extra libraries, it's quite possible to kick off a JMeter test in non-GUI mode or generate a HTML Reporting Dashboard using subprocess module

Running only failed test cases in Cypress

While running Cypress scripts, some of the cases are getting failed. I want to run only those failed cases to run again.
How can I run only failed test cases in Cypress?
As long as its not integrated directly in Cypess, you can use a npm package like cypress-run
npm install cypress-run --save
Then edit then run command in the package.json and replace the command
cypress run by for example cypress-run --retries 4, this will retry the failed tests 4 times
Cypress has released version 5.0 which has support for retries, see https://docs.cypress.io/guides/guides/test-retries.html for more information
Just add this line in your cypress.json file.
{
"retries":2
}
It will retry your failed Test case for twice.

How to fix this Travis CI error that builds fine locally

I upgraded from xcode 10.1 to xcode 10.2.1. I needed to change a zendesk pod to satisfy swift 5. This builds fine locally but when travis CI tries to run this command from travis.yml file:
set -e
./.travis/scripts/setup_profiles.sh
./.travis/scripts/deploy_beta.sh "${WORKSPACE}" "${SCHEME}" "${TRAVIS_BUILD_NUMBER}"
set +e
I am getting an error and this is from the raw logs:
⌠error: Multiple commands produce '/Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework':
⌠error: Multiple commands produce '/Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
unexpected mutating task ('SetOwnerAndGroup travis:staff /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') with no relation to prior mutator ('SetOwnerAndGroup travis:staff /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') (in target 'nanopb-iOS11.0')
unexpected mutating task ('SetMode u+w,go-w,a+rX /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') with no relation to prior mutator ('SetMode u+w,go-w,a+rX /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') (in target 'nanopb-iOS11.0')
The problem was that I had duplicate frameworks. After deleting the dupes, the CI ran fine.

Failed test in protractor stops the execution for rest test cases

I am running the protractor Suite (spec file having multiple test cases), If any test case fails, protractor does not continue with the next test case execution and all the rest of test cases also fail.
EXPECTED BEHAVIOR:
Upon failure on any test case, protractor should continue with next test case execution.
I used "Protractor-Fail-Fast" Npm package to stop the rest test case execution if any test case fail. But ideally I am not looking for the same.
But this will not help me!
Just for reference: In Visual Studio MS test, If I created ordered test (same as Spec file in protractor having multiple test cases) and then set test setting like "continue on failure", ordered test execution will continue even if some test case failed.
I am looking for a similar test setting or any solution for protractor.
If you dont't want to stop all tests run just stop using Protractor-Fail-Fast library? Protractor tests run till the end by default even if some of the tests are failed.
set ignoreUncaughtExceptions: true in config file as following:
/**
* If set, Protractor will ignore uncaught exceptions instead of exiting
* without an error code. The exceptions will still be logged as warnings.
*/
ignoreUncaughtExceptions?: boolean;
you can get above description from here
export.config = {
...
ignoreUncaughtExceptions: true
}

Resources