0

I come from a unit test world but my current project requires me to write a lot of webdriver code. I have to send some applications to some website not having any api. I am using webdriver to go to their website and complete the application. I am facing unique challenge as it takes a lot of time for each run and when I code the the process for nth page of application I wouldn't really be able to test my code very fast. I tend to run the code to test which takes considerable amount of time reducing my efficiency. Am I missing any thing. What is the best practice to develop in such environments. I am using python wto write webdriver.

This is how my code is structured currently.

class ApplyPage1():
...
.
.
class ApplyPageN():

I cannot reach page N directly as the website I am submitting application to doesn't allow me to go directly to that page.

raju
  • 4,788
  • 15
  • 64
  • 119

2 Answers2

1

Try looking at robotframework-selenium2 as a method of testing web applications and such. Also look at this gist for an example on how to use it. I can also help with more specific questions too if you have any.

The robotframework is extensive but very useful when testing web based stuff. It's written in python too.

Jeff
  • 6,932
  • 7
  • 42
  • 72
-2

You can use Selenium IDE plugin (with code formatters) for Firefox which has the ability to record the user actions and export the test cases directly into Python 2 unittest code (either WebDriver or Remote Control, for Python 3 see this). See: Converting IDE scripts to Python at Mozilla Wiki page.

Once you exported your test into classes, then you can write a wrapper to run all the tests at once. See: how to to organize python unittests into suites, run multiple classes in single Test Suite and run all Python unit tests in a directory.

Community
  • 1
  • 1
kenorb
  • 155,785
  • 88
  • 678
  • 743