Lavina
Lavina

Reputation: 3

Unable to see test result for python scripts on jenkins

I have written automation test scripts using pytest framework and I am trying to run the scripts using ant build on jenkins. Please help me see my test result:

1) I have done all the installations on jenkins (python 2.7, pytest, py, pip)

2) Here is the ant build.xml file I have created

<project name="test" default="tests" basedir="tests">
<!-- Run Register test case -->
<target name="test_register">
<echo message="Executing ${TestScript}"/>
<exec dir="." executable="python">
<arg line="${TestScript}.py"/>
</exec>
</target>
<!--  Run all Test cases  -->
<target name="runAll">
<echo message="Executing ${TestScript}"/>
<exec dir="tests" executable="python">
<arg line="python *.py"/>
</exec>
</target>
</project>

3) I tried to run the build and it gives me the following output http://screencast.com/t/YxJ2NLir3dn

Please help me to correct my process and setup

Upvotes: 0

Views: 1290

Answers (1)

KeepCalmAndCarryOn
KeepCalmAndCarryOn

Reputation: 9075

I'm just getting into python and junit tests and this seems to be a good resource

I think this is the bit you want (rather than use a test runner) add this to the end of your test file

if __name__ == '__main__':
    import xmlrunner
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))

Upvotes: 1

Related Questions