Cucumber external webpage testing with rails app

16 views
Skip to first unread message

Petrovsky Yura

unread,
Jun 12, 2015, 3:53:09 PM6/12/15
to cu...@googlegroups.com
Hi Guys,
my question is:
i have an external webpage (for example https://cucumber.io/) and i want to try to test this page with Cucumber.
can you explain to me what i have to do step by step?
im really stock how i can "connect" to external webpage (routes or something else)
i'll be really appreciated for any help

Tim Walker

unread,
Jun 12, 2015, 4:26:56 PM6/12/15
to cu...@googlegroups.com
Hi Petrovsky! Cucumber really doesn't know anything about browsing to web pages. That all happens in your step definition. The solution rests on how you implement your steps. If, for example, you're using Capybara, take a look at: https://github.com/jnicklas/capybara#calling-remote-servers

Hope this helps. 

Tim 

--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Petrovsky Yura

unread,
Jun 12, 2015, 8:20:27 PM6/12/15
to cu...@googlegroups.com
So, i have to use capybara if i want to work with remote servers, right?
it is only one way to do it?


пятница, 12 июня 2015 г., 16:26:56 UTC-4 пользователь Halfordian Golfer написал:

Tim Walker

unread,
Jun 12, 2015, 8:53:54 PM6/12/15
to cu...@googlegroups.com
On Fri, Jun 12, 2015 at 6:20 PM, Petrovsky Yura <112...@gmail.com> wrote:
So, i have to use capybara if i want to work with remote servers, right?
it is only one way to do it?

[Tim] No, you can use tool you want to do that. The important thing is that Cucumber expresses the behavior of the software in natural language like English (many of which are supported) but simply maps that English, Given/When/Then, etx. to code to do the work in the step definitions. This is often referred to as the glue code as it is the glue between the Cucumber/Gherkin and the thing you are testing. Capybara is just one way, and a common one, to do what you want to do, in your Rails stack in particular. It makes this easy to do in your steps as it's a DSL around exactly what you want to do, but is in no way a part of Cucumber. Really, it's up to you to decide how you want to implement the steps and the world is your oyster about how to actually do that. There are some really good abstractions to help you do this and to keep a clean separation between your steps and this code. For example, look at "the page pattern". Hope this helps! Tim 
.  

Roberto Lo Giacco

unread,
Jun 13, 2015, 9:31:38 AM6/13/15
to cu...@googlegroups.com


Il giorno sabato 13 giugno 2015 02:53:54 UTC+2, Halfordian Golfer ha scritto:


On Fri, Jun 12, 2015 at 6:20 PM, Petrovsky Yura <112...@gmail.com> wrote:
So, i have to use capybara if i want to work with remote servers, right?
it is only one way to do it?

Capybara is one option, another one (which is what I use) is Selenium (the Java libraries). That's if you want to test a web application through a real web browser (IE, Chrome, Firefox, Opera), otherwise you can test the application through any other mean you might find applicable (like if you were writing integration or unit tests).

Cucumber is not much about how testing occurs, but about how tests are described.

You can test the facebook login works by:

  • writing your tests in a word document and send it to your test team (this is probably understandable by anybody, but probably quite long winded)
  • writing your test summary in a word doc and the test data in an excel document and send them both to your indipendent test team (a little more compact, but who reads the tests must know the conventions)
  • writing a set of automated tests in any programming language you might find fit for the purpose, like using Java and JUnit (that requires programming skills to be understood)
  • writing your tests in a plain text file and have it automated using a programming language of your choice among those compatible with the JVM (this is where CucumberJVM fits in as it provides the magic gluing between the text file and the automation code)
In the end you are still testing the facebook login page works, but we believe the last option is the one providing the best readability and being capable of automation. How you do the automation is out of scope, but because web applications are so common it's quite easy to find stuff and help on that ;-)

Have fun,
   Roberto
Reply all
Reply to author
Forward
0 new messages