FAQ Database Discussion Community


Symfony2 Functional Testing: Is a database required or not?

php,unit-testing,symfony2,doctrine2,functional-testing
I have to write functional tests for a controller that registers a user in the application. The controller has two methods (and routes): registrationAction (route=registration) endAction (route=registration/end) Now I would like to write functional tests for those two methods. My question is: as the controller creates and persists a new...

Loading Fixtures for functional tests in Symfony 2: Call to undefined method MyControllerTest::loadFixtures())

symfony2,doctrine2,functional-testing,fixtures
I am trying to find the easy way to load my fixtures in Symfony 2.6 to run functional tests. This is a quite common question, and has been asked a few times, but the answers I have found so far do not quite reach my expectations: Some rely on running...

Functional testing in Symfony2 gives me error: Failed asserting that false is true

php,symfony2,phpunit,functional-testing
I have action where I do this: return $this->redirect($this->generateUrl('url_key')); In my test I do this: $this->assertTrue($client->getResponse()->isRedirect()); But I get error: Failed asserting that false is true Where is my problem? Why I am getting error? My full test: public function testDeleteAction() { $client = static::createClient(); $client->request('GET', '/translation/delete/messages/test.key'); $client->followRedirects(); $this->assertTrue($client->getResponse()->isRedirect()); }...

submit a form using ajax in functional test

php,ajax,symfony2,phpunit,functional-testing
I'm creating a functional test for the inscription part of my project and I need to know how to test it if the form needs to go in an ajax request, otherwise the server will always return an empty inscription form. Looks like the submit method doesn't take an argument...

Symfony 2 Functional test

php,symfony2,phpunit,functional-testing
I encounter an issue which doesn't make much logic to me in one of my functional tests. The test is quite simple, it just requests for the homepage, and searches for an element with a certain class in it. The homepage is for a blog that displays a list of...

Host testing C program with hard coded memory addresses

c,linux,unit-testing,memory-management,functional-testing
We will write functional/unit tests for C code. This C program will be run as embedded software. However we need to run tests on a Linux environment. The problem is that parts of the code under test looks like this: my_addresses.h: #define MY_BASE_ADDRESS (0x00600000) #define MY_OFFSET_ADDRESS (0x108) my_code.c #include "my_addresses.h"...

Django tests: Don't close selenium driver after each test

django,selenium,functional-testing
I have a test suite that includes a lot of tests for selenium. Now, I have a lot of tests, and they take quite a while, so I am trying to speed up the process. Part of the issue is that it takes quite some time for selenium to close...

Symfony Crawler: how to check that a link to a particular page exists

php,symfony2,phpunit,functional-testing
I'm writing some functional tests and i want to verify that the Edit link exists on the page if the user is logged in. The link is a simple <a href="/profile/22/edit">Edit</a>. How can I filter it using the Crawler component of Symfony? One solution is this: $this->assertEquals(1, $crawler->filter('html:contains("<a href="/profile/22/edit">")')->count()); But...

Test plan for reporting system

sql-server,testing,integration-testing,functional-testing,test-plan
I have a software suite that consists of multiple integrated software packages. They all run off of a single centralised SQL database. We are in the stage where we are writing test plans and have allocated a single test plan for each independent module of the software. The only one...

Symfony Functional Testing: how to understand why the test fails (with a 500 Error)

php,symfony2,phpunit,functional-testing
I'm writing functional tests for a controller that registers a new user in the app. The test I'm writing fails because of a 500 HTTP error. I'm using $response = $client->getResponse(); print_r($response->getContent());exit; to print the HTML to see what is happening but the HTML is incomplete in my console (PHPStorm)...

Authlogic: Functional Test Failing Validation

ruby-on-rails,ruby,testing,functional-testing,authlogic
I'm hoping someone can help me out. I'm in the process of building the standard blog application as part of learning Rails and have elected to include Authlogic for authentication/authorisation. For some reason - and I can't for the life of me figure it out - the following functional test...

File upload in Intern.js

javascript,testing,functional-testing,intern
It is written in documentation that it is possible to do things like file upload using intern. Can anyone provide an example of how this can be done? I searched through examples and through LeadFoot documentation and I can't find anything. Thanks....

Codeception not setting headers for AJAX

laravel,testing,http-headers,functional-testing,codeception
I have the following functional test set up $I = new FunctionalTester($scenario); $I->wantTo('get a list of users'); $key = $I->amApiAuthenticated(); $I->seeInSession('key'); $I->setHeader('X-API-KEY', $key); $I->sendAjaxGetRequest('/api/users'); $I->seeResponseCodeIs(200); But the test fails because the X-API-KEY is not set (results in a 403), this is the request as dumped to a log file from...

How to write JellyTools functional tests?

java,netbeans,functional-testing
I managed to set up JellyTools in my Java project in Netbeans Platform. Now I would like to write some functional tests with it but I can't find any tutorials about JellyTools apart from this: http://wiki.netbeans.org/JellyTools Can anyone give me some tips about it or post some other tutorials? I...

How to run a single test in nightwatch

functional-testing,nightwatch.js
I have test: module.exports = { 'Test 1':function(){}, 'Test 2':function(){} 'Test 3':function(){} } I want to run Test 3 and not all the others. How can I do so?...

User token in Symfony2 Functional Tests

php,symfony2,functional-testing,security-context
I'm doing functional tests of Symfony2 controllers, inheriting my test classes from this: class InsecureWebTestCase extends WebTestCase { protected $client = null; public function setUp() { $this->client = static::createClient(); $session = $this->client->getContainer()->get('session'); $firewall = 'default'; $token = new UsernamePasswordToken('[email protected]', null, $firewall, array('ROLE_USER', 'ROLE_ADMIN')); // $this->client->getContainer()->get('security.context')->setToken($token);...

tdd - creating tests for 3rd party code

unit-testing,testing,tdd,functional-testing,functional-dependencies
How do I create unit tests if the method or procedure I'm testing against relies on a piece of code from a 3rd party? Say, I have a method that uses classes from a third party source that requires setup that can only be done in a functional test. How...