Single quote in double quote test name of Spock test leads to 'unexpected token', BUT only when run with gradle and as isolated test - gradle

I just installed intellij and downloaded the geb-example-grade (https://github.com/geb/geb-example-gradle). In Intellij settings I configured under gradle/runner: Run test using: Let me choose per test. Then I ran the test "can get to the current Book of Geb" with gradle and it worked fine also running the GebishOrgSpec class worked fine. Then I added a single quote to the methodname of the test, i.e. "can ' get to the current Book of Geb". Running the GebishOrgSpec class (containing that test) with gradle still works fine. But when I run the test with gradle (i.e. after Alt-Shift-F10 in the run menu I choose "GebishOrgSpec.can ' get to the current Book of Geb" instaead of "GebishOrgSpec") i get the following error:
FAILURE: Build failed with an exception.
* Where:
Initialization script '/tmp/ijtestinit3.gradle' line: 6
* What went wrong:
Could not compile initialization script '/tmp/ijtestinit3.gradle'.
> startup failed:
initialization script '/tmp/ijtestinit3.gradle': 6: unexpected token: get # line 6, column 49.
ludes = ['GebishOrgSpec.can ' get to the
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Cause: startup failed:
initialization script '/tmp/ijtestinit3.gradle': 6: unexpected token: get # line 6, column 49.
ludes = ['GebishOrgSpec.can ' get to the
^
1 error
I also tried run running the test with Junit (after setting the driver path) that also works fine. For me it makes absolutely no sense that the very same test works when running the class but not when running the method of the class. Here just to be complete also the class code:
import geb.spock.GebSpec
class GebishOrgSpec extends GebSpec {
def "can ' get to the current Book of Geb"() {
when:
to GebishOrgHomePage
and:
manualsMenu.open()
then:
manualsMenu.links[0].text().startsWith("current")
when:
manualsMenu.links[0].click()
then:
at TheBookOfGebPage
}
}
Update: I had this behaviour on two different computers, but i would appreciate if others also test this. It should be fairly easy to reproduce (if there are questions on the description above, let me know.) Maybe u won't have the error and i have some bad configurations or u can confirm this bug and we raise the attention for it.

Related

An uncaught error was detected outside of a test

When I run all my component cypress tests locally on a Macbook pro on a react-vite project with around ~10 tests, I get the following error:
An uncaught error was detected outside of a test:
TypeError: The following error originated from your test code, not from Cypress.
> Failed to fetch dynamically imported module: http://localhost:5173/__cypress/src/cypress/support/component.ts
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
the error is not Consistant and doesn't show up on every run. It also throws on a random test every run. How can I solve this?
update: I think a possible lead could be that I import files on my project with the absolute paths pattern.
For example:
import {comp1, comp2} from 'components'
where as components is configured in my tsconfig.ts file
ok so after countless attempts to fix this and also encountering terminal freezes when I execute
cypress run.
I've gave up and created a bash script to run each of the tests in the code base separately:
set -x
#!/bin/bash
for file in $( find . -type f -name '*.spec.cy.tsx' );
do yarn cypress run --component --browser chrome --spec $file || exit 1
done
for now it seems to get the job done. Hope this helps anyone else that encounters this

Integrating Cypress with cucumber is failing

I created a simple Cypress project to automate a website and it was working. Now I am trying to convert it into a cucumber Project and when executing the test cases, I am getting below error:
Running: Features/shopping.feature (1 of 1)
[BABEL] Note: The code generator has deoptimised the styling of C:\Users\001ZGA744\Personal\Cypress\Cucumber\node_modules\lodash\lodash.js as it exceeds the max of 500KB.
1) An uncaught error was detected outside of a test
0 passing (941ms)
1 failing
1) An uncaught error was detected outside of a test:
TypeError: The following error originated from your test code, not from Cypress.
> (0 , _typeof4.default) is not a function
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
at _typeof2 (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:303:63)
at _typeof (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:317:39)
at eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:23486:2332)
at Object.eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32935:14)
at Object.eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32937:4)
at Object.254.C:\Users\001ZGA744\Personal\Cypress\Cucumber\node_modules\#babel\runtime/helpers/interopRequireDefault (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32937:17)
at o (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:265)
at eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:316)
at Object.169.babel-runtime/helpers/classCallCheck (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:9432:15)
at o (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:265)
This is how my Project Structure looks like:
I am unable to understand the reason of the issue.
Please suggest.
Please remember you need a stepDefinitions folder at least. And then, in the package.json file you should declare the Cypress Cucumber Preprocessor Style pattern.
Something like this:
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
Or:
"cypress-cucumber-preprocessor": {
"commonPath": "common",
"stepDefinitions": "step_definitions"
}
Depending on what you choose.

