Multi step test case

Asked by Ayo on 2012-12-23

I am having problem writing a multi step test case i.e. perform multiple actions within a test script
 1 go to home page (go_to url)
 2 assert title
 3 go to another page (go_to url)

My aim is to be able to run all the steps within the test case even if it fails. This used to be possible with verify command Selenium RC. Below are 2 sample scripts trying to perform this
#(the test script runs through all the steps)
from sst.actions import *

assert_title_contains ('SST - Web Test Framework ')
#(the test script stops as it fails at the step 2)
from sst.actions import *

assert_title_contains ('huygiug ')

The problem i am having is that if the script fails at step 2 it does not continue with step 3. I have tried using the if condition but was not able to get it to work.As there is no verify command how can i use the assert command and still be able to run the whole steps.

Thanks in advance.

Question information

English Edit question
selenium-simple-test Edit question
No assignee Edit question
Last query:
Last reply:
pratik shah (pratik-shah) said : #1

You can write a sst method called "get_title", then just check for the condition:

define a method for get_title:

def get_title(title):
    """Get title of browser page"""
    real_title = browser.title
    return real_title

condition to check for:

my_title = get_title('http://localhost:8000')
if not 'string im looking for' in my_title:
    print 'Sorry, title string not found..'

Ayo (k-akolay1) said : #2

Thanks will try out the solution.

Ayo (k-akolay1) said : #3

Hi Pratik,
Just getting of the holiday mode and getting back to the testing mode.
Took a crash python course over the holidays.

A quick question, is the 'browser' and 'title' in the "real_title = browser.title" for the browser used for the test and title the expected page title?
real_title =

Thanks in advance.

Leo Arias (elopio) said : #4

Hey Ayo,

In good theory, you have two tests there and it might be better to split them. It's easier to spot the application errors when you have only one assertion at the end of the test. But, if you have a good reason for doing this, then you could use try.

import sst.actions

    sst.actions.assert_title_contains ('huygiug ')
except AssertionError:
    print 'Do something here'

pratik shah (pratik-shah) said : #5


Yes, you're passing the URL you want the title to, so, it might be confusing with that being the parameter name of the method.

def get_title(url):
    """Get title of browser page"""
    real_title = browser.title
    return real_title

You're passing the URL, getting the browser title from the method, then you're using basic python to check for the string you want.

I absolutely agree with Leo, I proposed a solution based on the question, but he's correct.

Can you help with this problem?

Provide an answer of your own, or ask Ayo for more information if necessary.

To post a message you must log in.