Loading drivers for cross-browser testing with Selenium

Another post so I don’t forget how I fixed a problem…. I have been making sure some Selenium UX tests that were originally written against Chrome also work with other browsers. I have had a few problems, the browser under test failing to load or Selenium not being able to find elements. Turns out the solution is to just use the custom driver start-up options, the default constructors don’t seem to work for browsers other theran Chrome and Firefox. ...

April 21, 2021 · 1 min · Richard Fennell

Fix for ‘System.BadImageFormatException’ when running x64 based tests inside a Azure DevOps Release

This is one of those blog posts I write to remind my future self how I fixed a problem. The Problem I have a release that installs VSTest and runs some integration tests that target .NET 4.6 x64. All these tests worked fine in Visual Studio. However, I got the following errors for all tests when they were run in a release 2020-04-23T09:30:38.7544708Z vstest.console.exe "C:agent\_workr1aPaymentServicesdroptestartifactsPaymentService.IntegrationTests.dll" 2020-04-23T09:30:38.7545688Z /Settings:"C:agent\_work\_tempuxykzf03ik2.tmp.runsettings" 2020-04-23T09:30:38.7545808Z /Logger:"trx" 2020-04-23T09:30:38.7545937Z /TestAdapterPath:"C:agent\_workr1aPaymentServicesdroptestartifacts" 2020-04-23T09:30:39.2634578Z Starting test execution, please wait... 2020-04-23T09:30:39.4783658Z A total of 1 test files matched the specified pattern. 2020-04-23T09:30:40.8660112Z X Can\_Get\_MIDs \[521ms\] 2020-04-23T09:30:40.8684249Z Error Message: 2020-04-23T09:30:40.8684441Z Test method PaymentServices.IntegrationTests.ControllerMIDTests.Can\_Get\_MIDs threw exception: 2020-04-23T09:30:40.8684574Z System.BadImageFormatException: Could not load file or assembly 'PaymentServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. 2020-04-23T09:30:40.8684766Z Stack Trace: 2020-04-23T09:30:40.8684881Z at PaymentServices.IntegrationTests.ControllerMIDTests.Can\_Get\_MIDs() … 2020-04-23T09:30:40.9038788Z Results File: C:agent\_work\_tempTestResultssvc-devops\_SVRHQAPP027\_2020-04-23\_10\_30\_40.trx 2020-04-23T09:30:40.9080344Z Total tests: 22 2020-04-23T09:30:40.9082348Z Failed: 22 2020-04-23T09:30:40.9134858Z ##\[error\]Test Run Failed. Solution I needed to tell vstest.console.exe to run x64 as opposed to it’s default of x32. This can be done with a command line override –platform:x64 ...

April 23, 2020 · 1 min · Richard Fennell

Where do I put my testing effort?

In the past I have blog on the subject of using advanced unit test mocking tools to ‘mock the unmockable’. It is an interesting question to revisit; how important today are units tests where this form of complex mocking is required? Of late I have certainly seen a bit of a move towards using more functional style tests; still using unit test frameworks, but relying on APIs as access points with real backend systems such as DBs and WebServices being deployed as test environments. ...

May 17, 2018 · 2 min · Richard Fennell