Geb/Spock Error- No reports dir has been configured, you need to set in the config file or via the build adapter - intellij-idea

I have trouble running my functional test from IntelliJ IDE. When I run the functional test, I got the following error message:
java.lang.IllegalStateException: No reports dir has been configured, you need to set in the config file or via the build adapter.
at geb.Browser.getReportGroupDir(Browser.groovy:899)
at geb.Browser.cleanReportGroupDir(Browser.groovy:932)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56)
at geb.spock.GebReportingSpec.setupSpec(GebReportingSpec.groovy:37)
Based on my research, all I need to do is to add the following code in GebConfig.groovy:
reportsDir = new File("target/runtime_reports_dir")
I added the line to GebConfig.groovy and rebuild the project, but still running into the same issue. Is there any other fix to this error?

Adding reportsDir = 'target/geb-reports' to your GebConfig shoud fix this, can you show me your GebConfig file?
There is also another fix for it, your test class extends GebReportingSpec, you can chage it to GebSpec and it should also work.

I had this same issue, while having the reportsDir correctly configured in the GebConfig
Adding the resources folder (where my GebConfig is located) as "Test Sources Root" did the trick for me
To mark the folder as "Test Sources Root":
Right click in the folder
Mark Directory as
Test Sources Root
Happy testing!

Related

Neovim gkeep plugin