How do I resolve oracle jdbc proxy class error in Evosuite generated tests?

I've written a JDBC driver and I'm trying to use Evosuite to generate the tests for it.
I'm using the following command line:
mvn -Dcores=5 -DmemoryInMB=5000 -Dmock_if_no_generator=false -DextraArgs=' -Dmock_if_no_generator=false -Dskip_covered=true Duse_separate_classloader=false -Dmax_recursion=50 -Dlocal_search_restore_coverage=true -Duse_existing_coverage=true -Dsandbox=false -Dsort_calls=true 'evosuite:generate
The code that is generated is below:
oracle.1jdbc.1replay.1driver.1NonTxnReplayableBase.2java.1sql.1DatabaseMetaData...Proxy oracle_1jdbc_1replay_1driver_1NonTxnReplayableBase_2java_1sql_1DatabaseMetaData___Proxy0 = new oracle.1jdbc.1replay.1driver.1NonTxnReplayableBase.2java.1sql.1DatabaseMetaData...Proxy((DatabaseMetaData) null, "k-{`1N&KKC", proxyFactory0, hashtable0);
and I'm getting the following error on the first line:
:[4618,7] not a statement
:[4618,13] ';' expected
(getting this error three times on the same line)
I was hoping to turn off the mocking but it didn't work it seems.
I'll try to see if I can provide more details later, but any initial thoughts from anyone?
Thanks!

Sonar-web-frontend-helloworld execution error

I am running the hello world example
I generate the reports but when i come to run the sonar scan i get the very unhelpful exception of
-----------
09:42:56.279 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: 0 is not a valid line for a file
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument
(Preconditions.java:145)
[![Error description][1]][1]
Seems like a bug in the plugin that you use - https://github.com/groupe-sii/sonar-web-frontend-plugin
SonarQube API clearly states that first line in a file has number 1, but plugin passes 0.

Scaladocs build fails kafka

I am trying to build Apache kafka from source as explained here using gradle but I am not able to get scaladocs to build. Following is the error log for same:
== Expanded type of tree ==
ConstantType(value = Constant(kafka.utils.timer.TimerTaskList))
uncaught exception during compilation: java.io.IOException
File name too long
two errors found
:core:compileScala FAILED
:core:compileScala (Thread[Daemon worker,5,main]) completed. Took 1 mins 4.416 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':core:compileScala'.
> Compilation failed
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 13.736 secs
Stopped 1 compiler daemon(s).
Received result
CommandFailure[value=org.gradle.launcher.exec.ReportedException:org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':core:compileScala'.] from daemon DaemonInfo{pid=5656, address=[4d0d3e79-f94a-43ca-b183-792d2bfe1a95 port:55666, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=1f1f4b55-9da9-4283-b361-8b0bfce3f208,javaHome=/usr/lib/jvm/java-7-oracle,daemonRegistryDir=/home/akshat/.gradle/daemon,pid=5656,idleTimeout=120000,daemonOpts=-XX:MaxPermSize=512m,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]}.
Though I suspect it is a memory issue but I do not see any place of altering it. I tried editing here:
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = '1g'
jvmArgs = ['-XX:MaxPermSize=512m']
}
}
}
But it did not help.
Yes this is probably related to Gradle memory settings. You can increase the Gradle heap by setting the environment variable: set GRADLE_OPTS=-Xmx1024m (Windows) and it might work better.
The error was caused due to my home folder being encrypted. It seems that kafka has trouble installing in encrypted folders. I had to reinstall ubuntu to solve this. There is no other alternative.

Resources