Closed aviju2007 closed 8 years ago
This sounds like a chrome driver issue - have you checked that you have the latest version of Chromedriver?
are u talking about selenium-chrome-driver jar? I am using selenium-chrome-driver-2.45.0.jar. Is it main cause for it??If so what version should I go for ..please suggest
Regards, Avijit
No, I’m talking about the binary that should be on your class path.
John Smart | Wakaleo Consulting | +44 7398 832273 Making smart teams collaborate better
http://johnfergusonsmart.com | reachme@johnfergusonsmart.com john.smart@wakaleo.com___
On 20 July 2016 at 8:21:51 PM, aviju2007 (notifications@github.com) wrote:
are u talking about selenium-chrome-driver jar? I am using selenium-chrome-driver-2.45.0.jar. Is it main cause for it??If so what version should I go for ..please suggest
Regards, Avijit
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/serenity-bdd/serenity-cucumber/issues/65#issuecomment-234053863, or mute the thread https://github.com/notifications/unsubscribe-auth/AADasijb-R2QGTDb3Ag3YMLMlYy2M5Alks5qXnVOgaJpZM4JQvcu .
ok...it is chromeDriver_Win32 published in seleniumhq.com and updated one.
Regards, Avijit
selenium-chrome-driver-2.45.0.jar is quite an old version, so it may be an issue with the selenium version. Try making sure the selenium driver is the same one as the one used by serenity (the simplest way is simply to let Serenity take care of the selenium dependencies)
Hi John,
When I am giving getDriver.get("url") in login page that time, it is navigated to login steps and doing necesary action and then closing the instance.Then when CustomerCheck steps is executed then again trying to open a chrome browser, and similarly for Logout steps another browser.But all this Steps are maintained in a StepDefinition Java class and serenity WebDriver should pass through in a single session testing @login ,Then @CustomerCheck@ and @logout in single unified session.This is causing the problem for me. Can you please check my code for StepRunner, Stepdefinition and PageObject files.
Also I have mentioned Serenity properties file
On Thu, Jul 21, 2016 at 1:08 AM, John Ferguson Smart < notifications@github.com> wrote:
selenium-chrome-driver-2.45.0.jar is quite an old version, so it may be an issue with the selenium version. Try making sure the selenium driver is the same one as the one used by serenity (the simplest way is simply to let Serenity take care of the selenium dependencies)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/serenity-bdd/serenity-cucumber/issues/65#issuecomment-234058439, or mute the thread https://github.com/notifications/unsubscribe-auth/ASTiuO-9kX155EubFmEEhFRncJzW7XvOks5qXnkrgaJpZM4JQvcu .
Sorry , I got disconnected.
Properties files is mentioned as below: webdriver.driver=CHROME webdriver.chrome.driver=C://Cucumber//chromedriver_win32//chromedriver.exe serenity.use.unique.browser=true
Also the jars used:
selenium-remote-driver-2.45.0.jar selenium-server-2.45.0.jar selenium-support-2.45.0.jar serenity-cucumber-1.1.1.jar serenity-junit-1.0.47.jar serenity-maven-plugin-1.1.37-rc.6.jar serenity-report-resources-1.0.47.jar serenity-rest-assured-1.1.37-rc.6.jar gherkin-2.12.2.jar cucumber-core-1.2.2.jar cucumber-html-0.2.3.jar cucumber-jvm-deps-1.0.3.jar core-1.0.47.jar cobertura-2.1.1.jar cucumber-core-1.2.4.jar cucumber-java-1.2.4.jar cucumber-junit-1.2.4.jar cucumber-jvm-deps-1.0.5.jar cucumber-reporting-0.1.13.jar cucumber-reporting-2.5.0.jar cucumber-testng-1.2.4.jar gherkin-2.12.2.jar gherkin-4.0.0.jar junit-2.11.7.jar
mockito-all-2.0.2-beta.jar testng-142.1.jar
Seeking your help and suggestion for resolution
Regards, Avijit Dutta
You should avoid using getDriver() directly, and in particular calling quit() from inside the tests - Serenity will manage the driver lifecycle for you. There are also many conflicting versions in the list above - the simplest thing would be to study the tutorials (e.g http://testerstories.com/2016/06/java-automation-with-serenity/, http://serenity-bdd.info/#/documentation and http://johnfergusonsmart.com/presentations/serenity-bdd-tutorial-1-introduction-web-testing-serenity-bdd/), start a fresh project using the Maven archetypes, and then integrate the test logic from the above code.
Hi John,
Thanks for your inputs.I am working in corporate VM and do not have privileges to create maven project as it will download third party plugin.I have tried to do so using Maven archetypes but build got failed due to lack of permission. So for an workaround I have created a Java projects and downloaded all the requisite jars from search.maven.org and then added in build path to create an error free project. I am using serenity BDD with cucumber junit and running Test Runner class where I am defining all the features, steps, tags etc to create the testcases as defined above. Also I cant see serenity reports for each of steps mentioned step definition file but cant see no aggregated reports which include charts and graphs. Even I tried to execute maven sereniy:aggregate report but its not working due network admin issues not allowing other software to be downloaded.
Can you please suggest is this the best way to implement Serenity BDD ?or do i need all the requisite permission(admin rights) to create a maven project for using the serenity features and concepts.what is the best practice to get success out of serenity cucumber. One more thing is it better to use jbehave or cucumber with serenity ??what is the pros and cons for both
Please suggest
Regards, Avijit
Hi John,
As sugegsted by you..I have created a Maven archetype projecte using Serenity , Jbehave and Junit. Also writing scenarios in a story file(.story lcoation). But I have few queries...How to run specific story from TestSuite as Junit ?I am trying to run but seemed failing. Also Need to how to run specific story file from Maven Command Line.
Please help me in this regard.
Thanks and Regards, Avijit Dutta
Closing the Issue now and As multiple browser issue is seemed to be resolved
Thanks for the update Avijit.
Hi,
I am working on serenity -cucumber projects with testrunner class, stepdefinition class , and individual page object abstraction is mentioned here. I have also mentioned in serenity.properties file
serenity.properties: webdriver.driver=CHROME webdriver.chrome.driver=C://Cucumber//chromedriver_win32//chromedriver.exe serenity.use.unique.browser=true
My issue is that I am combining 3 feature file with filtering tags to create a testcase .But chrome driver is invoking 3 times without doing anything and consequently tests are failing.
testrunner class: (Directory :test.resources.run) package test.resources.run; import java.io.File; import java.util.HashMap; import java.util.Map; import org.junit.BeforeClass; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; import org.openqa.selenium.WebDriver; import net.serenitybdd.cucumber.CucumberWithSerenity; import net.serenitybdd.junit.runners.SerenityRunner; import net.thucydides.core.annotations.Managed; import net.thucydides.core.annotations.ManagedPages; import net.thucydides.core.annotations.Steps; import net.thucydides.core.pages.Pages; import net.serenitybdd.cucumber.SerenityReporter; @RunWith(CucumberWithSerenity.class) @CucumberOptions( features = "src/test/resources/features" ,glue={"test/resources/steps"} ,tags={"@Login,@ProfileCheck,@Logout"}
public class TestRunner {
}
I have 3 feature files namely alogin.feature,bdpacheck.feature and clogout.feature
Directory(test.resources.features) alogin.feature Feature: Login Action
@Login Scenario: Successful Login with Valid Credentials Given User is on Home Page When User enters UserName and Password |Fields | Value| |username | UserID| |pwd| Pwd| Then Message displayed Login Successfully
bdpacheck.feature Feature: DPA Check in HomePage
@ProfileCheck Scenario:Customer Profile Check Given the agent has performed search for customer "Cust Name" in HomePage And the search result returns a list of customer When the agent has selected the customer "Mr Cust Name" Then the agent can view corresponding customer profiles within customer
clogout.feature Feature: Logout action
@Logout Scenario: Successful LogOut When User LogOut from the Application
Then Message displayed LogOut Successfully
StepDefinition file
Directory (test.resources.steps) TestStpes.java
package test.resources.steps;
import java.util.concurrent.TimeUnit;
import java.util.ArrayList; import java.util.Base64; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Set;
import org.apache.log4j.Logger; import org.junit.Test; import org.apache.log4j.LogManager; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.PageFactory; //import org.testng.annotations.BeforeTest; import cucumber.api.DataTable; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import net.thucydides.core.annotations.Step; import test.resource.connexcase.config.Config; import test.resource.connexcase.steps.*; import net.serenitybdd.junit.runners.SerenityRunner; import net.thucydides.core.annotations.Managed; import net.thucydides.core.annotations.ManagedPages; import net.thucydides.core.annotations.Steps; import net.thucydides.core.pages.Pages;
public class TestSteps {
}
and the corresponding step library are LoginSteps.java,CustomerCheckSteps.java and LogoutSteps.java are placed under test.resource.connexcase.steps
LoginSteps.java,
package test.resource.connexcase.steps;
import org.junit.Test; import org.openqa.selenium.WebDriver;
import cucumber.api.DataTable; import test.resource.connexcase.config.Config; import test.resource.connexcase.pages.HomePage; import net.thucydides.core.annotations.Step;
public class LoginSteps {
}
CustomerCheckSteps.java
package test.resource.connexcase.steps;
import org.junit.Test; import org.openqa.selenium.WebDriver; import test.resource.connexcase.config.Config; import test.resource.connexcase.pages.SearchAndCustprofileCheck; import net.thucydides.core.annotations.Step;
public class CustomerCheckSteps {
} LogoutSteps.java
package test.resource.connexcase.steps; import org.junit.Test;
import test.resource.connexcase.pages.LogoutApp; import net.thucydides.core.annotations.Step;
public class LogoutSteps {
}
The pgaeObject classed are mentioned below for each of Login(HomePage.java),CustomerCheck(SearchAndCustprofileCheck.java) and Logout(LogoutApp.java)
HomePage.java
package test.resource.connexcase.pages; import test.resource.connexcase.config.Config; import test.resources.steps.TestSteps; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.pagefactory.*; import cucumber.api.DataTable; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.core.pages.WebElementFacade; import net.thucydides.core.annotations.DefaultUrl; import net.thucydides.core.annotations.Managed; import net.thucydides.core.annotations.ManagedPages; import net.thucydides.core.pages.Pages;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.Base64; import java.util.List; import java.util.concurrent.TimeUnit;
public class HomePage extends PageObject{
}
SearchAndCustprofileCheck.java
package test.resource.connexcase.pages;
import test.resources.steps.TestSteps; import test.resource.connexcase.config.Config; import test.resource.connexcase.pages.HomePage; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.core.*; import net.serenitybdd.core.pages.WebElementFacade; import net.thucydides.core.annotations.DefaultUrl; import net.thucydides.core.annotations.Managed; import net.thucydides.core.guice.Injectors; import net.thucydides.core.webdriver.WebdriverManager;
import java.util.Base64; import java.util.List; import java.util.concurrent.TimeUnit;
public class SearchAndCustprofileCheck extends PageObject {
}
LogoutApp.java
package test.resource.connexcase.pages; import test.resources.steps.TestSteps; import test.resource.connexcase.config.Config; import test.resource.connexcase.pages.HomePage; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.core.pages.WebElementFacade; import net.thucydides.core.annotations.DefaultUrl; import net.thucydides.core.annotations.Managed;
import java.util.Base64; import java.util.concurrent.TimeUnit;
public class LogoutApp extends PageObject{
}
Can you please help me in this regards?As each time I tried to execute testrunner.class as junit testcases , it basically trying to open 3 blank chrome page but without doing nothing although defined all properties in serenity.properties along with default.url. I want entire flow to be executed in a single chrome driver session instead of opening 3 chrome browser.
Please help me to resolve this.
Regards, Avijit Dutta