Symfony2 test client not firing Xdebug during PHPUnit test in PhpStorm - phpunit

I've run into an interesting and frustrating wrinkle in attempting to run some functional tests on a Symfony2 project I inherited. I'm sending a POST request to one of my controller methods via Symfony's test client. The debugger works during the test on the test file itself. I can set a break point, run the test, and the debugger will stop all processing at that point until I step through.
The problem is that the debugger does not work in the code that's accessed by the client request, likely because it is a secondary request/session.
Is there a way around this? I'm using PhpStorm 7.1.3, if that matters.

Solved it with the help of this post and supplying the Symfony test client with the right URI.

Related

phantomjs intercept response headers

I am currently creating a test script using codeception webdriver, I decided to run this script automatically every after a specified interval to know whether or not my application is still working. With its capability on generating error logs and screenshots this automated testing tool has been helpful. But I personally think that getting response headers would be more helpful. Is there anyway I could do this without changing the frameworks I have been using? If so, could you guide me on how to implement this?

Xdebug can debug codeception but not codeception tests

I am running Codeception tests in a Symfony2 project and I am developing in PHPstorm.
Debugging codeception used to work, but i recently started a new project it doesn't anymore. Everything is configured as it should. When I set phpstorm to start listening for connections, and I set a breakpoint in bin/codecept. The debugger halts at the breakpoint (as it should).
But when I set the breakpoint in a test (which is definetly ran), I get the message
16:10:41 Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'null' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
Do not show again (show balloon)
I do believe that something is going wrong with the path mapping, because my server is running on a symlink, but why does debugging app/console and codeception itself work, but not the tests ?
Probably because of this:
https://github.com/Codeception/Codeception/issues/1636#issuecomment-71205765
test is not executed directly, it is triggered from reflection.

Protractor implicit waiting not working when using grunt-protractor-runner

I am writing e2e Tests for some JS application at the moment. Since I am not a JS developer I was investigating on this theme for a while and ended up with the following setup:
Jasmine2 as testing framework
grunt as "build-tool"
protractor as test runner
jenkins as CI server (already in use for plenty java projects)
Although the application under tests is not written in angular I decided to go for protractor, following a nice guide on howto make protractor run nicely even without angular.
Writing some simple tests and running them locally worked like a charm. In order to implicitly wait for some elements to show up in den DOM I used the following code in my conf.js:
onPrepare: function() {
browser.driver.manage().timeouts().implicitlyWait(5000);
}
All my tests were running as expected and so I decided to go to the next step, i.e. installation in the CI server.
The development team of the aplication I want to tests was already using grunt to build their application so I decided to just hook myself into that. The goal of my new grunt task is to:
assemble the application
start a local webserver running the application
run my protractor test
write some test reports
Finally I accomplished all of the above steps, but I am dealing with a problem now I cannot solve and did not find any help googling it. In order to run the protractor test from grunt I installed the grunt-protractor-runner.
The tests are running, BUT the implicit wait is not working, causing some tests to fail. When I added some explicit waits (browser.sleep(...)) everything is ok again but that is not what I want.
Is there any chance to get implicitly waiting to work when using the grunt-protractor-runner?
UPDATE:
The problem does not have anything to do with the grunt-protractor-runner. When using a different webserver I start up during my taks its working again. To be more precisley: Using the plugin "grunt-contrib-connect" the tests is working using the plugin "grunt-php" the test fails. So I am looking for another php server for grunt now. I will be updating this question.
UPDATE 2:
While looking for some alternatives I considered and finally decided to mock the PHP part of the app.

Spring boot web context (AnnotationConfigEmbeddedWebApplicationContext)- suddenly being closed/shutdown

I'm using spring-boot 1.1.3 running a web application (obviously, based on spring-web, security and more) with an embedded Tomcat.
I'm running my application on Linux (Ubuntu) machine with Java 1.7.
After couple of hours, I can see that the context is being closed without a reason. Just to make it clear, the process didn't crash and is still running, when I try to post/get a request, the client just hangs.
I'm using logback, configure with debug level as TRACE and I can not see who or why is close context is invoked.
Can someone please tell me how to detect the trigger for closing the context?
Actualy, the issue was not related directly to spring-boot but I wont change it's tag since other people might face the same scenario.
So, the unswer is the same for, How can I close a terminal without killing the command running in it?
just run your command with & at the end and than, execute disown.

Doh / dijit robot - no mouse actions happening

I wrote an automated test using dijit robot - but in order to be able to use relative paths within our web application, I created an OSGi service for our tests and put the test code in a velocity template. When I try to run the tests, nothing happens. If I use the same script in an html file and access it directly from windows explorer (not via localhost), it works fine. I find that there are many cases that will make the dijit robot tests just not run - has anyone ran into this and found out all the little gotchas to make dijit tests run?
Check out dijit.initRobot(), that might take care of some things for you.
One thing that was screwing up a lot of my tests is described in this blog post - basically the robot was not initializing because I was obscuring a special div that the robot clicks to initialize.
However I have realized that there are still quite a few problems with the doh robot - it just seems very fragile. Often I will have a working test, then add 1 robot command and the test will break. When I remove the line and try it again...well the robot wont run even though it is the exact same code as before.
I've found the best thing to do when writing robot code is to just clear the cache every time and cross your fingers. Good luck.
Problem can be if you trying it with openjdk, run it on oracle java version

Resources