Serial not working Arduino Mega 2560

Hi everyone I was trying to understand why I can't make Arduino Mega 2560 Serial work properly. I tried this simple code (connecting TX pin 12 with RX pin 11) in order to check Serial.read() and Serial.write(). Once the code is uploaded and I open the serial monitor I get only "NotAvailable".
On the Arduino board the TX light is on while the RX is always off.

#include <SoftwareSerial.h>
SoftwareSerial test(11,12); //Rx Tx 

void setup() {
  test.begin(9600);
  Serial.begin(9600); 
}

void loop() {
  
  if (test.available() > 0)
  {
     Serial.println(test.read());
  }
  
  else 
  {    
    Serial.println("NotAvailable");
    test.write(15);
  }
  
}

I also tried this sketch (without using SoftwareSerial.h library) and here I'm getting on the monitor is the number "10".
Of course pin connected are TX pin1 and RX pin0.

void setup() {
  Serial.begin(9600);
}

void loop() {
  
  if (Serial.available() > 0)
  {
     Serial.println(Serial.read());
  }
  
  else 
  {    
    Serial.println("Not Available");
    Serial.write(15);
  }
  
}

The problem is that in the first i'm not receiving anything and in the second the value is always the same (even if i change the number 15 with a char or another number).
Do you have any suggestion?

Thank you.

Why use software serial on a mega 2560?

I am also quite sure that you can not send over swSerial and receive that same signal over swSerial as well,
and here

  if (Serial.available() > 0)
  {
     Serial.println(Serial.read());
  }

you are causing an endless loop, and the number you see is the NewLine Really Serial is meant for transmitting between 2 machines, not for testing to send to itself.

I also tried this sketch (without using SoftwareSerial.h library) and here I'm getting on the monitor is the number "10".

when i downloaded your 2nd sketch to my Uno, the IDE serial monitor screen was flooded with some garbage character (probably your 15) followed by "Not Available"

Of course pin connected are TX pin1 and RX pin0.

i did not connect pins 0 & 1 together. not sure that would work, nor is a good idea

the Mega has 4 Hardware Serial interfaces. There's no need to use Software Serial. See Serial pins

i don't thing connecting the pins together is a good test. Maybe you can connect the RX pins from Serial and Serial 1 together to see if you receive on Serial 1 what is entered from the Serial Monitor?