Grails - Link checking as part of a continuous integration - grails

So, we have a grails app set up with a Hudson CI build process. We're running unit tests, integration tests, and about to set up Selenium for some functional tests as well.
However, are there any good ways of fully testing a sites links to make sure nothing has broken in a release.
I know there's link checkers in general, but I'd like to have it be a part of the build process, so a build outright fails if something isn't right.

WebTest has a verifyLinks step you could use: http://webtest.canoo.com/webtest/manual/verifyLinks.html
You could install the webtest plugin (it should play nice with Selenium) and just have a single test that checks links.
cheers
Lee

I'm using selenium plugin (http://wiki.hudson-ci.org/display/HUDSON/Seleniumhq+Plugin) with test recorded from both developers and functional people. We start the new instance of the Grails app from the Hudson build with the Postbuild (http://wiki.hudson-ci.org/display/HUDSON/Groovy+Postbuild+Plugin)

What we ended up using was a command line program called linkchecker that we could install by apt-get and we ran from within our build script.

Related

How to run Spock unit tests without intializing Grails environment

I have a Spock unit test in a Grails app. In IntelliJ IDEa I can either run it with grails environment and then it means I wait a minute until the environment loads to run the test even though I do not need the environment.
The other option is to run it with JUnit. This works nicely in a Grails app without my own plugins. However, when I run it in a Grails app that has a plugin of another Grails app I have, it crashes on NoClassFound. It does not see the classes from the plugin that I included.
When I checked in IDEa the project structure, indeed the sources nowhere include a folder where the plugin classes would be included. For some reason the plugins in plugins section in BuildConfig.groovy do not appear in the classpath anywhere, they are not found in the external libraries section or anywhere else.
Is there a way to tell grails not to spin up its environment when running some of my tests? Or how can I include my plugin in the classpath for Groovyc to see it when building for testing?
The problem occurs also when simply pressing Build Project in IntelliJ IDEa. The project we are working with is simply run with grails and is never built (beyond how grails builds it). When you try to build it in IDEa, it fails on NoClassDefFound of plugin class.
Versions:
IntelliJ IDEa 2021.2
Grails 2.5.6
EDIT: Ok, it seems like grails apps are to be tested via their command-linke with grails test-app. When Grails runs in interactive mode, test-app won't have to reinitialize the environment, cause it's already running, so it runs faster.
However, as I found here Slow Grails test starting in Intellij IDEA it seems like there's no way to run grails in interactive mode from within IDEa in a way that would enable IDEa test runs to use such interactive console. Which means I'm forced to run tests via command-line. Not happy.
Edit 2: At some point in time I have managed to get the compiled tested.class to the out folder. This enabled running the test instantly via IDEa circumventing the Grails glory. However, I have no idea how I got it to out folder and after removing it I am unable to compile it again and get it there.

Setting up your module with Travis CI

Anyone got a boilerplate the world can use for Travis CI build testing for modules?
I havn't used Travis CI before but I got it hooked up however all my builds are failing, and the logs just say phpunit exited with code 1. I assume I'm definitely missing something and I have a feeling I need to download all silverstripe composer dependecies but have no idea where to start
I'm wanting it to run tests against (mymodule)/tests folder and hoping it's possible
The section on "Connecting to CI" isn't very helpful!
To set up with travis you'll need to use the travis-support module.
It's quite straightforward to do with a boilerplate .travis.yml which you can see on pretty much any SilverStripe module that's using travis. Here's a pretty standard one.
That file will test against PHP 5.3-5.6 as well as against SilverStripe versions 3.1.x-dev (latest 3.1 development version) all the way to 3.x-dev (3.5 development version).
You'll also need to customise the final line to run the correct test suite.

Wallaby on a build server (CI)

we are currently using Wallaby.js for javascript unit testing. Works fine and is great. But within our development pipeline we of course want to run the same tests on the build server - in our case a tfs.
Is it possible to use wallaby on a tfs build server? Anf if yes how?
If not, what is the way to go to run the wallaby configured unit tests on the build server?
As we used the karma test runner earlier, I tried to execute the new test configuration with it but then I get
Can't find variable: wallaby
as in our main/ starting test file it is written
wallaby.delayStart();
require.config({
baseUrl: 'app',
(Originally from a karma/ requirejs configuration)
How to get around this?
Has anyone experience in this scenario?
Wallaby.js main idea is to integrate with editors, run tests for the code that you change and display the results in the editor. You can't use Wallaby.js in a CI build.
You may consider invoking other test runners, or use grunt/gulp task instead for javascript unit testing.
In TFS 2012 and later (might work in 2010 but not sure) you can extend the testing capabilities of the build system.
Check out these posts -
http://www.aspnetperformance.com/post/Unit-testing-JavaScript-as-part-of-TFS-Build.aspx
https://blogs.msdn.microsoft.com/visualstudioalm/2012/07/09/javascript-unit-tests-on-team-foundation-service-with-chutzpah/

How to setup Bamboo to work with codeception?

I have been trying to get Bamboo working with codeception tests. I am using codeception to test my code in a symfony project.
After some research I found an article on how to setup Jenkins with codeception.
Once read I figured out that I should use Ant to run the codeception commands that run the tests.
The problem is I don't really know where to put everything. This article explains all the fields for a new Ant task but nothing seem to work.
Can someone please help me?
In case anyone else comes across this, this is how I have gotten codeception working in bamboo.
In Admin > Server Capabilities. Add a new executable for Codeception with the path /usr/local/bin/codecept.
In your job, create a new task of type Command. Set the executable as Codeception. The arguments should be run --xml (and any others you need).
Next, create another task with the type of JUnit Parser. Set the custom results directory to tests/_log/*.xml.
This works perfectly for me.
Additional: If you do not have admin rights to the server, set the command executable as PHP and add ./vendor/bin/codecept run --xml as the arguments.

Performance issue with webtest and grails

I have read the documentation for Grails and Webtest in this site:
http://www.grails.org/plugin/webtest
And it's very unupdated. Most of the scripts listed there doesn't work.
I am looking a way to run a working alternative of -nostart listed there.
This is because it's very slow to rerun tests. Or maybe a way to run webtests from outside of Grails
Can you give me any pointer?
Thanks in advance
The webtest plugin changed from version 1.3 to use the new hooks provided by the grails test-app script. Unfortunately one piece of functionality not provided by test-app is the -nostart option.
You could try using
grails interactive
then
test-app -functional
hitting enter should re-run the functional tests without doing a complete restart of grails.
I've also removed the -nostart option from the documentation. All the other documentation should be up to date. What other scripts did not work?
You can raise issues here: http://jira.codehaus.org/browse/GRAILSPLUGINS/component/12994

Resources