Hot answers tagged

6

If you are using zsh shell: repeat 10 { command } On basic shell: for _ in {1..10} do command; done If you can run the tests in parallel, you can use the GNU Parallel: parallel command ::: {1..1000} Tutorial videos: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1 Text tutorial: http://www.gnu.org/software/parallel/parallel_tutorial.html Your ...


2

Intermittent failures are hard to fix due to their very nature - they don't always happen. So when you think you have fixed them you often can't be sure just by 'running the spec'. You usually need to run the spec many times to have a sense for whether a 'fix' has worked. This makes addressing them hard. It requires a variety of techniques and approaches ...


2

Create a script in your home directory, e.g. $ cat run_spec_100_times.sh cd ~/eq/lynx for i in `seq 1 100`; do rspec spec/features/survey_spec.rb done cd ~ Modify the script to be executable with chmod +x run_spec_100_times.sh The use it with . run_spec_100_times.sh


2

Minitest and Rspec are very similar. You are likely to miss the Rspec matchers, however there is an Rspec matchers gem for minitest. If you use it, there is a good chance your test will 'just work'. Minitest integration rspec-expectations is a stand-alone gem that can be used without the rest of RSpec. If you like minitest as your test runner, but prefer ...


2

I've generally seen it referred to as "xSpec"; that style was popularised, if not invented, by RSpec and there are others like JSpec (for Java, which uses it but not describe). The JavaScript framework Mocha (and other tools that have adopted it, like Cypress) refers to this API as "the BDD interface". Jasmine, which also uses that style but doesn't ...


1

What visit waits until is determined by the specific driver used (chromedriver, geckodriver, etc) and the page load strategy that driver is configured to use - https://w3c.github.io/webdriver/#navigation. Unfortunately, if you're using Chrome the "interactive" page load strategy won't be supported until Chrome/chromedriver 77 but you could configure a driver ...


1

You can write an RSpec test that tries to do this by grepping spec files for the locator names. It will not be foolproof. Some orphans might slip through and the test still passes (falsely). However if the locator is not found anywhere it does indicate an orphan and it will fail the test. This is based on: locators being in a locators.yml file locator ...


1

Here is a shell script to produce more readable documentation: find . -regex \ '\(.*_spec\.rb\|spec_.*\.rb\)' ! -name 'spec_helper.rb' \ -exec cat {} \; | \ grep -E \ '(^ +?describe |RSpec\.describe|^ +?it |^ +?expect|\.should)'|\ sed -E 's/ do +?$//' | # No need for the do \ sed 's/, order\: \:defined//' | # No need for order: :defined \ sed "s/\.value)/)...


1

To debug, first try to take a screenshot in headless mode when you arrive at the button. Then take another screenshot before the test fails or after you click the button. It really looks like you pressed the button but the next screen wasn't triggered. Try to add a timeout before you press the submit button. Maybe 30 seconds, you can reduce this later, ...


1

This link explains Firefox browser testing with Capybara: Hope the below link give you an insight of the approach. http://elementalselenium.com/tips/38-headless Installing xvfb: Example command : For Debian based systems: apt-get install xvfb Redhat based systems: yum install xorg-X11-server-Xvfb Run the script: xvfb-run ruby headless.rb Executing the ...


1

Technical Debt You have a described a situation where there is a lot of technical debt from having no tests. My approach would be: Change things for all code (new or updated) going forward to have tests. This doesn't just mean 'require tests', it will mean investing in lots of education, training and introduction of a changed development philosophy and ...


1

This was due to a bug in chromedriver. Updating to a more recent version solves this. Specifically this was fixed in chromedriver version 2.24 at least for Ubuntu. A couple of other of our feature specs had issues with this fix which I am addressing separately. Looks chromedriver is the moving piece where the fixes happen right now.


1

I think the Capybara benefits sum it up nicely: No setup necessary for Rails and Rack application. Works out of the box. Intuitive API which mimics the language an actual user would use. Switch the backend your tests run against from fast headless mode to an actual browser with no changes to your tests. Powerful synchronization features mean you ...


Only top voted, non community-wiki answers of a minimum length are eligible