简体   繁体   中英

How to use javascript to run automated tests in browser using selenium+CUCUMBER

Well, I am kinda new to this. First of all, my main goal is to execute a simple cucumber example which tests automatically something extremely simple as well.By doing this I will try to get the idea of how should i do other kind of autmated test. So, I wrote some scenarios, and I want to test them somehow on a site(eg google.com). The site is written in JS and therefore I need to write JavaScript code to "connect" the scenarios with the language.

I google searched things like: "How to automatically test a site using cucumber" "How to automatically run scenarios with selenium-javascript" and so on...

Any ideas? No hatefull comments please :/ Thanks in advance!

DL.

I wrote some scenarios,

When you say that I believe you are able to execute your testcases with cucumber

The site is written in JS and therefore I need to write JavaScript code to "connect" the scenarios with the language.

thats not necessary, if you are site is based on javascript like AngularJS you can still use simple java + selenium but protractor is recommended for same as it have wrapper. protractor is a nodejs based project to deal with sites based on AngularJS.

https://www.protractortest.org/#/

How to automatically test a site using cucumber

You can use a CI/CD tool like jenkins which you can trigger manually or you can put an scheduler who will run all your test script against your website on it. You can also turn on the notification so when ever the test complete it will shoot an email to respective individuals

Refer:

https://jenkins.io/

You can get n number of tutorial regarding same. example:

Click Here

I would spend some time at http://cucumber.io and work through the introduction tutorial in a language you are most familiar with. I would also do more general reading starting from that site, perhaps starting from https://cucumber.io/docs/guides/

Generally you use Cucumber to test something you are building, so when you try to keep things simple and test something someone else has built (eg Google) you are actually making things more complicated because now you have to deal with actually getting to that site and interacting with it.

Depending on where you are starting from Cucumber has a pretty steep learning curve and many many people make bad starts. So take your time and learn from the people who wrote and support Cucumber. cucumber.io is a much better starting point for you than StackOverflow.

Good luck, and happy cuking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM