django-sane-testing doesn't start live server - django

I'd like to run Selenium tests on CI server so I need running live server before run tests. I subclass HttpTestCase, write some tests using Selenium, then I do like here http://devel.almad.net/docs/django-sane-testing/usage.html#running-tests:
set DJANGO_SETTINGS_MODULE=settings_test
set PYTHONPATH=.
nosetests myapp.tests:MyHttpTestCase --with-django
Seems it's creating DB, then it connects to Selenium and run FF (I see that two FF windows). But then it fails, saying it can't connect. I suppose this is because of it didn't start developer server.
Don't know where I'm wrong, seems I was doing it by instruction...

Pass --with-djangoliveserver to nosetests:
nosetests myapp.tests:MyHttpTestCase --with-django --with-djangoliveserver

Related

Why don't any of my rspec or cucumber tests run locally?

I have inherited a rails app which has an extensive suite of rspec and cucumber tests, when I run these tests on a CI server such as Circle, I see the tests run (most pass, some fail).
The app connects to a back-office API & I see the code has mocked responses to various API calls, the app also uses elasticsearch.
When I run the test suite locally using bundle exec rspec - I immediacy see a whole bunch of "Elasticsearch::Transport::Transport::Errors::BadRequest" errors from RSpec and failed to connect to those backoffice API's which I mentioned, however none of these failures occur on the CI server (yes, I have tried starting ES locally, same issue)
What am I doing wrong here? How can I run my tests locally to mirror what the CI server is doing to get them to run?
Any help is appreciated! Thank you.

Intern - Create local tunnel to run functional tests

So i'm starting use Intern for functional tests, so far so good I did it all, unit and functional tests.
I followed their intern-tutorial
Whenever you need to run a full test against all platforms, use the test runner. When you are in the process of writing your tests and want to check them for correctness more quickly, you can either use just the Node.js client (for unit tests only) or create an alternate configuration file that only tests against a single local platform, like your local copy of Chrome or Firefox (for all tests, including functional tests).
I searched on their documentation, but I didn't find anything exactly about local "tunnels".
I'm using Intern with Gulp, my localhost is localhost:3000 and I want to test on my Chrome 54 on Mac.
Thank you
I guess NullTunnel is what you're looking for?
I found the answer. I had to change the tunnel to Local Selenium.
Download the latest version of ChromeDriver
Set tunnel to 'NullTunnel'
Run chromedriver --port=4444 --url-base=wd/hub
Set your environments capabilities to [ { browserName: 'chrome' } ]
Run the test runner
Obs:
Don't forget to copy the chromedriver file to your project root.
I had to run on my project root .\chromedriver --port=4444 --url-base=wd/hub
The test runner has to be run in a new command line/terminal/shell
Hope to help someone that had the same issue.

Run grails functional test without having embedded tomcat start

I have a project that I am usually debugging/running using the grails run-app command. I would like to run a test but without having the server run again only for the specific test.
I usually run the server in debug mode all the time in the background.
I've tried playing around with the run configurations in iteli-j, with latest try being grails test-app functional: className
In Grails 2.4.4 if you override the baseUrl you can run your tests against a server other than localhost. For example, we have a pre-production server hosted on AWS and we run a subset of our functional tests against it from Jenkins, post-deploy, as a smoke test.
grails -plain-output test-app -baseUrl=https://foo.bar.org/ -echoOut -echoErr functional:
That works, but test-app still starts the embedded tomcat server. However, with a bit of digging, I found that overriding the server host to point to a running instance will cause the tests to run without starting the embedded tomcat. There are a couple of ways to accomplish this:
Pass the value on the command line:
grails -plain-output test-app -Dgrails.server.host=foo.bar.org -baseUrl=https://foo.bar.org/ -echoOut -echoErr functional:
Or, overriding the value in Config.groovy for the specific environment should also work:
...
preProd {
...
grails.server.host = 'foo.bar.org'
...
}
...
It isn't documented under test-app, but it is mentioned under run-app and it turns out it works for test-app too.
This works because Grails determines if the embedded server should be started by trying to open a connection to the server host/port, and if successful skips the startup.
From trial and error I have discovered that I have the best results when I specify both grails.server.host and -baseUrl even though the base url becomes redundant information. Possibly this is because my case involves an ssl connection, but I tried running with -https instead of -baseUrl=... and the tests just hung.
This plugin maybe helps you.
Grails functional-test-development Plugin
This plugin aims to make developing functional tests for Grails more convenient by facilitating running your tests against an already running application. It utilises the improved functional testing support added in Grails 1.3.5 and does not work with earlier versions.

Lettuce test with django and selenium no run on windows

I have a lettuce test suite using selenium and everything works just fine on linux.
After I installed django and everything that's needed on windows to test the suite on IE8,9 too, and I tried to run the test, it only opens my browser and says that the test passed with 0 features, 0 steps etc. The same test suite on linux runs just fine.
What do I need to make them work on windows 7 too ???
I use python for my test.
Maybe it's not the best solution for you problem, I'm not even sure that it's valid for IE, but you could try to launch IE remotely so you will not need to launch whole application on windows (i.e. if you were using gunicorn as wsgi server, you couldn't launch on windows at all).
Python-selenium has functionality to use remote browsers, I'm just not sure about IE.

Im testing with selenium on ubuntu. Test in invisible workspace

Im testing my code with selenium RC. And every time when i run tests, selenium starts a browser in my active workspase, and i don't like this way. how can i set a selenium workspase to run selenium browsers in another workspace?
For repetitive testing, you should consider using xvfb for having a headless selenium. We've branched it to hudson for CIT
There's a maven plugin available, for example