Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Unable to generate ruby based allure reports #20

Closed
ShettyA opened this issue Apr 20, 2016 · 4 comments
Closed

Unable to generate ruby based allure reports #20

ShettyA opened this issue Apr 20, 2016 · 4 comments

Comments

@ShettyA
Copy link

ShettyA commented Apr 20, 2016

Failing to generate alllure reports. Trying out a basic example. Am I missing something here?
Sample test code

require 'test/unit'
require 'allure-ruby-adaptor-api'

class StringTest < Test::Unit::TestCase

  def test_length
    s = "Hello, World!"
    assert_equal(13, s.length)
  end

end

AllureRubyAdaptorApi.configure do |c|
  c.output_dir = "/reports"
end

builder = AllureRubyAdaptorApi::Builder
builder.start_suite "StringTest", :severity => :normal
builder.stop_suite "StringTest"
builder.build!
@smecsia
Copy link
Contributor

smecsia commented Apr 21, 2016

@ShettyA You must start test cases as well as test suites. Your problem is in this condition.

@smecsia
Copy link
Contributor

smecsia commented Apr 25, 2016

Closing this for now. Feel free to reopen if you have any additional problems.

@smecsia smecsia closed this as completed Apr 25, 2016
@ShettyA
Copy link
Author

ShettyA commented Apr 25, 2016

You are right. The following worked.

require 'test/unit'
require 'allure-ruby-adaptor-api'

class StringTest < Test::Unit::TestCase

  def test_length
    s = "Hello, World!"
    assert_equal(13, s.length)
  end
end

builder = AllureRubyAdaptorApi::Builder
builder.start_suite "StringTest", :severity => :normal
builder.start_test "StringTest", "test_length", :severity => :critical
builder.stop_test "StringTest", "test_length", :status => :broken, :exception => Exception.new("some error")
builder.stop_suite "StringTest"
builder.build!

@NavyaGunde
Copy link

This is exactly my code. I still have issues with this. It executes fine when I run this from Visual Studio Code. It also generates the XML file.


require 'aws-sdk'
require 'allure-ruby-adaptor-api'
require 'test/unit'

class StringTest < Test::Unit::TestCase
    def test_length
      s = "Hello, World!"
      assert_equal(13, s.length)
    end
end

builder = AllureRubyAdaptorApi::Builder
builder.start_suite "StringTest", :severity => :normal
builder.start_test "StringTest", "test_length", :severity => :critical
builder.stop_test "StringTest", "test_length", :status => :broken, :exception => Exception.new("some error")
builder.stop_suite "StringTest"
builder.build!

The XML looks like below. I've multiple questions here.

  1. Why does the test status shows as broken in the XML below.
  2. Why is there a failure message.
  3. When this XML is converted into the HTML report using Command Line, the HTML report is showing as 0 test cases. Why?

<?xml version="1.0"?>
<ns2:test-suite xmlns="" xmlns:ns2="urn:model.allure.qatools.yandex.ru" start="1505627368257" stop="1505627368257">
  <name>StringTest</name>
  <title>StringTest</title>
  <test-cases>
    <test-case start="1505627368257" stop="1505627368257" status="broken">
      <name>test_length</name>
      <title>test_length</title>
      <failure>
        <message>some error</message>
        <stack-trace/>
      </failure>
      <steps/>
      <attachments/>
      <labels>
        <label name="severity" value="critical"/>
        <label name="thread" value="20044420"/>
        <label name="host" value="GUNDE1"/>
      </labels>
      <parameters/>
    </test-case>
  </test-cases>
  <labels>
    <label name="severity" value="normal"/>
    <label name="thread" value="20044420"/>
    <label name="host" value="GUNDE1"/>
  </labels>
</ns2:test-suite>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants