Skip to content

Commit

Permalink
Update the folder and packages for good understand
Browse files Browse the repository at this point in the history
  • Loading branch information
banrieen committed Apr 10, 2018
1 parent dd903b3 commit 311f627
Show file tree
Hide file tree
Showing 16 changed files with 752 additions and 9 deletions.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PyUnitReport</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
</pydev_project>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//tests/__init__.py=utf-8
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ Reports generated: /Users/Leo/MyProjects/ApiTestEngine/src/pyunitreport/reports/

### Html Output

![html output](docs/html_output.gif)
![html output](resources/html_output.gif)

![html output](docs/html_output.png)
![html output](resources/html_output.png)
13 changes: 11 additions & 2 deletions examples/testcase.py → examples/example_testcase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from pyunitreport import HTMLTestRunner

import unittest
import os,sys
import time
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from pyunitreport.HtmlTestRunner import HTMLTestRunner

class TestStringMethods(unittest.TestCase):
""" Example test for HtmlRunner. """
Expand Down Expand Up @@ -32,4 +36,9 @@ def test_skip(self):
pass

if __name__ == '__main__':
unittest.main(testRunner=HTMLTestRunner(output='example_dir'))
import os,sys
import time
output = os.path.join(os.path.abspath(os.path.dirname(__file__)),"{}_{}".format(os.path.splitext(os.path.basename(sys.argv[0]))[0] ,time.strftime("%H%M%S", time.localtime())))
unittest.main(testRunner=HTMLTestRunner(verbosity=2,output=output,report_name=time.strftime("%H%M%S", time.localtime()),report_title='example_testcase',failfast=False))


167 changes: 167 additions & 0 deletions examples/example_testcase_145439/145439.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<!DOCTYPE html>
<html>
<head>
<title>example_testcase</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2 class="text-capitalize">example_testcase</h2>
<p class='attribute'><strong>Start Time: </strong>2018-04-10 14:54:39</p>
<p class='attribute'><strong>Duration: </strong>0.001s</p>
<p class='attribute'><strong>Status: </strong>Pass: 3, Fail: 1, Error: 1, Skip: 1</p>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-10">
<table class='table table-hover table-responsive'>
<thead>
<tr>
<th>Testcases Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>

<tr class='success'>
<td class="col-xs-9">test_isupper (__main__.TestStringMethods)</td>
<td class="col-xs-3">
<span class="label label-success">

Pass

</span>

</td>
</tr>


<tr class='success'>
<td class="col-xs-9">test_split (__main__.TestStringMethods)</td>
<td class="col-xs-3">
<span class="label label-success">

Pass

</span>

</td>
</tr>


<tr class='success'>
<td class="col-xs-9">test_upper (__main__.TestStringMethods)</td>
<td class="col-xs-3">
<span class="label label-success">

Pass

</span>

</td>
</tr>


<tr class='danger'>
<td class="col-xs-9">This test should fail.</td>
<td class="col-xs-3">
<span class="label label-danger">

Fail

</span>

&nbsp<button class="btn btn-default btn-xs">View</button>

</td>
</tr>

<tr style="display:none;">
<td class="col-xs-9">
<p>AssertionError</p>
<p>1 != 2</p>
</td>
</tr>


<tr class='warning'>
<td class="col-xs-9">This test should be marked as error one.</td>
<td class="col-xs-3">
<span class="label label-warning">

Error

</span>

&nbsp<button class="btn btn-default btn-xs">View</button>

</td>
</tr>

<tr style="display:none;">
<td class="col-xs-9">
<p>ValueError</p>
<p></p>
</td>
</tr>


<tr class='info'>
<td class="col-xs-9">This test should be skipped.</td>
<td class="col-xs-3">
<span class="label label-info">

Skip

</span>

&nbsp<button class="btn btn-default btn-xs">View</button>

</td>
</tr>

<tr style="display:none;">
<td class="col-xs-9">
<p></p>
<p>This is a skipped test.</p>
</td>
</tr>


<tr>
<td>
Total Test Runned: 6
</td>
<td>
<span>Pass: 3, Fail: 1, Error: 1, Skip: 1</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('td').on('click', '.btn', function(e){
e.preventDefault();
var $this = $(this);
var $nextRow = $this.closest('tr').next('tr');
$nextRow.slideToggle("fast");
$this.text(function(i, text){
if (text === 'View') {
return 'Hide';
} else {
return 'View';
};
});
});
});
</script>
</body>
</html>
Loading

0 comments on commit 311f627

Please sign in to comment.