Redirect after submit form I use this code in my form ( buildForm(array $form, FormStateInterface $form_state) ) :

&lt;?php

namespace Drupal\test\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\user\PrivateTempStoreFactory;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Session\SessionManager;
use Symfony\Component\HttpFoundation\Response;

class TestForm extends FormBase {

    public function getFormId() {
        return 'TESTOLDTONEW';
    }

    public function buildForm(array $form, FormStateInterface $form_state) {
        \Drupal::service('page_cache_kill_switch')-&gt;trigger();

    $a['ad_mail'] = [
        '#type' =&gt; 'email',
        '#title' =&gt; t('Email ID:'),
        '#required' =&gt; TRUE,
    ];
    $b['total'] = [
        '#type' =&gt; 'hidden',
        '#attributes' =&gt; [
            'id' =&gt; 'actionsubmitid',
        ],
        '#value' =&gt; '0',
    ];
    $c['actions']['submit'] = [
        '#type' =&gt; 'submit',
        '#value' =&gt; $this-&gt;t('Finalize the purchase'),
        '#button_type' =&gt; 'primary',
    ];
    $test= [
        '#theme' =&gt; 'test',
        '#a' =&gt; $a,
        '#b' =&gt; $b,
        '#c' =&gt; $c,
    ];

    return $test;
    }

    public function validateForm(array &amp;$form, FormStateInterface $form_state) {

    }

    public function submitForm(array &amp;$form, FormStateInterface $form_state) {
        $form_state-&gt;setRedirect('test.new');
    }

}


Now I want redirect to a machin name ( for example "test.new" ) that create in routing.yml file . I use $form_state-&gt;setRedirect('test.new'); in "submitForm(array &amp;$form, FormStateInterface $form_state)" but not work .

EDITED :

.routing.yml

test.old:
  path: '/test/old'
  defaults:
    _form: '\Drupal\bpay\Form\TestoldForm'
  requirements:
    _permission: 'access content'

test.new:
  path: '/test/new'
  defaults:
    _controller: '\Drupal\bpay\Controller\TestnewController::new'
  requirements:
    _permission: 'access content'
The buildForm method needs to return $form. Not $test. You're missing key items by ignoring the $form variable. Properly set the form items (not as their own variable) and remove the custom theme hook you're trying to do. Cut this down to its simplest pieces first just to get it working and go from there. 

Get rid of $a $b $c variables as that doesn't make any sense, just use $form. Your submit info is not making it into the form itself, which is why it isn't working.