Monthly Archives: March 2019

ASP.NET MVC Project – Restaurants at the End of the Universe

It’s been a little while since I made a new MVC project, so why not start at the end of the universe?

    1. Start a new MVC project

      New Project screenshot

    2. Give it a model

       

    3. Pass the model to the View

       

    4. Display model properties in the View

       

    5. Test that the model exists


      Unit test screenshot

    6. Apply fresh paint to Site.css

       

    7. Run it

      About restaurants screenshot

    8. How did we get here?

      With the help of Global.asax and RouteConfig.cs

       

       

    9. Make a new Route with matching Controller

       

       

       

 

Testing with Python and Selenium

There are three kinds of lazy.

Let’s make sure we’re in the last category.

The Selenium library is a workhorse for automating your web browser. I use it to automate data entry and integration testing, but you could do much more with it as long as the task involves your browser. Scrape the DOM? Yes. Click buttons? Yes. Fill out forms? Yes. Handle alerts? Yes. Switch windows? Yes. Want more? Go read the docs. We’re just going to scrape the surface.

  1. From the Windows terminal

  2. Download Chrome Driver

    https://sites.google.com/a/chromium.org/chromedriver/downloads
    Make sure to get the version that matches your chrome version.
    What version of chrome do I have?
    Extract the zip and take note of the destination folder. You’ll need the .exe path in the next step.

  3. Open Python and import selenium


     
  4. Selenium + Unittest

    What is the answer to life, the universe and everything?
    Calculator says 42

  5. Run TestDemo.py from the CLI