Yes there is a way.
You may create a model file in your module which will have logic that cron is executing.
In your cron file, you just need to call that function.
Now to see the preview on faster mode, create frontend route and controller and call the same model function. Once your testing is done, you can delete controller file.
File: [Vendor]/[Module]/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="custommodule" frontName="custommodule">
<module name="[Vendor]_[Module]"/>
</route>
</router>
</config>
File: [Vendor]/[Module]/Controller/Crontest/Index.php
<?php
namespace [Vendor]\[Module]\Controller\Crontest;
use Magento\Framework\App\Action\Action;
class Index extends Action
{
protected $model;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\[Vendor]\[Module]\Model\Custom $model
)
{
parent::__construct($context);
$this->model = $model;
}
public function execute()
{
$this->model->executeLogic();
}
}
File: [Vendor]/[Module]/Model/Custom.php
<?php
namespace [Vendor]\[Module]\Model;
class Custom
{
public function __construct(
)
{
}
public function executeLogic()
{
die('here');
// your logic here
}
}
Now you may call URL like http://yourdomain/custommodule/crontest/index
Call the same function in your cron file as well. Both will have same output.
Once your testing is done, you may remove controller file.