Tuesday, November 10, 2020

Testing Roku builds in non-Prod environments

To test the builds in lower or non-Prod environments on Roku we need to follow the below steps:

  1. Setup an account on Roku site https://my.roku.com/account
  2. Link your roku device to this account by clicking the 'Link Device' button and following the steps
  3. Once the device is linked to the account, click 'Add channel with a code' link and enter the code of your test channel

This will install the test build on the Roku.

Thursday, May 28, 2020

Chromedriver version error


The one error that I have ran into a few times by now is the version mismatch error between the Chrome application and the chromedriver on my machine (Mac OS)

SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83

For most of my project I had an alias for chromedriver getting added in the lib folder (It would show up after successful execution of a test case but I need to figure out why it was showing up there). I would simply download the latest chromedriver version and drop it in the the original location of the driver-alias in the project. 

However just started a new project after not working on automation for past one year. In this new project the chromedriver alias is not getting added to project (again need to find out why not, what is diff between the two projects). While working through other issues today I landed back at this error (obviously I was demoing at the time, meh) and without the alias had to go googling about the error. 

So to fix the issue there are two possible solution
1. Update the chromedriver executable to the correct version manually OR
2. Use chromedriver-manager package to handle all the version management

Solution 1:

  1. Download the correct driver version from https://chromedriver.chromium.org/downloads
  2. Unzip the file
  3. Manually copy the executable to /usr/local/bin (overwrite the previous version in folder)
Solution 2:
I have not tested this solution yet but the idea makes sense. Will Need to understand how it works. https://stackoverflow.com/questions/60296873/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome


As always solution 1 has resolved the error, so I'll move on with the other issues on project. 


To Do:
  1. Why is chromedriver alias created in project 1
  2. Why is chromedriver alias NOT created in project 2
  3. Find out how solution 2 works and to set it up



Simple Tests

Looks like the issues just love me. I follow my own post to set up the same Selenium - VS C# express - NUnit environment on a second PC and loaded an existing project and ran into another set of error messages in NUnit. I mean what the heck.

The first one was
"Unable to find a version of the runtime to run this application"

By googling for the error got a clue here http://www.cnc-comm.com/community/index.php?topic=903.0 that installing .NET 4.0 does not automatically install .NET 2.0 We have to install it manually. So I downloaded http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=19 & installed .NET 2.0


This led me to another error when opening a project in NUnit
I tried to lookup the solution for this one, but couldn't find one quickly. By gut feeling I uninstalled the NUnit and re-installed it and it worked.

Friday, February 19, 2016

Setting up jMeter to test a SSL website

Another fairly common thing is testing websites protected with SSL. When I looked up how to do this - the steps didn't look very straight forward, and with my record of not getting anything work in a simple way, I got bit worried.


Tuesday, October 11, 2011

Introduction to NUnit Assertions

Continuing our tutorial after the first NUnit program, lets get ourselves bit accustomed with the central command/class in the framework - "Assert"

The Assert class defines tons of static methods which we use to verify the correctness of the program under test. So our test cases essentially perform some action on the program and then assert whether the outcome is what we expect. For eg: passing two arguments 2 & 3 to an Add method should return 5. If the method returns anything other than 5 then the Assertion fails which in turn marks the test-case as failed. Simple right! Yes!

So lets write few simple test-cases to see the Assert in action.To keep things simple lets not bother ourselves to find a program to test, we will simply use assertions on variables.
So go ahead and add a new class to the solution (Right click on solution name > Add > Class) and name it SimpleAssertions.cs. Paste the below code in this class file, rebuild the solution and Run the test-cases in NUnit

using System;
using NUnit.Framework;

namespace NUnitTest1
{
    [TestFixture]
    class SimpleAssertions
    {
        [Test]
        public void Add()
        {
            int val = 5 + 5;
            Assert.AreEqual(10, val);
        }

        [Test]
        public void FindGreater()
        {
            int a = 45;
            int b = 28;
            Assert.Greater(a, b);
        }

        [Test]
        public void CheckNull()
        {
            string str = "";
            Assert.NotNull(str);
        }

        [Test]
        public void IgnoreCase()
        {
            string small = "something";
            string caps = "SOMETHING";
            StringAssert.AreEqualIgnoringCase(small, caps);
        }
    }
}

Nothing fancy going here and the code is extremely readable thanks to clear method-names in NUnit. All the test-cases will pass when you run them.



Wednesday, July 6, 2011

NUnit: Simple

Next step is to write our own script in Nunit from scratch. To do this
Create a new project ‘NUnitTests’ in VS C# and select the project type as ‘Class library
Add reference to Nunit.Framework.dll in the Project
Rename the default class file (Class1.cs) to SimpleAssertTest.cs
Copy the below code in the file and compile it.

using System;
using NUnit.Framework;

namespace NUnitTest1
{
    [TestFixture]
    public class SimpleAssertTest
    {
        [Test]
        public void TestTrue()
        {
            Assert.IsTrue(true);
        }
       
        [Test]
        public void TestFault()
        {
            Assert.IsTrue(false);
        }

        [Test]
        public void TestEqual()
        {
            Assert.AreEqual(2, 2);
        }
        [Test]
        public void TestNotEqual()
        {
            Assert.AreEqual(2, 3);
        }
   
    }
}

The code will compile and depending on your VS project setup will generate the dlls in /debug or /release folder.
Start Nunit and open a project
Browse to the NUnitTests.dll and the tests will open in the nunit workspace
Run the tests

Friday, July 1, 2011

CLR version error on starting Nunit

I am totally new to Nunit and creating test cases in VS for it, so I google for tutorial, follow the steps word by word try to pull the project in NUnit and am received by a lovely window


Makes me feel either I am too dumb or Nunit needs to test their own product (least they could do is have some user friendly message and direct to proper documentation)

But things are not meant to be simple in ITville so I call upon my dear friend Google to help me out again and found a solution for how to fix it here

Just copying over the solution for ease of reference:
Open the nunit-x86.exe.config file (My file is at C:\Program Files (x86)\NUnit 2.5.10\bin\net-2.0)
Under <configuration> add:
<startup> 
     <supportedRuntime version="v4.0.30319" /> 
</startup>

and under <runtime> add:
<loadFromRemoteSources enabled="true" />

NOTE: It is always a good idea to leave the original setup files untouched (just in case you screw up something). Normally I rename the original file by adding a .ORIG extension, make its copy and then do any changes that I want.

If you still happen to get the same error every time you open NUnit, then delete all the shortcuts for NUnit and create a new one from the .exe in the bin folder again.

Credits: http://stackoverflow.com/questions/930438/nunit-isnt-running-visual-studio-2010-code