Testing is an essential part of software development. API testing, especially, is crucial to ensure that the API works as expected and meets its requirements. One such tool for API testing is Hurl. It is a command-line HTTP client that can be used to test APIs by sending HTTP requests with various parameters and assertions. In this blog post, we will explore how you can incorporate Hurl tests into your GitLab CI workflow to test an API.
I’ve been working with Golang on both personal projects and within my role at Serif for about six months now, and we’ve recently decided that Golang is a good fit for some of the new microservices we have plans for. Up until this point we’ve not had a need to use private packages.
Although the package management system in Golang is very simple - it basically just references a Git repository.
I’ve recently decided to start learning F# and my initial thoughts are that to learn the syntax effectively I should stick with writing code (and tests) just for domain logic and not think about IO (connecting to APIs, DBs, etc.)
I decided that something like Project Euler would be appropriate for learning the basic F# syntax. I’ve done some of these ‘code katas’ before but it’s been a good few years.
Given an API Gateway endpoint such as POST - /{UserId}/{MessageId}/read and a requirement to push a message to SQS using just the values contained within the request path. We can create a Integration Request template that pulls these values and creates an SQS message with a JSON body containing these values.
Within the CloudFormation template where we have defined our API in Swagger/OpenAPI we can use the following request template to extract the UserId and MessageId and send a message to an SQS queue such as this:
This is something that if you’ve not noticed yet, you will at some point and it’ll catch you out.
If you have an API Gateway configured in CloudFormation that is already deployed and you make changes to the structure of the API (maybe adding a new endpoint) when you deploy your CloudFormation stack you may expect your new changes to be deployed to the API Gateway Stage however this won’t always happen.
On several occasions over the last couple of years I’ve seen the following exception being thrown in web applications that use Entity Framework.
Once you know what might cause this issue it becomes quite obvious and easy to fix but for a junior developer or someone who hasn’t experienced it before it can be quite tedious to diagnose hence writing this post in the hope that it may help someone in the future.
As a Software Developer I am continuously learning, trying to improve my skillset and stay on top of the latest advances within the industry. Very recently I have been finding that I have a long list of languages, tools and techniques in my head that I want to learn more about. These can be anything from a new language that I’ve never touched before through to more advanced principles that build on my existing skillset.
Whilst working with a Facebook SDK on a recent project I came across the need to verify the Post method on the FacebookClient called with the correct parameters on a dynamic object.
The Facebook client uses reflection to get the required data from the parameters object but I don’t see a need to create a class with the properties when I can just use a dynamic object.
My final test is as follows:
I recently came across a blog post on LosTechies detailing how AutoMapper could be used to map from models to ViewModels in MVC controllers utilising custom ActionFilters.
I found this to be a fantastic way of keeping the code in our controller actions concise, avoiding ‘fat controllers’. In essence it allows you to decorate an MVC action with the [AutoMap(typeof(Person),typeof(PersonViewModel))] and then instead of having to write any mapping code at all within the action it will automatically take the model supplied within the return View(); statement and map it to the defined ViewModel.
At the start of January I started a year long photography project to take at least one photo each week for the year and even though at times I have been many weeks behind in posting photos online I have managed to complete the project without missing one week.
I feel that this is a quite an achievement considering we spent three weeks at the hospital 12 hours a day with Ellie and Isabelle, when they were first born in September.
Generating classes using entity framework is fairly problem free most of the time but you’ll soon find limitations once you need to add anything extra to these classes. EF generated classes are by default created as partial classes. This gives you the flexibility to create another ‘part’ to the class where you can write any additional code (methods, properties, etc.) that don’t get generated by entity framework. Most of the time this is sufficient however I recently came across a scenario where this pattern doesn’t work, and that is when you need to add data annotations for EF generated classes.
The best weekends are those in which you don’t have too many plans; last weekend was one of those. Sunday morning we decided a day trip was in order.
I had recently discovered a photographer named Rick Nunn and in one of his pieces of work, The Edit Station, he mentions a coffee shop in Lincoln called Coffee Aroma. It is listed as “One of the best 10 coffee shops in the UK” (Guardian Newspaper).
The idea behind this image was to document the chaos and excitement of the arrival of our twin daughters.
The image is composite of many images at least one for each items being ’thrown’ into the bag along with a base image of the bag on it’s own. Something different from what I’m used to but alot of fun to shoot and post process.
It has occurred to me recently that with digital photography and the ever expanding size of memory cards it isn’t uncommon to shoot several hundred photos at a time. Shooting in digital is also very inexpensive in comparison to shooting film as you don’t have the overhead of buying film and having it developed. This contributes to a spray and pray mentality, take lots of photos and hope that at least some come out well.
I’ve had this bag for several months now, so I thought I would write a review detailing how I’m finding it. I paid £36 for the bag on Amazon early March ’15. The RRP is £54 so I definitely got a bargain! The first great thing about this bag is that unless you know Lowepro make camera bags and happen to notice the very discreet logo on the front, you would never know what is inside.
Last weekend my Dad, Dexter and myself headed to the Berwyn mountains for a quick wildcamp, we left Burton at 5pm in glorious sunshine. We were heading for Pistyll Rhaeadr just outside of Llanrhaeadr-ym-Mochnant, Powys, Wales. It is often said to be the tallest waterfall and tallest single drop in Wales or England however it is neither. It has two drops and even its total height is less than others.
I am heading over to Wales this evening for a one night wild camp. I’ll be camping near to Pistyll Rhaeadr with Dexter and my Dad. I was hoping to make this a very light weight wild camp however that doesn’t seem to have gone to plan.
Here is most of the kit I am taking with me.
Missing from the photo is my Nikon DSLR, Manfrotto Tripod and a few of Dexter’s things.
I’m currently in the process of restructuring an ASP MVC project. The system was built around 9 months ago and unfortunately there are a few issues around the architecture of the system and as a result there is business logic that has creeped into the ‘data’ project. The current architecture of the system is something like this:
It is obvious there is something missing, a business project. As a result of this the business logic mainly resides within the repository objects with some creeping into the web project as well.
Today I did something drastic! I deleted almost all the code I had been working on over the last week or so and started again.
I’m currently working on a new application at work being written in AngularJS. This is the first real experience I’ve had with AngularJS and I’m learning lots every day. I am developing the application using TDD and thoroughly enjoying it however the last day or so I’ve started to notice certain aspects of the code aren’t as clean as I would like.
Being an avid VIM and OSX/Linux user it’s frustrating using Windows for a lot of things, however one aspect that would greatly increase my productivity and enjoyment of working on Windows would be getting VIM working correctly. I have to use Windows at work so investing some time in configuring VIM to work well makes sense.
Why doesn’t it work out the box? I can easily head over to vim.org and download the Windows installer for VIM.
This week I will be presenting at Agile Staffordshire with Paul Williams providing an introduction to the Vi text editor. This post is to detail all the resources that may be of use to anyone wanting to use Vi or Vim more productively. Apologies in advance for any typos or grammatical errors. I was struggling for time when I wrote this post.
What Makes Vim More Than Just A Text Editor?
The BlackRapid Curve is a lightweight, ergonomic, replacement camera strap. Its made from ballistic nylon and features a thick padded shoulder strap which curves to fit your body for optimum comfort.
The strap is in two parts, a fastener that screws into the tripod mount of your camera and the strap itself that has a locking carabiner to attach the strap to the fastener, more on that shortly.
The BlackRapid FastenR is solid stainless steel and screws directly into the base of the camera.
Saturday night I headed out for a small microadventure. I had set off with the intention of camping in Thor’s cave.
I made it into Wetton just as the sun set. There was snow piled up at the sides of the roads and the wind was quite bitter. I headed off down the path towards Thor’s cave which was considerably muddier than expected!
I reached Thors Cave and it was considerably darker than I had hoped for, I was navigating almost solely by head torch at this point.
So you want to have both WebAPI and MVC controllers in the same project. You add in the route configurations and the WebAPI controllers and come to run the project however you get an exception like this..
ExceptionMessage=Type 'MyProject.Web.Controllers.api.ProductController' does not have a default constructor
```
This seems odd, as you’re passing objects into the controller which you have previously configured the dependency injection for. The issue is that MVC and WebAPI have separate dependency resolvers and therefore no object is injected into the WebAPI controller at runtime.
Last weekend I headed to Wales for the weekend with Dexter and my Dad for some walking. We set off after lunch on Friday and made it to Betws-y-coed by just before 1700hrs. All the way from the Welsh border it was clear blue skies and sunshine, almost unheard of in Wales!
My campsite of choice Dolgam on the A5 after the Ugly house and Capel Curig Training camp unfortunately has a sign stating no dogs and even after trying to bargain with the Lady at the campsite it was a no, however she did suggest the campsite at Swallow Falls which she assured me did allow dogs.
Reflection in .NET is something I’d heard of but never knew what it was. I’d also never thought to find out. That all changed when working on a .NET MVC project recently.
One of the requirements for the project I was working on was to create an audit trail of user actions including fields that had been updated. This wasn’t a problem for small records where only 1 or 2 fields were editable by the user.
So the last few hours I’ve been racking my brain trying to figure out at what point I was doing an INT conversion. After stepping through the code from the web tier down to the EF context no luck!
I have a stored procedure in SQL Server 2014 that should be returning a decimal. It’s a very simple stored procedure similar to this..
ALTER PROCEDURE [dbo].[spGetDays](@UserId nvarchar(10), @DateFrom datetime, @DateTo datetime, @ALDays decimal(6,1) OUTPUT) AS BEGIN declare @end datetime = DATEADD(hour,23,@DateTo);
set @end = DATEADD(minute,59,@end);
declare @count int;
SELECT @count = COUNT(*) FROM Activity
WHERE UserID = @UserId
AND (ActivityDate BETWEEN @DateFrom AND @end);
set @ALDays = CAST(@count AS DECIMAL(6,1)) / CAST(2 AS DECIMAL(6,1));
END When I execute the procedure in SQL Management studio the result I am expecting 17.
Overview I always find it interesting to see how different people work. What tools they use and how they use them? Any plugins that they find useful? Even things like colour schemes and fonts that they like to work with. I find it helps discover new ways of working to make it more enjoyable or more efficient. Therefore in this first ‘Development’ blog post I will detail how I like to work, the tools I use and I’ll go into some of the reasons why I work in certain ways.
This weekend I decided to set myself the challenge of running further than I had done before. Previously the furthest I had ran was 10 miles.
I got up at 06.30 this morning ready to run! After a hot cup of coffee, I went out into what felt like winter and off I went.
A couple of hours later, 3 rich tea biscuits, an apple and quite a few nettle stings I got back home having ran 21km (13.
Back at the start of august I went on a mini adventure to North Wales for the weekend for a 2 night wildcamp. I went with Dexter, my 10 month old Border Collie and a friend Paul @paulswilliamsuk.
We drove to Llanduddno on the Friday afternoon hitting all the rush hour traffic. Once we had parked up it was off to the pub for a big pub meal and a pint before catching the bus down the coast.