How to fix the Newman task for Team Foundation Server silently failing

The Problem

Running the NewmanPostman_VSTS_Task on our on-premise Microsoft Visual Studio Team Foundation Server 2017.3.1 finished successfully, but no tests were run:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
##[section]Starting: Newman - Postman
==============================================================================
Task : Newman the cli Companion for Postman
Description : Using Newman, one can effortlessly run and test a Postman Collections directly from the
Version : 3.0.21
Author : Carlo Wahlstedt
Help : [More Information](https://github.com/carlowahlstedt/NewmanPostman_VSTS_Task/blob/master/README.md)
==============================================================================
found 1 files
No specific path to newman, using default of 'newman'
No custom report configured
Reporter list is : cli,json,junit
[command]C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm\node_modules\newman\bin\newman.js run D:\TFS\Delivery\01\119\s\Delivery\ApiTests\BTW2019\BTW2019.postman_collection.json -r cli,json,junit -n 1 -e D:\TFS\Delivery\01\119\s\Delivery\ApiTests\BTW2019\BTW2019.Dev03.postman_environment.json
2019-01-09T09:49:11.3043192Z ##[section]Finishing: Newman - Postman

TL;DR

When the NewmanPostman_VSTS_Task tries to run AppData\Roaming\npm\node_modules\newman\bin\newman.js instead of AppData\Roaming\npm\newman.cmd ensure that the PATH environment variable for the user that the builds run on has C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm in it, and reboot the server after that.

The Solution

I’ve already spoiled the ending of this blog post in the section above so the following is only interesting for people who like to know how I - despite starting with looking in the wrong place - managed to find a solution.

When I tried to run the same command directly on the build server …

1
2
C:\Windows\system32>C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm\node_modules\newman\bin\newman.js run D:\TFS\Delivery\01\119\s\Delivery\ApiTests\BTW2019\BTW2019.postman_collection.json -
r cli,json,junit -n 1 -e D:\TFS\Delivery\01\119\s\Delivery\ApiTests\BTW2019\BTW2019.Dev03.postman_environment.json

… it opened the newman.js file in Notepad, instead of running the command!

This however did work as expected, so Newman was installed properly:

1
2
3
4
5
6
7
8
9
C:\>newman --help
Usage: newman [options] [command]

Options:
-v, --version output the version number
-h, --help output usage information

Commands:
run [options] <collection> URL or path to a Postman Collection.

I disassociated .js files from Notepad by running the ASSOC command:

1
2
C:\Windows\system32>assoc .js=
The system cannot find the file specified.

“If ASSOC is invoked with just a file extension, it displays the current
file association for that file extension. Specify nothing for the file type and the command will delete the association for the file extension.”

This did not change anything, so I decided to reboot the build server. That did not change a thing too.

I then decided to search everywhere for “change the file type” and clicked “Change the file type associated with a file extension”. There I noticed that .js was still associated with Notepad! I decided to change the association to “Microsoft ® Windows Based Script Host”, because the .jse extension had that too.

Now when I excuted the newman.js run command I got an error instead of Notepad being opened:

There is no script engine for file extension “.js”.

So I tried another reboot, once more without success. I decided to have a look at our Development build server, where Newman was running correctly. There everything looked to be set up in the same way: no file association according to assoc .js, associated to “Microsoft ® Windows Based Script Host” according to “Set Associations”, and no mention of Newman in Environment PATH variables.

Looking at the logs of the “Newman - Postman” task of the build I noticed a difference. The successful one had this:

[command]C:\Windows\system32\cmd.exe /D /S /C “C:\Users[BUILDSERVER-USERNAME]\AppData\Roaming\npm\newman.cmd run …

The one that used to run the [NewmanPostman_VSTS_Task] but not executing any tests now failed with:

found 1 files
No specific path to newman, using default of ‘newman’
##[error]Unable to locate executable file: ‘newman’.
Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable.
Also verify the file has a valid extension for an executable file.

With that information I decided to have a look at the PATH variable in the Environment Variables of the Development build server: no mention of Newman there too.

I then realized that the builds run on a particular account. Here’s what I found in that User’s PATH variable (without the line-breaks):

C:\Users\[BUILDSERVER-USERNAME]\AppData\Local\Programs\Python\Python37-32\Scripts\;
C:\Users\[BUILDSERVER-USERNAME]\AppData\Local\Programs\Python\Python37-32\;
C:\Users\[BUILDSERVER-USERNAME]\AppData\Local\Programs\Python\Launcher\;
C:\Users\[BUILDSERVER-USERNAME]\.dotnet\tools;
C:\Program Files\Nodejs;
C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm

And nothing related to npm or newman in the system’s Environment Variables.

I found only this for the User PATH variable on the ‘problem server’:

C:\Users\[BUILDSERVER-USERNAME]\.dotnet\tools

And nothing related to npm or newman in that system’s Environment Variables too.

Looking at those difference I decided to try to add C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm to the PATH variable for the [BUILDSERVER-USERNAME] user.

Tried the build again but it still failed with Unable to locate executable file: 'newman'. Time for a restart. That finally did the trick!

Now the build ran Newman like this:

C:\Windows\system32\cmd.exe /D /S /C “C:\Users[BUILDSERVER-USERNAME]\AppData\Roaming\npm\newman.cmd run D:\TFS\Delivery\01\119\s\Delivery\ApiTests\AangifteStatusAPI\AangifteStatusAPI.postman_collection.json -r “cli,json,junit” -n 1 -e D:\TFS\Delivery\01\119\s\Delivery\ApiTests\AangifteStatusAPI\AangifteStatusAPI.Delivery.postman_environment.json”

Instead of this:

C:\Users[BUILDSERVER-USERNAME]\AppData\Roaming\npm\node_modules\newman\bin\newman.js run D:\TFS\Delivery\01\119\s\Delivery\ApiTests\BTW2019\BTW2019.postman_collection.json -r cli,json,junit -n 1 -e D:\TFS\Delivery\01\119\s\Delivery\ApiTests\BTW2019\BTW2019.Dev03.postman_environment.json

So I was looking in the wrong place all the time: it wasn’t a problem with running .js files, it was actually a problem with the wrong command being run.

Conclusion

When the NewmanPostman_VSTS_Task tries to run AppData\Roaming\npm\node_modules\newman\bin\newman.js instead of AppData\Roaming\npm\newman.cmd ensure that the PATH environment variable for the user that the builds run on has C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm in it, and reboot the server after that.

Don’t be fooled by the task executing newman.js but not running any test, and don’t go on an expedition trying to fix that!

Happy holidays and a great 2019!

This is our Christmas card for this year. We’ve also sent out luxury hard-copy postcard version to 50 lucky people. Do you still send Christmas/New Year’s cards?

I’ve photoshopped this image from these two sources - a photo of my copy of one of my favourite Herb Alpert & The Tijuana Brass albums:

And a photo by my wife of our whippet dog Juno. He can run for 70 km/h but he was also trained to hold a rose in his mouth:

The original album title is “Whipped Cream & Other Delights” which was punningly changed to “Whippet Cream”.

Further reading:

My Musical Discoveries Of 2018

Music I’ve discovered in 2018 (not made in 2018), in no particular order:

New York - Addis - London: The Story of Ethio Jazz 1965-1975 by Mulatu Astatke

Rest by Charlotte Gainsbourg

Bedouine (Deluxe) by Bedouine

Psycho Tropical Berlin by La Femme

Skeleton Tree by Nick Cave & The Bad Seeds

Luwten by Luwten

My Top 18 Albums Of The Year

My Top 18 albums of the year, in no particular order.

Remain in Light by Angelique Kidjo

West African singer Angélique Kidjo’s full-album cover of Talking Heads’ 1980 classic Remain in Light.

Singularity by Jon Hopkins

Melancholic electronic: my favourite genre. Saw a great set at the Down The Rabbit Hole too.

Suspiria (Music for the Luca Guadagnino Film) by Thom Yorke

The film is great too!

Dionysus by Dead Can Dance

Looking forward to their concert in Utrecht next year.

The Deconstruction by Eels

His concert in Utrecht was okay too, though it could not top his show with a string quartet I saw in Groningen a long time ago.

Where Wildness Grows by Gengahr

Young, eager band I saw in the tiny Sugarfactory club in Amsterdam.

Cocoa Sugar by Young Fathers

The only act doing interesting stuff in contemporary hiphop.

Superorganism by Superorganism

My favourite new band! Saw them in the Sugarfactory too.

American Utopia by David Byrne

Best show of the year (and in my all-time top 5): David Byrne at Down The Rabbit Hole.

Con Todo El Mundo by Khruangbin

You’ve got to love this: “smooth, mainly instrumental music [..] heavily influenced by Thai rock and funk“.

If you like the XX ot Budos Band and any type of off-centre world music you’re going to love this.

Radio Highlife by Auntie Flo

Super-exciting hybrid of world and electronic music.

How To Solve Our Human Problems (Parts 1-3) by Belle & Sebastian

Nothing exciting and new but a resounding pleasure.

I Like Fun by They Might Be Giants

They have been going steady since the 1990s but this did feel like a comeback album to me, and I enjoyed their show at Paradiso.

The Long March by Le Trio Joubran

My favourite palestinian Ud Tri. Saw them in Amsterdam during the Ud Festival this year on the night this album was released.

Maghreb United by Ammar 808

This act might me open for me when I tour with my Aleppo Favela Soundsystem.

On by Altin Gün

Dutch artists inspired by 1970s Turkish psychedelic rock. Didn’t catch them live yet.

ANNO: Four Seasons by Anna Meredith & Antonio Vivaldi by Anna Meredith, Scottish Ensemble, Jonathan Morton

classic music re-mixed and re-interpreted.

MADAME by Alice on the roof

Album cover by Hellen van Meene!

Business Trip To Belgrade, Serbia - Day 5

Click on an image to start a slideshow.

The last day at the Belgrade office. See also day one, day two, day three and day four.

Went to the Farmer’s market “Zeleni venac” (Пијаца „Зелени венац“) before breakfast (make sure you look at the smileys in the pickled vegetables jars), to see something of the city at daylight! Around noon it started snowing, and we’re now at the airport.

Record Stores in Belgrade, Serbia

Here’s my small guide to shopping for vinyl records in Belgrade. You won’t find any bargains when shopping for new vinyl here: the prices are the same or higher compared to the Netherlands, or any other Western European country. I did find some great new and second-hand local records though!

Usce Shopping Mall

At this mall I found the smallest record store ever! It’s a small stall on the ground floor powered by Metropolis Music and Mascom Records.

The Vulkan bookstore at the top level has a small vinyl section:

At this store I bought the above record for 2499 RSD: Golden Horns - The Best Of Boban I Marko Marković Orkestar. I first heard this music in Emir Kusturica’s epic 1995 movie Underground:

Here are two of the songs on the album:

Muzička kuća Metropolis

A large record store that also doubles as a bar. Didn’t buy anything there. Open until late at night.

ПГП РТС

Didn’t go in there because it looked like they only sold CD’s.

Felix Shop

This place mostly sells rock-band t-shirts and has a very small selection of CD’s and also - surprisingly - some cassettes. It’s at the first floor of the building.

Knjižare Vulkan

This Vulkan book store has a small selection of vinyl records in the basement.

Yugovinyl record store Belgrade

This is my favourite record store in Belgrade, with a huge selection of vinyl records, both new and second-hand. It was a bit hard to find: when you think you’re looking at the entrance of a parking lot you’re in the right place. Very friendly and helpful staff, and there’s a record player with headphones were you can listen to the stuff you pick from the crates and shelves. Prices are on the inside of the records. Open all evening! I bought one new and five second-hand (priced between 800 - 2000 RSD) Serbian/Yugoslavian records there, mostly brass bands. They also had an impressive collection of Turkish 70’s psychedelic rock, for example.

Here’s what I bought at Yugovinyl:

Listen to the funky drumming on this track by Zorica Markovic:

Frantic brass and a resolutely non-4/4 time signature on this track by Redzepova Usnija:

And finally the Duvački Orkestar Radovana Babića ‎in action:

(Updated 2018-12-15 16:57 added photos of ПГП РТС)

Static And Dynamic Caching On Incapsula Can Cause CORS errors

We’re loading an SVG sprite via AJAX from our CDN because SVG is XML and that’s not allowed to be loaded cross-domain. That all worked fine across all our environments, but it broke on production:

1
2
3
Access to XMLHttpRequest at 'https://cdn.foo.bar/images/svg/sprite.svg' from origin 
'https://www.foo.bar' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.

That was strange because for the “cdn.foo.bar” app service was already configured to allow all origins: “ALLOWED ORIGINS = *”.

It turned out the Incapsula WAF caching was configured to Static + Dynamic. After disabling caching in Incapsula the CORS error was gone.

Business Trip To Belgrade, Serbia - Day 3

Click on an image to start a slideshow.

The third day at the Belgrade office. See also day one and day two.

Some office photos: yes, there are standing-, pool- and table football tables, just as we have in Amsterdam. Dinner at the lovely Majstor i Margarita restaurant (*), adventurous cocktails at the well-hidden Beogradski Koktel Klub, and some street photos, including the second of two pieces of street art advertising veganism I saw tonight.

(*) The Majstor i Margarita restaurant is probably named after “one of the best novels of the 20th century”

From Wikipedia:

The Master and Margarita (Russian: Мастер и Маргарита) is a novel by Russian writer Mikhail Bulgakov, written in the Soviet Union between 1928 and 1940 during Stalin’s regime. A censored version was published in Moscow magazine in 1966–1967, after the writer’s death. The manuscript was not published as a book until 1967, and then first in Paris. A samizdat version circulated that included parts cut out by official censors, and these were incorporated in a 1969 version published in Frankfurt. The novel has since been published in several languages and editions.

The story concerns a visit by the devil to the officially atheistic Soviet Union. The Master and Margarita combines supernatural element with satirical dark comedy and Christian philosophy, defying a singular genre. Many critics consider it to be one of the best novels of the 20th century, as well as the foremost of Soviet satires.