← Back to team overview

sikuli-driver team mailing list archive

[Question #207687]: How to stop test on the first failure

 

New question #207687 on Sikuli:
https://answers.launchpad.net/sikuli/+question/207687

Hi,

I am very new to Sikuli and python.  I'm trying to stop the test on the first failure and I had no luck so far.
I've tried using stop function inside my test case class and it keeps telling me it's not valid. 
I'v also tried passing in the parameter called failfast which is an attribute in TestResult class but it keeps telling me it's invalid.

I would appreciate if I can get some help on how make this work or a work around solution.  
I am running this on the Sikuli IDE not using the unit test feature.  The end goal is to deliver on executable file to the developers so they can run this automated test before handing it off to QA.

Here is my code:
import unittest
import os

dir = "C:\\AIM Test Results\\"
if not os.path.exists(dir):     
    os.makedirs(dir) 

class TestAIMDemandAnalytics(unittest.TestCase): 

    """
    AIMURL = input("Enter the URL for the AIM Infoview page:")
    UserID = input("Please enter the user id for the AIM infoview page:")
    UserPassword = input("Please enter the user password for the AIM infoviewpage:")  
    """
    
    def test_01AIMLoginPage(self): 
        IE = App.open("C:\Program Files (x86)\Internet Explorer\iexplore.exe")
        wait(1)
        hover("httpnews-1.png")
        paste("httpwww4ggec-1.png", "http://vs-qatest-11g:8080/InfoViewApp/logon.jsp";)
        type("\n")
        if(not exists("1346780946846-1.png")): 
            popup("Before Clicking the Maximize button")
            click("1346780969393-1.png")
        else:
            popup("InfoView Page Already Maximized")
        assert(exists("gwSAPBusines-1.png"))

    def test_02AIMLogin(self):        
        UserPassword = input("Please enter the user password:")
        find("Password-1.png")
        type("Password.png", UserPassword)
        click("Logon.png")
        assert(exists("AIMDashboard.png"))
    
    def test_03LoadScenario(self):   
        hover("AIMDashboard-2.png")
        doubleClick("AIMDashboard.png")
        wait("ScenarioSele.png", 60)
        my_images = ["MIPO39WAncho.png","Scenario2011.png"]
        if exists(my_images[0]):
            assert(exists(my_images[0]))
        else: 
            if exists(my_images[1]):
                assert(exists(my_images[1]))
            else:
                fail
        
    def test_04Lag13Load(self):    
        if (exists("Scenario2011.png")): 
            click("Scenario2011.png")
        else:
            if (exists("MIPO39WAncho.png")):
                click("MIPO39WAncho.png")
            else:
                dragDrop("1346424680040.png", "1346424688683.png")
                if (exists("Scenario2011.png")): 
                    click("Scenario2011.png")
                else:
                    if (exists("MIPO39WAncho.png")):
                        click("MIPO39WAncho.png")
                    else:
                        fail()
        click("Go.png")
        wait("1345728399218.png",60)
        click("Lag.png")
        LagMenu = find("Lag-1.png")
        print LagMenu # message area: Match[10, 0 30x22] score=1.00, target=center
        dragDrop("1345731710253.png", "1345731715515.png")
        click("13.png")
        wait(15)
        assert(exists("AnahticsLag1.png"))
    
    def test_05DemandAnalytics(self):    
        hover("1345743307291.png")
        assert(exists("10012556.png")) 
    
    def test_06AnalyticsDataCV(self):
        click("1346097905751.png")
        wait(15)
        wait("6050E4030EZG.png", 60)
        hover("0751.png")
        wait(3)
        assert(exists("07510035.png"))
    
    def test_07CVDetail(self):
        click("1346157901816.png")
        click("6214BB1DB700.png")
        wait(15)
        assert(exists("HWeek45K4K35-1.png"))
    
    def test_08AnalyticsDataBIAS(self):
        click("1346158139001.png")
        wait("120100BCBias.png", 30)
        hover("None.png")
        assert(exists("BiasNone107.png"))
    
    def test_09BIASDetail(self):
        click("1346158275234.png")
        click("MLP295702L70.png")
        wait(15)
        assert(exists("gimangaiHWee.png"))
        
    def test_10AnalyticsDataINTERMITTENCY(self):
        click("1346158482344.png")
        wait("140120Interm.png", 30)
        hover("1346158546382.png")
        assert(exists("Intermittanc.png"))
    
    def test_11INTERMITTENCYDetail(self):
        click("1346158634709.png")
        wait("Currentlysho.png", 5)
        
        click("LGOLDENEYE2V.png")
        wait(15)
        assert(exists("HWeek1K900B0.png")) 
    
    def test_12ScenarioNameAndDemandStream(self):
        find("Streams235De.png")
        assert(exists("Streams235De.png"))
    
    def test_13SlicerMenu(self):
        find("AllAllAllAll.png")
        assert(exists("AllAllAllAll.png"))

myfile = open(dir + "AIM_TestResults.log", 'w')
suite = unittest.TestLoader().loadTestsFromTestCase(TestAIMDemandAnalytics) 
unittest.TextTestRunner(myfile, verbosity=2, failfast=True).run(suite)
myfile.close() 

Thank you,

sincerely,

Alex

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.