yu.pitomets
yu.pitomets

Reputation: 1840

Convert Selenium Java tests into Protractor tests

I have a bunch of Selenium tests written in Java.

Is there a way to covert them to Protractor tests?

Upvotes: 0

Views: 982

Answers (2)

Amit Jain
Amit Jain

Reputation: 4597

No, you have to write framework and all tests from scratch if you use Protractor and you have to learn lot of new things, below are some points for observation.

  1. Protractor supports javascript language to write unit/regression/functional tests, but js syntax is different from java, you can understand its flavor but syntax is completely different. e.g. import becomes require
  2. Different synchronization, no automatic waits etc, require usage of promises resolution using .then. js script control flow is not synchronous unlike java so understanding it is very important and bit tedious.
  3. Different reporting libraries like jasmine allure reports,jetty reports etc
  4. Different unit testing frameworks like jasmine instead of junit/testng.
  5. The existing framework will not be helpful because protractor nodejs framework have different project structure then java's maven project.
  6. Existing utilities like xls reading and writing, loggers etc will be purely different libraries and not easy like .jxl/apache-poi

Suggestions =>

  1. If you have time you should use Protractor.
  2. Else you can use ngWebDriver=> This is an extension to WebDriver for handling angular based applications and supports writing angular tests using JAVA. This is written by Paul Hamant. You can kick start using link.But consider synchronization is not as good as Protractor,documentation and issue support is limited.

Upvotes: 2

C. Peck
C. Peck

Reputation: 3719

Take a look at https://sqa.stackexchange.com/questions/30010/moving-from-selenium-to-protractor. As far as I know there is no trivial way to make this transition.

Taking tests that are written directly in Selenium and transitioning to Protractor is almost like writing them from scratch especially if my assumption is correct that the devs are totally rewriting the front end with angular.

HOWEVER, you do have a test framework and a list of tests which is a good place to start.

Upvotes: 1

Related Questions