Single driver instance using cucumber-jvm testng with maven - cucumber-jvm

I was using junit as my testing framework with cucumber-jvm, selenium page factory pattern and maven. Now i have requirement to change it to Testng to execute parallel. Most of the blog says add extends AbstractTestNGCucumberTests in the runner class. but when i do that. I am getting nullpointer exception.
Can someone share your approach using testng with cucumber?

Can someone share your approach using testng with cucumber?
Teach a man to fish and all that. What I do when I have questions like this is to go the cucumber-jvm example page.
Take a look at java-calculator-testng.
Try to implement this sample project locally on your computer and get it working. Now that you have a working example extended it to do what you need to be done.
I hope this helped. A full example would take a lot of space.

Related

How to run karate test runner file with TestNG? [duplicate]

This question already has an answer here:
Karate framework and TestNG
(1 answer)
Closed last year.
We have implemented cucumber with rest assured for API automation. Recently we came to know Karate giving advantages when compared with Rest assured. So I thought of recommend to my organization to use Karate, hence I have prepared sample to API automation scripts with Karate. Yes, I can execute very well with JUnit, but same testrunner file if I tried to execute with TestNG am unable to execute at all, displaying Test runs are zero after my execution.
Could you please help me is there any way to run Karate runner file with TestNG framwework. Really your answer going to make us decision.
I have gone through various posts which are related TestNG with Karate. But unluckily am unable to trigger my scripts.
Note: I have extended KarateRunner class and used #KarateOptions as well in my code.
TestNG is needed only for development mode. All teams finally need to do CI and here Karate does not need even JUnit, please refer this: https://github.com/intuit/karate#parallel-execution
Now for development mode - even if you insist on using TestNG, you can mix JUnit into the same project: https://stackoverflow.com/a/19928639/143475
Please give up trying to use TestNG for Karate, it is un-necessary and a waste of your time. Also note that we have IDE support which is what most developers will use. Even the JUnit support is not needed most of the time.

Automation tests using Cucumber, SoapUI and Selenium

I'd like to use Cucumber linked with SoapUI and Selenium in order to create an automation functional test.
I only found one website about it, describing that first I have to create a SoapUI project and save it as a .xml file. Then I should include this file into the test project using Cucumber and Selenium.
My first question is what configuration do I have to do for that ? (in the pom.xml file when using Maven for example or in any configuration file for Jenkins)
My second and last question is : if I launch every night with Jenkins (let's say that as an example) my tests, do I have to launch first the SoapUI project and import it again in the test project to run my tests in a good way ?
Thanks for your answers
I think you can use REST Assured for you API testing.
Use cucumber for your BDD statement, use java for there step definition and REST Assured for all the API request stuff.
Wrap all your automation with well written Gherkin and you'll need no other documentation. Think about that. BDD (specification by example) is a requirements approach, not a testing approach.

Is TestNG enough as a web test framework?

I just moved into web testing using Selenium and have been learning Selenium WebDriver + Java.
My question is, why do I need to build a test framework when TestNG is there?
What is there that TestNG cannot do as a framework?
Nothing :-)
More seriously, TestNG is very popular with Selenium users for a variety of reasons, among which support for:
Dependencies (very convenient to test pages that follow each other).
Parameterization with #DataProvider (useful to test various combinations of browsers and user agents).
Parallel tests (lets you test on multiple browsers simultaneously).
Check out the Selenium forums for more information and feel free to email the testng-users list if you have questions.
Yes, I think TestNG is enough as a web test framework. If you are familiar of using JUnit, It is easier to switch into TestNG
Building a custom framework may be necessary at times.
And you can use TestNG for that. :)

How to present a Selenium test written in spec or PHPUnit on Hudson

I am setting up Selenium tests on Hudson and looking for an easy way to present nice results such as Project summary and build summary on Hudson.
Currently I have written Selenium test cases in Rspec and PHPUnit's extension for Selenium (I prefer working on Rspec over PHP).
What is the best way to present detailed report for Selenium tests on Hudson CI Server?
I prefer to use Rspec over PHPUnit. It would be very nice if I can use rspec and still integrate well with Hudson CI Server.
I would very much appreciate for detailed comments.
thank you so much for your help
Best regards
If you have the results as HTML files, you can use the HTML Publisher plugin.
Have a look at a similar question https://serverfault.com/questions/184805/how-to-view-test-results-in-hudson/185027#185027 This guy seams to have integrated the selenium tests into junit and therefore the results can be published using the xunit tests.
There are two selenium plugins, one should work for you.
This I have no idea what rspec is I entered rspec and Hudson into google. The second link was this one http://reprocessed.org/blog/easy_rails_ci_with_hudson It should contain everything you need.

How to do testing with lift applications?

How to do testing and is there something similar like Rack::Test with ruby frameworks?
You can use Specs, ScalaTest and JUnit (and any other java test framework), theres some examples on the new wiki.
Read this!
I don't know much about ruby, so maybe don't get your point. But what about Jitr?
Jitr (pronounced "jitter") is a JUnit
Integration Test Runner.
It allows your web application
integration tests to easily run
against a lightweight web container in
the same JVM as your tests.
You can use it with JUnit 4's #RunWith annotation. In Scala: #RunWith(classOf[Jitr]).
This may be of help, it's on Lifts wiki pages. There are examples using Junit, Scalatest and and Specs.
How To: Unit test lift snippets with a logged in user