Best Python code snippet using autotest_python
test_FileOpen.py
Source:test_FileOpen.py
1from baangt.base import FilesOpen2from pathlib import Path3import os4import platform5import pytest6lXLSXFile = Path(os.getcwd()).joinpath("tests").joinpath("1TestResults").joinpath("baangt_testfranzi.xlsx_20200501_173746.xlsx")7lLogFile = Path(os.getcwd()).joinpath("tests").joinpath("logs").joinpath("20200502_100944.log")8lIsLinux = True if platform.system().upper() == "LINUX" else False9def test_Open_NoFile():10 lResult = FilesOpen.open("franzi")11 assert not lResult12@pytest.mark.skipif(lIsLinux, reason="Doesn't work on Linux")13def test_Open_XLSX():14 lResult = FilesOpen.open(lXLSXFile)15 assert lResult16def test_Open_LOGFILE():17 lResult = FilesOpen.open(lLogFile)18 assert lResult19@pytest.mark.skipif(lIsLinux, reason="Doesn't work on Linux")20def test_with_class_resultFile():21 lFilesOpen = FilesOpen.FilesOpen()22 lResult = lFilesOpen.openResultFile(lXLSXFile)23 assert lResult24def test_with_class_LogFile():25 lFilesOpen = FilesOpen.FilesOpen()26 lResult = lFilesOpen.openLogFile(lLogFile)27 assert lResult28@pytest.mark.skipif(lIsLinux, reason="Doesn't work on Linux")29def test_with_class_TestRunDefinitionFile():30 lFilesOpen = FilesOpen.FilesOpen()31 lResult = lFilesOpen.openTestRunDefinition(lXLSXFile)32 assert lResult33def test_with_class_invalidFile():34 lFilesOpen = FilesOpen.FilesOpen()35 lResult = lFilesOpen.openTestRunDefinition("franzi")...
test_output.py
Source:test_output.py
...15 print(output.workdir)16 assert isdir(output.root)17 assert isdir(output.workdir)18class TestFile:19 def test_open_logfile(self, root):20 output = Output(root=root, run_name="test")21 output.open_logfile("hello")22 for file_name in output.loggers:23 assert isfile(file_name)24 del output25class TestProject:26 def test_empty_init(self, root):27 output = Output(root=root, run_name="not_default")28 assert isdir(output.root)29 assert isdir(output.workdir)30 assert "not_default" in output.workdir31class TestReload:32 @pytest.mark.parametrize("append", [True, False])33 def test_restart(self, append):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!