Developing and Testing a Facebook application

24,110

Solution 1

The way I and my partner did it was we each made our own private Facebook applications, that pointed to our IP address where we worked on it. Since we worked in the same place, we each picked a different port, and had our router forward that port to our local IP address. It was kinda slow to refresh a page, but it worked very nicely.

Solution 2

Try updating your hosts file (for windows users @ c:\windows\System32\Drivers\etc\hosts) with an entry that will route all requests from your live domain back to your machine.

So 127.0.0.1 mywebappthatusesfacebook.com.

Then make sure that your app is running at the root of your webserver. @ http://localhost/ Then goto mywebappthatusesfacebook.com in your browser and it should redirect right back to your local machine. Facebook won't know the difference. Hope this helps

Solution 3

You'll have to add both trunk and test versions as different applications and test them using test accounts. You may also use a single application and switch its target URL between cycles.

Solution 4

Testing FB apps is still a rather primitive process.

I generally setup a test application that is a complete copy of the production settings inside the FB development environment that uses an SSH tunnel to point to my development server. You can setup as many applications as you need inside FB - I generally have a development application, a staging app and production. Staging and Production are both on "live" servers rather than an SSH tunnel.

In your application you then use whatever language/framework/server tools are at your disposal to switch the FB configuration based on the server. In Rails, the Facebooker gem actually has built in support for different FB configurations.

Once all of that is done, testing is, unfortunately, still a matter of running the app within FB itself. I use Selenium to automate as much of this as possible.

Solution 5

Best way to do this:

Remove 'App Domain' from 'Basic Info'

Set website's 'Site URL' to : "http://localhost/" .

That simple.

(This only apply if you don't have a live system running in parallel to the test env. In that case get yourself another key.)

Share:
24,110
Hamd Islam
Author by

Hamd Islam

I'm an engineering manager at Ocado Technology.

Updated on August 17, 2022

Comments

  • Hamd Islam
    Hamd Islam almost 2 years

    Typically I develop my websites on trunk, then merge changes to a testing branch where they are put on a 'beta' website, and then finally they are merged onto a live branch and put onto the live website.

    With a Facebook application things are a bit tricky. As you can't view a Facebook application through a normal web browser (it has to go through the Facebook servers) you can't easily give each developer their own version of the website to work with and test.

    I have not come across anything about the best way to develop and test a Facebook application while continuing to have a stable live website that users can use. My question is this, what is the best practice for organising the development and testing of a Facebook application?

  • Amandasaurus
    Amandasaurus over 13 years
    That helps you get to your site. But Facebook's servers won't get to it.
  • Harsha M V
    Harsha M V over 13 years
    can you explain in detail how do i do it ?
  • Satadru Biswas
    Satadru Biswas about 12 years
    Works awesome!! Such a simple solution. I would have upvoted 100 times if I could
  • Erik Kaplun
    Erik Kaplun over 10 years
    why is localhost.local better than just localhost?
  • sbaechler
    sbaechler over 10 years
    I haven't tested it now but just localhost used to not work. (At least in 2011)