MageTest / BehatMage

Behat for Magento
MIT License
85 stars 31 forks source link

BehatMage + Vagrant #81

Open dwickstrom opened 9 years ago

dwickstrom commented 9 years ago

Thinking about it, I'm not sure how using behatmage with a remote (virtual) machine setup would work. Mage::app(); would still be instantiated locally which would quite make sense as you want to test your code in your isolated environment (vagrant machine).

Running behat from within my vagrant machine doesnt feel like an option.

What are your thoughts?

jamescowie commented 9 years ago

Hello,

So BehatMage will instantiate Mage::app() that means a DB connection among other things will be required. When working in a VM ( Vagrant ) I run Behat on the VM so its no issue for me. However there are limitation, So when using selenium I cant see the browser opening when running the tests as I could if this was local.

There are ways around this, You can set selenium up to forward so it will use your Host machines selenium. However you still need to run Behat on the VM.

You could always create a script on your host machine within the repo to run: vagrant ssh -c "./bin/behat" so that you don't need to be in the virtual machine at all times.

What issues does using the VM face for you ?

dwickstrom commented 9 years ago

Hi,

Just that - wanting to use fixtures + real browsers. Thanks for the tip. Will specifying the address to selenium running on the host machine in my behat.yml file. Something like this, on the guest machine, maybe:

// behat.yml
selenium2:
    wd_host: "http://10.0.0.2:4444/wd/hub"

Will report back here.

debo commented 9 years ago

@dwickstrom as @jamescowie said you will still need to run behatmage within the VM. Your only escape is to have a local.xml behat config that points to the guest db, that also means you have to allow mysql to accept remote connections. Does it make sense?

dwickstrom commented 9 years ago

@MarcoDeBortoli I'm afraid that confuses me a little. If I am running behatmage on my VM, then which remote database would I have my local.xml point to? Did you mean, if I still want to run behatmage off the host machine, then I could point to the VM db in my local.xml?

Anyhow, I think I am fine running behatmage on the VM, as I've successfully tested connecting to a selenium server on the host machine.

My next quest will be figuring out whether I can use fixtures to do end to end testing through selenium.

Thanks for helping out.