For a [related question][1], I was trying to run apple Hardware Test (Apple diagnostics) on my Macbook Pro Retina.

Mackbook details:

[![enter image description here][2]][2]

I tried restarting with the D key pressed, with the intention of running Apple Hardware Test. 
I was greeted with the following screen:

[![enter image description here][3]][3]

On pressing R, the error continues further saying:

[![enter image description here][4]][4]

Pressing S shut it down.

I tried pressing option+D on startup. This starts internet recovery. I select the appropriate network and then it errors saying:

[![enter image description here][5]][5]

I researched online and a suggestion was that somehow the diagnostics tool is missing. And it was. There was no folder at `/System/Library/CoreServices/` called `.diagnostics`. 

I downloaded the relevant files from 
[https://github.com/upekkha/AppleHardwareTest][6]

To copy these files to the correct location I turned off SIP by going into recovery mode. After I copied the files, I restarted with D pressed, but I was met with the same errors. The same errors as above occured with option+D on startup as well.

How do I get apple diagnostics running again?

------
UPDATE:

I created a bootable USB with the relevant AHT as per the answer below.
On holding option at startup, I'm presented with a screen with three options: Macintosh HD, Windows, and EFI Boot.
I select EFI Boot, and a very quick black screen with a bunch of text appears and then the apple logo and loading bar appears. No AHT. I did the same thing on another machine - an Air, and it loaded the AHT, but said "Machine not supported", when I tried to run it, (which makes sense since the AHT is for a different model). I was able to capture the screen by taking a video of the process and then selecting the still frame. It goes by in less than half a second.

[![enter image description here][7]][7]


  [1]: https://apple.stackexchange.com/questions/370648/how-do-i-fix-battery-is-not-charging-for-2012-macbook-pro-retina
  [2]: https://i.sstatic.net/jSzqV.png
  [3]: https://i.sstatic.net/RZGyk.jpg
  [4]: https://i.sstatic.net/169MU.jpg
  [5]: https://i.sstatic.net/it8TB.jpg
  [6]: https://github.com/upekkha/AppleHardwareTest
  [7]: https://i.sstatic.net/kNfcF.jpg