Quantcast
Channel: ibm – Seite 5 – mynethome.de
Viewing all articles
Browse latest Browse all 61

Browser UI testing with Geb: Debugging Geb tests

$
0
0

Geb provides a very good way for end-to-end tests of browser applications.

One drawback while writing is that it might get rick to get the selectors for the UI elements right. Being able to debug, stop in the middle of a test and adjusting the selectors would come in very handy.

But, as things are not always as smooth as we want them to be, the error message you are confronted with when you just hit the „run debug“ button for the Geb Spec class you are woking on might look like:

Process finished with exit code 1
Class not found: "de.mynethome.GebSampleSpec“ Empty test suite.

This will happen especially when you’re working on a Java based project and have pulled in the dependencies on Groovy only for „test“ to be able to profit from the combined power of Spock/Geb. The reason for that error is, that your IDE did not pick up that compile time dependency and thus you groovy files have not been converted into byte code that can be run and debugged.
(hint: this applies most likely only to maven based projects. From my experience, this error has not popped up with projects that use gradle as their build system)

Solution to this is simple: Tell your IDE to run the necessary steps to compile your test suite.
That is, for example in IntelliJ Idea, done by adding a „before launch“ task to the run configuration as schon in the picture :-)

Happy debugging&testing!


Viewing all articles
Browse latest Browse all 61