← Back to team overview

sikuli-driver team mailing list archive

[Question #236945]: How to terminate a unittest on failure and move to following unittests

 

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

Hi, 

I am running two scripts parallelly on two different machines(as two different user logins into a Desktop app).
My test suite contains three unittests say, test1, test2 and test3.

I'll make it much more clear.

Script1 on machine1->>

class Machine1Tests(unittest.TestCase,CommonMethods):
 def setUp(self):
    pass
 def test1(self):
    self.login()
    self.doSomething1()
    self.logout()
 def test2(self):
    self.login()
    self.doSomething2()
    self.logout()
 def test3(self):
    self.login()
    self.doSomething3()
    self.logout()

Script1 on machine2->>

class Machine2Tests(unittest.TestCase,CommonMethods):
 def setUp(self):
    pass
 def test1(self):
    self.login()
    self.doSomething1()
    self.logout()
 def test2(self):
    self.login()
    self.doSomething2()
    self.logout()
 def test3(self):
    self.login()
    self.doSomething3()
    self.logout()

Suppose on machine1, in my login method in test1, something goes wrong and my unittest fails, I'm using an assert False statement which will terminate the script and hence it moves on to other unittests following it, meanwhile on machine 2, still the test1 continues. But what I need is like, when test1 somehow fails on Machine1, Machine2 script should somehow terminate and parallely both machine should start test2 at the same time. I want to have this kind of sync between the two because in all the unittests, there is some interaction between two users on both machines.  

I tried using an xml-rpc call like, if something fails on Machine 1, before I make an assert statement, I make an xml-rpc call to the other Machine 2 to terminate. But unfortunately I know only scripts to either terminate the entire script as such, but thats not what i want here. Calling tearDown method(which contains a taskill command also won't work because it kills the app only, not terminate the unittest) 

So, my question is that, is there any other mechanism to terminate that particular unittest at the other end as well ?


Thanks in advance.

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