Serenity BDD test cases are not running on Chrome browser - junit4

My Serenity BDD test cases are running fine on firefox when I used below annotations in step definition file:
#Managed
public WebDriver driver;
I wanted to run same test cases on chrome browser. So, modified it as below:
#Managed(driver = "chrome")
WebDriver driver;
Also tried below one:
#Managed(driver = "chrome")
ChromeDriver driver;
In both the above cases, my test cases are still running by opening Firefox instead of Chrome.
I followed the exact steps as per mentioned in Serenity BDD guide.
Can you please help me to know, how to execute Serenity BDD test scripts by opening Chrome. Thanks in advance for your help.

I haven't used Serenity yet but I had some experience with Thucydides (Senerity's predecessor). What I did in Thucydides to add Chrome support is by editing the thucydides.properties file (typically in src/test/resources) to add these lines:
webdriver.driver=chrome
webdriver.chrome.driver = C:\\chromedriver\\chromedriver.exe
It might work similarly in Serenity.

I know this can be little frustrating. I am assuming this is a maven project.
You have done the first step correct by defining:
#Managed(driver = "chrome")
WebDriver driver;
Ensure that in the pom.xml, you have provided the chromedriver.exe
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<webdriver.driver>chrome</webdriver.driver>
<webdriver.chrome.driver>chromedriver.exe</webdriver.chrome.driver>
<properties>
Hope this helps. Let me know

Download the chrome web driver exe file (for mac) or jar file (for windows) and place it your project directory. Download from here.
If you have installed maven manually (and not depending only on Maven plugin in Eclipse), you can run the tests in chrome browser by :
Open command prompt
Navigate to the directory where you have the POM file for the project.
Execute the command - mvn clean verify -Dwebdriver.driver=chrome

Related

Run/Debug Apache Fineract using Eclipse??

Github guides suggest building the war and running in embedded tomcat through gradle wrapper....
This takes a lot of time to implement code changes.....I would like to run the project from Eclipse/IntelliJ and debug, hot code replacement, etc.
The wiki guides to do this are outdated, did not worked for me because there are problems in the build path, the main class cannot be found, etc.
https://github.com/MifosX-WITH-PENTAHO/incubator-fineract
Apparently, the only way to do run/debug the project is running using embedded gradle task and attaching remote debugger to it:
http://osdir.com/apache-fineract-developers/msg02767.html

Running GWT application in production mode

I am newbie to GWT. I have built gwt maven project. To run in development mode, I first compiled project Google|Compile Project, then from command mvn gwt:run, it runs fine on
http://localhost:8888/index.html?gwt.codesvr=127.0.0.1:9997
but for production I want to access module
http://localhost:8888/index.html
When I omit gwt.codesvr= argument, I am getting error "gwt module may need to be recompiled". After Recompiling, I get the same error. Any help/pointer?
Thanks,
i run gwt project on tomcat on production mode. Jetty cant show it. Try to tun with external web module. When you are look at the IDE console title show us 'Development Mode'. Tyr with external , in any exception i can help.
You did it correctly, but as the error states, the module needs to be re-compiled (GWT Compiled). Once recompiled, Force your browser to reload (Ctrl + F5). If that doesn't work, you can look at this answer I wrote regarding cleanup of compiled output. Do what's listed there, and try running GWT compile again.
To run production mode outside Eclipse, you must do a GWT compile and create a WAR file, which you can then deploy on a Java application server such as Tomcat. This process is much easier with an ant build script.
To make an ant build script for your project:
You can easily create an ant build script by running the webAppCreator command from the directory where the GWT library is installed. That command will create a sample project just like clicking "New Web Application Project" in Eclipse, except it will also make a build.xml file.
You can run it in Eclipse by right clicking build.xml > Run As... > Ant build. By default it will run the build target. It also has a war target, which you can run to create a WAR file.
For more details on the webAppCreator, look here.

How to test an application as JUnit-Plugin test in Eclipse

I am trying to set up a JUnit Plugin test for a RCP-Application. Thereby I am using Tycho (0.18), maven 3.0.2, eclipse INDIGO and JUnit4.
When I configure a Plugin Test, the to be tested application starts as expected, but the chosen test case does not run. Whereby I do not get any error or exception messages.
Because I did not find anything with google, I would be very happy if someone could provide some helpful information or tutorials.
Update: I have found this tutorial: How to JUnitPluginTests. But the UnitTests didn't start without any error message...
I have the assumption that the JUnit-Plugin-Test launcher does not work in a correct manner. Because I have to define my application separately in the arguments tab, else the following error appears:
Application "org.eclipse.pde.junit.runtime.nonuithreadtestapplication" could not be found in the registry
Have you checked Christian Pontesegger's tutorial on Tycho, which includes a post about tests?
I had apparently the same problem. I tried a number of things, but what worked for me was:
Open the run configuration
Switch to the Main tab
Select 'Run an application'
Select '[No Application] - Headless mode'
I didn't need to run my product and this allowed the JUnit plug-in test runner to locate the unit tests.

