سؤال

I'm using the example project at https://github.com/geb/geb-example-grails

For some reason, when I run grails test-app functional: it doesn't pick up any tests. It says...

|Loading Grails 2.3.1
|Configuring classpath
.
|Environment set to test
........................................................
|Tests PASSED - view reports in C:\Users\user\src\geb-example-grails\target\test-reports

No browser is opened (what I'm used to with webdriver) and when I view target\test-reports\html\all.html I get...

Unit Test Results - All tests

No tests executed.

I've tried executing with

  • grails test-app functional:
  • grails test-app -functional
  • grails test-app

None appear to run any tests. I've also upgraded the project to grails 2.3.6 with the same result. Am I running the tests incorrectly? Has anyone else had this issue?

Update

I was able to reproduce this problem on my Mac in addition to the Windows 7 machine. When I run on the Mac with...

grails test-app -Dwebdriver.chrome.driver=/Applications/Google\ Chrome.app/Contents/MacOS/chromedriver

Then no tests are run and it reports that all tests pass. (same as the windows machine)

However, when I run via

grails test-app

The tests are run, Google Chrome is launched but no navigation takes place (I suspect I have an outdated chromedriver somewhere in the PATH on the Mac.)

Update 2

After running with...

grails test-app -Dgeb.env=firefox

The tests are found and executed. No nagivation takes place until updating the BuildConfig.groovy with the latest selenium (2.40.0, a webdriver issue I'm familiar with).

With this in mind, I decided to check that the chromedriver was installed properly. While I had placed the chromedriver.exe in the same location as google chrome. I hadn't added that location to my PATH. After doing so... Eureka! Tests run and execute with 100% Passed! Thanks @spikeheap for your suggestion! It appears that tests won't run unless you have the webdriver for your browser setup properly (strange to me, but ok).

هل كانت مفيدة؟

المحلول

I can't reproduce that error. Using 2.3.1 the tests are executed. Have you got the ChromeDriver present? If not I'd expect to see a load of errors...

You could try grails test-app functional: -Dgeb.env=firefox which will attempt to use the FirefoxDriver. If you've got Firefox installed this should work without any additional configuration.

If that doesn't give you anything, try grails test-app functional: PersonCRUDSpec, which will explicitly try to run that test.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top