I'm trying to find resolution on this.
I have 1 cucumber scenario with Gradle parameters: firefoxand chrome
Scenario: Run
When I want browser {browser}
Then I get browser {browser}
How I can run this scenario two times in parallel with Gradle, but with different provided parameters - One test with Firefox and One with Chrome, but in same time.
Behind cucumber, I have Java + JUnit
Thanks
Related
I want to run feature files parallelly in alphabetical order and scenarios of each feature file in serial order.
I am using JUnit 5 configurations to run the test in parallel.
Basically want to use junit 5 built in mechanism to run feature file parallel and not sceanrios and feature file should be executed in alphabetical order like it used to work with junit 4 and surefire plugin
You can not. Scenarios are intended to be executed independently from each other. It was a limitation of JUnit 4 that only features were run in parallel.
Depending on what you are testing, you could turn all scenarios in a feature file into a single scenario.
However you should consider rewriting your scenarios such that they do not depend on the actions in previous scenarios.
Typically this means writing scenarios like:
Scenario: Do a thing
Given a thing
When a thing is used
Then something happens
Scenario: Do another thing next
Given a thing that was used
When a thing is used again
Then something else happens
To implement a thing that was used you can reuse the methods you've already written to implement the steps of the first scenario.
I create a maven project using selenium web driver in eclipse to automate one web-based application. Here I also used TestNG and the programming language Java. Now I want to integrate this selenium project into JMeter and want to do performance testing so how can I achieve this?
Although it's possible to kick off a TestNG test programmatically from JMeter's JSR223 Sampler using the code like:
TestListenerAdapter tla = new TestListenerAdapter()
TestNG testng = new TestNG()
testng.setTestClasses(new Class[] { YourClassWithTests.class })
testng.addListener(tla)
testng.run()
I don't think you will get the results you're looking for.
The main limitations are:
In general it's not advised to use Selenium for performance testing
You won't get metrics and KPIs like number of concurrent users, connect time, response time, etc.
Test will be very resource intensive as one instance of browser requires 1 CPU core and a couple of gigabytes of RAM so the resource footprint will be immense.
So I would recommend converting your Selenium tests to "pure" JMeter, you can kick off JMeter's HTTP(S) Test Script Recorder and configure your Selenium tests to use JMeter as the proxy, this way JMeter will be able to intercept the relevant HTTP requests and create HTTP Request samplers which are lightweight comparing to the real browsers and this way you will get all the metrics.
We are using cucumber automate our web-based application and our mobile side application. We have test cases that enable for us to validate we would have to set it in our website then check mobile application to see if it worked. Here's the question
- Is it possible in cucumber to combine or reference an existing test cases from another suite to run AFTER say I set a setting in our web portal?
- Example
Test Case
- Set feature A to On in web portal
- In order for Feature A to be checked it it worked I have to go to Mobile App and check
Is there such a thing as
Execute test case 1 then go to another suite and execute test case 2?
or should we just combine the whole end to end even though test case 2 already exists as an independent test?
So far I have tried running multiple scenarios using parallel_tests and they are working fine. But the problem with this approach is I need to run multiple times with different browser parameter and I think that this is not a good practice.
Right now I am passing only browser parameters along with cucumber config. I can pass array of browsers like 'chrome', 'firefox' , 'ie' etc. Now question is, is there anyway I can trigger all scenarios against all these browsers? parallel_tests should invoke my scenarios? (Lets say 2 scenarios) 6 times (1 scenario against 3 browsers). Is there anyway I can achieve this task?
In our build there are certain scenarios that fail for reasons which are out of our control or take too long to debug properly. Things such asynchronous javascript etc.
Anyway the point is sometimes they work sometimes they don't, so I was thinking it would be nice to add a tag to a scenario such as #rerun_on_failure or #retry which would retry the scenarion X number of times before failing the build.
I understand this is not an ideal solution, but the test is still valuable and we would like to keep it without having the false negatives
The actual test that fails clicks on a link and expects a tracking event to be sent to a server for analytics (via javascript). Sometimes the selenium web-driver loads the next page too fast and the event does not have time to be sent.
Thanks
More recent versions of Cucumber have a retry flag
cucumber --retry 2
Will retry tests two times if it fails
I've been considering writing something like what you're describing, but I found this:
http://web.archive.org/web/20160713013212/http://blog.crowdint.com/2011/08/22/auto-retry-failed-cucumber-tests.html
If you're tired of having to re-kick builds in your CI server because of non deterministic failures, this post is for you.
In a nutshell: he makes a new rake task called cucumber:rerun that uses rerun.txt to retry failed tests. It should be pretty easy to add some looping in there to retry at most 3x (for example).
For cucumber + java on maven i found this command:
mvn clean test -Dsurefire.rerunFailingTestsCount=2
, u must have actual version of surefire plugin, my is 3.0.0-M5.
And nothing else special u even need.