Running PlayN in HTML DevMode

I'd like to be able to run my PlayN project as a Web Application in DevMode, so that I can use a quick browser refresh to see code changes without having to recompile. From what I'm reading on the wiki and on this question it sounds like that should be possible.
I set up my project using: mvn archetype:generate -DarchetypeGroupId=com.googlecode.playn -DarchetypeArtifactId=playn-archetype -DarchetypeVersion=1.7 and importing the pom.xml into eclipse.
Here's what I can do:
Run from eclipse as a Java Application
Start the server using Maven command line: mvn -Phtml integration-test
While I can do most of my programming in Java and occasionally do the long build to test HTML, I'd love to be able to modify the code while testing HTML without recompiling.
By default, the option to run as a Web Application doesn't show up. I've tried going into the project's properties and checking the "Use Google App Engine" and "Use Google Web Toolkit" options, which creates the "Run As Web Application" option, but when I do so I get "Could not find any host pages in project XXX".
I then attempt to set a WAR directory under Properties->Google-Web Application. However, the closest thing to a WAR in the project is "src/main/webapp". I've tried using that, and I get the error: "The archive: /myproject-assets/src/main/java which is referenced by the classpath, does not exist."
I have the feeling I'm going about this all wrong. Can anyone point me in the right direction? Is what I'm doing even supposed to be possible? Thanks!
It is possible, but just know that in dev mode, playn runs very slow.
I don't know how to do this with eclipse, but with intelli IDEA, you do the following:
you need to create a module with a war artifact (to run as a server)
add the correct gwt libraries so that you can run gwt dev mode server with the aforementioned war module.
choose a GAE server (or, any gwt compatible server actually, this will be the server that runs the aformentioned war module).
run it! see this screenshot http://screencast.com/t/qK4JKvF33V
when you change code, the gwt devmode server should detect it, and automatically recompile (not sure if this needs to be in debug mode - i don't think it does).
you can try doing it via the command line, not sure if works, but this is what intellij runs (i've taken out the intellij specific bits out):
java -cp CLASSPATH_WITH_GAE_DEV_TOOLS_AND_GWT_DEV_TOOLS com.google.gwt.dev.DevMode
-war /path/to/war
-startupUrl Roborally.html com.yourgame.YourGwtEntryModule
-server com.google.appengine.tools.development.gwt.AppEngineLauncher

PlayN GWT/HTML, keeps insisting module must be (re)compiled

I created a new PlayN project from the 1.2 archetype using the command line given in the GettingStarted wiki page. I then imported this Maven Project into Eclipse, just bringing in the core, java, and html modules. If I right-click the Java project, I can choose my main class, and a window pops up with the background image shown. Note that I've done no real programming yet: I'm just using the default project configuration.
Next, I used GWT-compile through Eclipse on the HTML project, and I got no errors. When I run it as a Web application by using the provided URL (without removing the "?gwt.codesvr=127.0.0.1:9997" bit), the application runs fine aside the Eclipse Console gives a warning about being in Development Mode. (Specifically, "You are running in GWT Development Mode. For optimal performance you may want to use an alternative method.")
However, if I run the application the recommended way, by removing the gwt.codesvr parameter, then I keep getting a dialog box saying "GWT module 'testproject' may need to be (re)compiled."
After reading How do I run a maven/eclipse/GWT/playN app in production mode?, I tried doing mvn test -Ptest-html
and then pointing my browser at http://localhost:8080, but it gives the same error.
Am I doing something wrong?
(EDIT: I have no idea if this next point is significant or not, but I'll share it anyway. When I try to create a project from Eclipse, the newest PlayN archetype I can see is 1.0.3, even after telling Eclipse to update the Maven index. I'm running Eclipse Indigo.)
I guess you are running PlayN 1.0.3.
There is a bug in 1.0.3:
So you need to do the following:
Run GWT-Compile
Run the web application and get the error message: "GWT module 'testproject' may need to be (re)compiled."
Run again GWT-compile, while the Web-Application is running
Reload your browser with CTRL-F5
The important step is step 3.
Note:
You can update to PlayN 1.2 to get rid of the error. For this you have to change the file playn-showcase/pom.xml.
Change the line
<version>1.0.3</version>
to
<version>1.2</version>