My company uses .NET and has libraries to interact with GUI. I would like to convince my team to use Robotframework for test scripts.
I try to create a POC for this reason, which loads the dll's needed and runs a test script. A prerequisite is that I can load .NET DLL that interacts with GUI library.
But I am stuck here, Ironpython cannot load one of the dependent DLL's or it's dependency.
--------------------------------------------------------------------------------------------------------------------------
import clr
import sys
sys.path.append('D:\\tfs\\sandbox\\calculatordemo\\calculatordemo\\_Dependencies')
from exceptions import SystemError, Exception
import System
import System.Reflection
clr.AddReference('Components')
from System.Reflection import ReflectionTypeLoadException
try:
from Components import Calculator
calculator = Calculator()
calculator.Start()
print Calculator.Ready()
except System.Reflection.ReflectionTypeLoadException as e2:
print e2.LoaderExceptions[0]
except Exception as e2:
print('Exception occurred: ' + e2.message)
--------------------------------------------------------------------------------------------------------------------------
Output:
System.IO.FileNotFoundException: Could not load file or assembly 'Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856' or one of its dependencies. The system cannot find the file specified.
File name: 'Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856'
=== Pre-bind state information ===
LOG: DisplayName = Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/IronPython 2.7/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\IronPython 2.7\ipy64.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
---------------------------------------------------------------------------------------------------------------------------
All dependencies should be in _Dependencies-folder. Similar script created as C# project works. IL Spy does not show any dependencies that should not be available.
Thanks for any help in helping to solve this! I did not yet find any help after several days of studies.