At least 2 ways.
I installed WordPress on my desktop using xampp for a Theme I was modifying (did not need to upload new files every time I made a change – just edit on the desktop) – after I had it running and wanted feedback from others I did a 2nd WordPress install in a subdirectlry of my online site and moved the revised theme online. When I put the new install on the web I did turn off the search engine options (did not want search engines indexing a site that mimicked an existing site)
No subdomain was needed.
You can do testing in your local system as well as on your website. To test it on live site, just create a folder let’s say worpress-test and install wordpress in it. To test it locally, you will need Wamp or Xampp or any similar application.