functional-testing

How to test email in functional test (Symfony2)

本秂侑毒 提交于 2019-12-12 08:07:07
问题 I'm trying to test email in functional test... My source code is the same as the example of the cookbook, the controller : public function sendEmailAction($name) { $message = \Swift_Message::newInstance() ->setSubject('Hello Email') ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody('You should see me from the profiler!') ; $this->get('mailer')->send($message); return $this->render(...); } And the test : // src/Acme/DemoBundle/Tests/Controller/MailControllerTest.php use

Android functional testing with Dagger

℡╲_俬逩灬. 提交于 2019-12-12 07:46:30
问题 I’m trying to test an Activity with Mockito & Dagger. I have been able to inject dependencies to Activity in my application but when testing the Activity, I have not been able to inject mock to the Activity. Should I inject Activity to test or let getActivity() create it? public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { @Inject Engine engineMock; private MainActivity mActivity; private Button mLogoutBtn; public MainActivityTest() { super(MainActivity

Symfony2 functional test with Session and Post

喜你入骨 提交于 2019-12-12 04:56:31
问题 I am trying to write some Symfony2 functional tests, using PHPUnit, that simulate a logged-in user requesting some resource via an AJAX call. The test first simulates a user logging-in using the standard FOSUserBundle log-in form; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class MyWebTestCase extends WebTestCase { public function login($username, $password = 'password') { $client = static::createClient(); $client->followRedirects(true); $crawler = $client->request('GET', '/login');

How do I create a functional test which includes a POST to a page with parameters?

自古美人都是妖i 提交于 2019-12-12 02:13:16
问题 I've read the documentation from Symfony2 but it doesn't seem to work. Here's my functional test: public function testSearch() { $client = static::createClient(); $crawler = $client->request('POST', '/search/results', array('term' => 'Carteron')); $this->assertTrue($crawler->filter('html:contains("Carteron")')->count() > 0); $this->assertTrue($crawler->filter('html:contains("Auctions")')->count() > 0); } In my controller the "term" parameter is null when this request comes in. However, search

Symfony2 functional test and session persistance

泪湿孤枕 提交于 2019-12-12 01:22:11
问题 Here is my problem, I add session variable from functional test controller and they don't popup on action targeted by test. I made a login method and used cookbook advice to log in. I tuned it a bit to allow 2 accounts login : admin and superadmin /** * @param $account string the account to log in with (authorized : superadmin and admin) */ protected function logIn($account) { $this->session = $this->container->get('session'); // Cookbook try // $this->session = new Session(new

GeoLocation App not working on Android Emulator

删除回忆录丶 提交于 2019-12-11 16:53:20
问题 I am testing a Geo-location App using an Emulator created in Android Studio. I have passed the latitude and longitude using DDMS which seems to work. I confirmed it by going to Google and checking the location. The location changes based on any changes on the Lat/Long. However, the App under test is not getting any location information. The App displays that the location services is not turned on when in fact it is turned on and working fine. Is there a specific command that can target the

Self hosting asp.net RESTful webservice

♀尐吖头ヾ 提交于 2019-12-11 12:46:09
问题 I have a REST based web service which runs under IIS with name "WebHandler". I usually run the webservice under IIS and then write functional test code. So everytime I run/debug a functional test, I have to keep the webservice running under IIS. Is there a way that in the functionaltest code, I can somehow host the webservice programatically so that the webservice is part of same process (NO IIS is involved) ? Benefits from this which I perceive is: modify webservice code on fly and test it.

The BrowserKit component is not available

ε祈祈猫儿з 提交于 2019-12-11 10:44:19
问题 I've got an error when i try to launch my functional tests. "The BrowserKit component is not available." php ./bin/phpunit #!/usr/bin/env php PHPUnit 6.5.14 by Sebastian Bergmann and contributors. Testing Project Test Suite E.. 3 / 3 (100%) Time: 367 ms, Memory: 16.00MB There was 1 error: 1) App\Tests\Controller\DefaultControllerTest::testLoginPage LogicException: You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require

Android Testing Splash Screen

天大地大妈咪最大 提交于 2019-12-11 10:42:55
问题 So I have this Splash screen which is working well, but I would like to test "is the handler has lunched the next activity". class: public class SplashActivity extends Activity { private final int SPLASH_DISPLAY_LENGTH = 3000; private TextView quote_text; private int[] quote_id = {R.string.quote_1, R.string.quote_2, R.string.quote_3, R.string.quote_4, R.string.quote_5}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

function of searching a string from a file

对着背影说爱祢 提交于 2019-12-11 09:22:57
问题 This is some code I wrote to check a string's presence in a file: bool aviasm::in1(string s) { ifstream in("optab1.txt",ios::in);//opening the optab //cout<<"entered in1 func"<<endl; char c; string x,y; while((c=in.get())!=EOF) { in.putback(c); in>>x; in>>y; if(x==s) return true; } return false; } it is sure that the string being searched lies in the first column of the optab1.txt and in total there are two columns in the optab1.txt for every row. Now the problem is that no matter what string