I installed gkeep plugin for Neovim (https://github.com/stevearc/gkeep.nvim) and didn't like it. I removed it from my plugins (I use vim-plug) and run :PlugClean after that. But now I can't open neovim without error mentioning that gkeep plugin. How to fix this?
Error detected while processing function remote#define#request:
line 2:
Error invoking '/home/daniil/dotfiles/nvim/plugged/gkeep.nvim/rplugin/python3/gkeep:autocmd:BufEnter:*'
no request handler registered for "/home/daniil/dotfiles/nvim/plugged/gkeep.nvim/rplugin/python3/gkeep:
It's pointing to ~/dotfiles/nvim because I created symbolic link from ~/dotfiles/nvim to ~/.config/nvim.
Also, there is no directory gkeep.nvim inside plugged folder.
UPD: and this is my plugins
It seems that you haven't removed the configuration related to gkeep.nvim. Try to remove all settings related to gkeep.nvim.
Also, when you open neovim, run the command :UpdateRemotePlugins. It should solve your issue.

intellij "object index is not a member of package views.html"

I've got Intellij 15.0.5 and I cannot get rid of this error
object index is not a member of package views.
I've created a new play project in Intellij and also using the activator command
activator new PlayTestProject
But I keep getting the above error. I've read all the other similar question on SO but none of them helped and I've tried the following
Right click the project -> Add framework support -> select "Play 2"
Result: I didn't see any change to my project. When I hit OK, the window disappears but if I try the same the second time. Nothing happens and the window is still there!
Preferences -> Languages & Frameworks -> Play2 -> select "Use Play 2 compiler for this project"
Result: I get this error
Error:Module 'client' production: java.lang.NullPointerException
I've tried
invalidate cache & restart
sbt clean
checkout a fresh new project
But I keep getting the same error in Intellij.
Running sbt compile on command line runs the build successful. But Intellij keeps shows me the above error.
How do I fix this ?
Alright if anyone is running into the same problem. The fix was to mark the following two directories as Sources Roots in Intellij.
/target/twirl/main
/target/routes
Steps:
Right click the target folder -> Mark directory as -> Cancel exclusion (If you don't see Cancel exclusion do the next step.
Right click the target/scala-2.11/twirl/main folder -> Mark directory as -> Sources Root
Right click the target/scala-2.11/routes folder -> Mark directory as -> Sources Root
Right click the project Open module settings -> Sources -> and remove the above two directories if there are added in the Excluded folder's section.
This fixed my problem.
I found this problem and it appeared to be caused by an incomplete compile within sbt. (I had done "sbt clean ; sbt compile" but then aborted the compile with Ctrl+C because it had a error.)
Intellij worked correctly again after I ran:
sbt clean
After removing the .idea/ folder, I could successfully re-open/import my project, and the errors were gone.
Just remove the #() from top of index.scala.html because there are no parameters.
#()
<!DOCTYPE html>
<html lang="en">
And in Action you have
def index = Action {
Ok(views.html.index())
}
I had a similar error and just had to run npm install to fetch the necessary dependencies. Listing it here in case anyone has the same issue.

F4 IDE gives "Invalid Uri scheme for local file" when running Fantom app

I started a very simple project using Xored's F4 IDE for Fantom. The first few times I ran it there was no error, but I started adding dependencies (fanbatis) and at some point the error below starting showing up every time I run a test or a dummy Hello World app.
[23:44:18 22-Nov-13] [err] [pathenv] Cannot parse path: C:\dev\f4workspace\auth\bin\fan
sys::ArgErr: Invalid Uri scheme for local file: c:\dev\f4workspace\auth\bin\fan/
fan.sys.LocalFile.uriToFile (LocalFile.java:64)
fan.sys.File.make (File.java:26)
util::PathEnv.parsePath (PathEnv.fan:47)
fan.sys.List.each (List.java:555)
util::PathEnv.parsePath (PathEnv.fan:43)
util::PathEnv.make$ (PathEnv.fan:22)
util::PathEnv.make (PathEnv.fan:20)
java.lang.reflect.Method.invoke (Unknown)
fan.sys.Method.invoke (Method.java:559)
fan.sys.Method$MethodFunc.callList (Method.java:198)
fan.sys.Type.make (Type.java:246)
fan.sys.ClassType.make (ClassType.java:110)
fan.sys.Type.make (Type.java:236)
fan.sys.Sys.initEnv (Sys.java:447)
fan.sys.Sys. (Sys.java:224)
fanx.tools.Fan.execute (Fan.java:28)
fanx.tools.Fan.run (Fan.java:298)
fanx.tools.Fan.main (Fan.java:336)
Hello, World!
It is more a nuisance at the moment because the tests and the dummy app still run. I created another project, copying all the source code adding class by class and testing after each change and the error never occurred. Any ideas please?
That's an interesting issue!
tl/dr: you have an empty project 'auth' in your workspace, either create some dummy class inside it or go to Run -> Run configurations, find your launch config and uncheck project without sources on 'Projects' tab.
In order to keep your Fantom installation clean from projects in a workspace, F4 puts built pods into project/bin/fan/lib/fan. When F4 launches projects from workspace, it uses PathEnv and builds FAN_ENV_PATH by joining paths to Fantom installation and bin/ folders in projects in workspace.
When Fantom runtime analyzes FAN_ENV_PATH, at first it interprets a path as native OS path, but if dir does not exist, it attempts to interpret it as file URI, here's relevant part of PathEnv source:
path.split(File.pathSep[0]).each |item|
{
if (item.isEmpty) return
dir := File.os(item).normalize
if (!dir.exists) dir = File(item.toUri.plusSlash, false).normalize
if (!dir.exists) { log.warn("Dir not found: $dir"); return }
The problem code is item.toUri – On Mac OS X and Linux this is parsed as an URI without scheme with path only, so if directory does not exist, this code just prints a warning in a console.
But on Windows, because of disk name in path, disk name is interpreted as scheme:
fansh> "C:\\Users".toUri { echo(path); echo(scheme) }
[\Users]
c
fansh> "/Users".toUri { echo(path); echo(scheme) }
[Users]
null
And then File constructor fails, because expects either 'file' scheme, or null scheme:
public static java.io.File uriToFile(Uri uri)
{
if (uri.scheme() != null && !uri.scheme().equals("file"))
throw ArgErr.make("Invalid Uri scheme for local file: " + uri);
return new java.io.File(uriToPath(uri));
}
I've created an issue here, so that F4 would automatically skip empty projects when building FAN_ENV_PATH – https://github.com/xored/f4/issues/25.
I thought the problem had something to do with the forward slash at the end of path as shown in this line of the error message
Invalid Uri scheme for local file: c:\dev\f4workspace\auth\bin\fan/
However, I found that such path didn't exist. I manually created both the bin and the fan folders and the error disappeared. To be honest I don't really know why F4 needs and checks for that folder because so far it hasn't written any file in it.

Apache Directory LDAP API - getting up and running

When I try and run a test using the Apache LDAP API, I am getting the following error. I set up a Maven project , and my pom.xml has many dependencies for the Apache Directory server and API artifacts. My code (which I copied and pasted an example, just to get up and running, so that I can explore) all builds fine. However, when I run it (as a Junit Test), I get the following....
Can anyone help me? maybe even just provide an example of where the Apache LDAP API is being used successfully, and maybe give me the pom.xml with the correct dependencies also? (The apche LDAP API documentation seems to be out of date).
I am currently starting the test using the embedded Apache Directory server, using the following...
#RunWith(FrameworkRunner.class)
#CreateLdapServer(transports =
{
#CreateTransport(protocol = "LDAP") ,
#CreateTransport(protocol = "LDAPS") })
// disable changelog, for more info see DIRSERVER-1528
#CreateDS(enableChangeLog = false, name = "PasswordPolicyTest")
public class PasswordPolicyIT extends AbstractLdapTestUnit
{ .......etc }
So, therefore, an alternative approach, is that if I tailor some of the tests to just connect to a local Directory Server instance that I have running on my machine. I assume that this would stop the error messages that I am getting below..Again, if anyone could provide a code snippet there, it would be useful..
Many Thanks
> 2013-06-20 16:05:10 ERROR FrameworkRunner:287 - Problem locating LDIF
> file in schema repository Multiple copies of resource named
> 'schema/ou=schema/cn=apachemeta/ou=matchingrules/m-oid=1.3.6.1.4.1.18060.0.4.0.1.3.ldif'
> located on classpath at urls
> jar:file:/Users/rk/.m2/repository/org/apache/directory/api/api-ldap-client-all/1.0.0-M17/api-ldap-client-all-1.0.0-M17.jar!/schema/ou%3dschema/cn%3dapachemeta/ou%3dmatchingrules/m-oid%3d1.3.6.1.4.1.18060.0.4.0.1.3.ldif
> jar:file:/Users/rk/.m2/repository/org/apache/directory/shared/shared-ldap-schema-data/1.0.0-M7/shared-ldap-schema-data-1.0.0-M7.jar!/schema/ou%3dschema/cn%3dapachemeta/ou%3dmatchingrules/m-oid%3d1.3.6.1.4.1.18060.0.4.0.1.3.ldif
> jar:file:/Users/rk/.m2/repository/org/apache/directory/server/apacheds-all/2.0.0-M12/apacheds-all-2.0.0-M12.jar!/schema/ou%3dschema/cn%3dapachemeta/ou%3dmatchingrules/m-oid%3d1.3.6.1.4.1.18060.0.4.0.1.3.ldif
You need to exclude the shared-ldap-schema-data dependency from apacheds-all. Take a look at this comment

Does PHPUnit_Selenium Code Coverage Work?

In the PHPUnit docs, it says that it's possible to get code coverage data:
PHPUnit_Extensions_SeleniumTestCase can collect code coverage information for tests run through Selenium:
Copy PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php into your webserver's document root directory.
In your webserver's php.ini configuration file, configure PHPUnit/Extensions/SeleniumTestCase/prepend.php and PHPUnit/Extensions/SeleniumTestCase/append.php as the auto_prepend_file and auto_append_file, respectively.
In your test case class that extends PHPUnit_Extensions_SeleniumTestCase, use
protected $coverageScriptUrl = 'http://host/phpunit_coverage.php';
to configure the URL for the phpunit_coverage.php script.
I haven't been able to get this to output any coverage information. I am able to get code coverage info through normal unit tests.
For my app running at http://localhost/ts2_templates/ I've copied phpunit_coverage.php to http://localhost/phpunit_coverage.php.
I've added the following to php.ini:
auto_prepend_file = "/path/to/pear/share/pear/PHPUnit/Extensions/SeleniumTestCase/prepend.php"
auto_append_file = "/path/to/pear/share/pear/PHPUnit/Extensions/SeleniumTestCase/append.php"
... and verified they are being called with a die("yep it's me");.
Finally, I added the following to my test case:
<?php
class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
# added line below
protected $coverageScriptUrl = 'http://localhost/phpunit_coverage.php';
protected function setUp()
{
$this->setBrowser('firefox');
$this->setBrowserUrl('http://localhost/ts2_templates');
}
public function testTitle()
{
$this->url('http://localhost/ts2_templates');
$this->assertContains('test', $this->title());
}
}
?>
Here's the command for running the test with code coverage, generated by PHPStorm:
/Applications/MAMP/bin/php5.3/bin/php -dxdebug.coverage_enable=1 /private/var/folders/pp/0t4y41f95j5313qm_f8b42fw0000gn/T/ide-phpunit.php --coverage-clover /path/to/coverage/ts2_templates$WebTest.coverage --no-configuration WebTest /Users/Ian/php/ts2_templates/tests/WebTest.php
Heres the output of the coverage XML file:
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1341015508">
<project timestamp="1341015508">
<metrics files="0" loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</project>
</coverage>
The test itself passes.
I have verified there are no exit or die statements anywhere in the code.
Any ideas?
I also had some issues getting things to work. The following post in the YII forum by Samuel Goldstein helped me out:
I ended up moving the prepend.php and append.php into my project's document root.
I also found that the temporary file location made a difference - I originally was trying to save them to /tmp/ and PHP was silently failing. When I changed $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] to myroot/protected/runtime/tmp and did a chmod 777 on that directory, it started working.
One thing that might frustrate you a bit is that code run through Ajax does not get flagged as being covered.
This appears to be a known problem with Selenium. Google "github sebastianbergmann phpunit-selenium issues" and track down closed issue #22 for more information.
It is definitely working. I have set up selenium tests in symfony measuring the coverage according to the documentation.
The biggest issue I had was, that the coverage data had the wrong path to the files in it, and therefore could not align the sources with the coverage data. This is because I executed tests from a different place, as the server kept the files in. Therefore I tweaked the append.php to rewrite the path to the place where my source files are.