Configuring Base url in /usr/local/lib/python2.6/dist-packages/sst/actions.py for data driven tests

Asked by Ayo on 2012-12-21

When running a data driven test for the first time , is it required to change some of the configuration(s) in the /usr/local/lib/python2.6/dist-packages/sst/actions.py and any of the other files? This question/comment is aimed to help those of us new to SST-python.

I tried running a simple data driven test using a simple data (pore.csv) and a test (pore.py) file as mentioned in the instructions. The test failed and gave some errors.

test_pore (sst.runtests.TestPore) ...
    Starting browser: Firefox
    Loading data row 1
    Going to... http://localhost:8000/www.ubuntu.com
    Waiting for 'get_element'
    Title is: u'Problem loading page'. Does not contain 'Ubuntu'
FAIL
    Stopping browser

Eventually i traced the reason for the fail (in the error console) to the base url in the "/usr/local/lib/python2.6/dist-packages/sst/actions.py" which was set to ==> "BASE_URL = 'http://localhost:8080'"

This i edited. and removed the "localhost:8080". Afterwards i was able to overcome this error.

So my question is it required to change some of the defaults in the files and other settings?

Question information

Language:
English Edit question
Status:
Solved
For:
selenium-simple-test Edit question
Assignee:
No assignee Edit question
Solved by:
Corey Goldberg
Solved:
2012-12-21
Last query:
2012-12-21
Last reply:
2012-12-21
Vincent Ladeuil (vila) said : #1

Things would be clearer if you show us your test itself, but based on ' Going to... http://localhost:8000/www.ubuntu.com' I suspect you did use 'www.ubuntu.com' instead of 'http://www.ubuntu.com' somewhere.

> is it required to change some of the defaults in the files and other settings?

The answer to that is no, but you probably want to use actions.set_base_url('http://www.ubuntu.com' at the beginning of your script.

Ayo (k-akolay1) said : #2

The test script/file = pore.py

from sst.actions import *
go_to(url)
assert_title_contains(title)

the data file = pore.csv

url^title
www.ubuntu.com^Ubuntu
www.google.com^Google
www.amazon.com^Amazon

when executed the console came up with this

plore@ubuntu:~$ sst-run -d /home/plore/ pore
----------------------------------------------------------------------
starting SST...

  date time: 2012-12-19 18:41
  test directory: '/home/plore/'
  report format: 'console'
  browser type: 'Firefox'
  javascript disabled: False
  browswermob proxy launcher: None
  shared directory: None
  screenshots on error: False
  failfast: False
  debug: False
  headless xserver: False

  Reading data from 'pore.csv'... found 3 rows

  3 test cases loaded

----------------------------------------------------------------------
test_pore (sst.runtests.TestPore) ...
    Starting browser: Firefox
    Loading data row 1
    Going to... http://localhost:8000/www.ubuntu.com
    Waiting for 'get_element'
..........

The test failed..
From the error message i was able to trace it to the a default configuration (line 92) in the /usr/local/lib/python2.6/dist-packages/sst/actions.py file

the line 92 was ==> BASE_URL = 'http://localhost:8080'
this is seen to appear before the url that is the data file
                       Going to... http://localhost:8000/www.ubuntu.com
after editing it to ==> BASE_URL = 'http://' it stopped including localhost:8080 before the url to visit.

So my question is, is it required to normally change any of the configurations before running the tests.

Best Corey Goldberg (coreygoldberg) said : #3

you are not using url's.

for example, this is a full url:
go_to('http://www.ubuntu.com')

this is not:
go_to('www.ubuntu.com')

the second case is handled like a relative url, using the current base_url to append to.

hth,

-Corey

Ayo (k-akolay1) said : #4

Thanks Corey Goldberg, that solved my question.