Skip to content

Commit

Permalink
test for include
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorpela committed Jan 28, 2024
1 parent c977f12 commit 20be11f
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/test_testlevelsplit_include.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os
import sys
import tempfile
import textwrap
import unittest
import shutil
import subprocess



class PabotPassJsonUsingVariableOptionTests(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
file_path = f"{self.tmpdir}/test.robot"
with open(file_path, "w") as robot_file:
robot_file.write(
textwrap.dedent("""
*** Test Cases ***
Testing 1
[Tags] tag
Log hello
Testing 2
[Tags] tag
Log world
"""))

process = subprocess.Popen(
[
sys.executable,
"-m" "pabot.pabot",
"--testlevelsplit",
"--verbose",
"--include",
"tag",
f"{self.tmpdir}/test.robot",
],
cwd=self.tmpdir,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)

self.stdout, self.stderr = process.communicate()

def test_stdout_should_display_passed_test(self):
first = b"Testing 1 | PASS |"
second = b"Testing 2 | PASS |"
self.assertEqual(self.stdout.count(first), 1, self.stdout)
self.assertEqual(self.stdout.count(second), 1, self.stdout)
self.assertIn(b"PASSED Test", self.stdout, self.stderr)

def tearDown(self):
shutil.rmtree(self.tmpdir)

0 comments on commit 20be11f

Please sign in to comment.