Integration Tests - muymoo/openmrs-core GitHub Wiki

We are still working on getting the integration tests running properly.

Things still to investigate:

  • Why are we getting test failures that don't seem like they should fail (waits didn't help)
  • How do we setup the database for all the tests to pass?

Trying to follow instructions here: https://wiki.openmrs.org/display/docs/Testing+Releases, but they are pretty out of date (example: there is no "integration-test" profile anymore, which is referred to everywhere here)

Run the tests using your database/OpenMRS instance

mvn integration-test -DskipTests -P smoke-test-without-server -Dtest=* -Dmysql_username=root -Dmysql_password=pass -Dmysql_port=3336 -Dopenmrs_username=admin -Dopenmrs_password=test -Ddatabase_name=openmrs

I can successfully see the tests log in to the app, but they are failing. I removed all tests except the login_to_website.story and I see errors like below. I fixed the log4j dependency error by adding log4j as a plugin dependency.

Make sure you're at the latest Firefox and update the Selenium version in the pom.xml to 2.43.1.

Once your run the tests as above, you can see the results by looking at target/jbehave/view/index.html. Choose the second option to view passes/failures.

We are still getting lots of assertion failures, but adding waits doesn't seem to help

Important: The build ALWAYS says Build Successful, even when tests fail!!

(BeforeStories)

[INFO] Running story org/openmrs/stories/go_to_admin_page.story

(org/openmrs/stories/go_to_admin_page.story)
Scenario: Go to admin page
GivenStories:
org/openmrs/stories/login_to_website.story 


(org/openmrs/stories/login_to_website.story)
Scenario: Login to website
Given I am on the login page of OpenMRS
When I enter username and password as stored in system properties as openmrs_username and openmrs_password and click the 'Log In' button
OpenMRS - Home
org.openqa.selenium.lift.find.PageTitleFinder@5d52d42
Then take me to the Home screen and display welcome message for user Super


Given I am on Home screen (FAILED)
(java.lang.AssertionError: 
Expected: a value greater than <0> page title with text "OpenMRS - Home"
     got: <0> page title with text "OpenMRS - Home"
)
When I click on the Administration link (NOT PERFORMED)
Then take me to Administration page (NOT PERFORMED)


[WARNING] Failed to run story org/openmrs/stories/go_to_admin_page.story
java.lang.AssertionError: 
Expected: a value greater than <0> page title with text "OpenMRS - Home"
     got: <0> page title with text "OpenMRS - Home"

	at org.openmrs.CustomWebDriverContext.failWith(CustomWebDriverContext.java:114)
	at org.openmrs.CustomWebDriverContext.assertPresenceOf(CustomWebDriverContext.java:71)
	at org.openmrs.CustomWebDriverContext.assertPresenceOf(CustomWebDriverContext.java:53)
	at org.openmrs.Steps.assertPresenceOf(Steps.java:65)
	at org.openmrs.steps.AdminSteps.onHomePage(AdminSteps.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.jbehave.core.steps.StepCreator$ParameterisedStep.perform(StepCreator.java:533)
	at org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:474)
	at org.jbehave.core.embedder.StoryRunner.runStepsWhileKeepingState(StoryRunner.java:454)
	at org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:418)
	at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:293)
	at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:211)
	at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:172)
	at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229)
	at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:724)

(AfterStories)

Run tests using a brand new fresh database (takes a while)

mvn integration-test -DskipTests -P release-test -Dtest=* -Dmysql_username=root -Dmysql_password=root -Dmysql_port=3336 -Dopenmrs_username=admin -Dopenmrs_password=Admin123 -Ddatabase_name=openmrsReleaseTest 

No one has successfully gotten this working from our team yet... I personally see errors like something is running on the mysql port (even though I kill mysql before starting the script...?) --> Matt, did you get it working??