Как вкладывать мокко, описано в junit.xml - PullRequest
0 голосов
/ 31 октября 2018

У меня есть серия тестов мокко, которые включают в себя вложенные описания, такие как

describe('Tests.', () => {
  describe('Test Method 1', () => {
    it('should do x', () => {
      // test code
    });

    it('should do y', () => {
      // test code
    });
  });
  describe('Test Method 2', () => {
    it('should do x', () => {
      // test code
    });

    it('should do y', () => {
      // test code
    });
  });
});

Я использую mocha-junit-reporter для создания файла junit.xml, который выглядит следующим образом

<testsuite name="Root Suite Tests." failures="0" time="0"> </testsuite>
<testsuite name="Root Suite Tests. Test Method 1" failures="0" time="0">
  <testcase name="should do x" time="0" classname="Tests. Test Method 1 should do x"> 
  </testcase>
  <testcase name="should do y" time="0" classname="Tests. Test Method 1 should do y"> 
  </testcase>
</testsuite>
<testsuite name="Root Suite Tests. Test Method 1" failures="0" time="0">...</testsuite>
<testsuite name="Root Suite Tests. Test Method 2" failures="0" time="0">
  <testcase name="should do x" time="0" classname="Tests. Test Method 2 should do x"> 
  </testcase>
  <testcase name="should do y" time="0" classname="Tests. Test Method 2 should do y"> 
  </testcase>
</testsuite>
<testsuite name="Root Suite Tests. Test Method 2" failures="0" time="0">...</testsuite>

Опции для mocha-junit-reporter

"useFullSuiteTitle": true,
"testCaseSwitchClassnameAndName": true

Файл JUnit.xml при отображении в Jenkins с помощью плагина анализатора результатов теста выглядит следующим образом

Тесты

 Test Method 1 should do x

 Test Method 1 should do y    

 Test Method 2 should do x    

 Test Method 2 should do y

Я бы хотел, чтобы это отображалось так

Тесты

 Test Method 1 

      should do x

      should do y 

 Test Method 2 

      should do x 

      should do y

Возможно ли это? И если это возможно, что мне нужно сделать, чтобы сделать это так?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...