User Tools



Ruby

The following sections provide information on using Testspace with popular Ruby test frameworks and tools.

To push the collected result files to Testspace simply use the following client command line:

testspace static-analysis-results test-results code-coverage-results credentials@org-name.testspace.com/project-name/space-name 

where:

For more information on pushing results refer to the Collecting Data article.


Test Frameworks

Minitest

Minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking.

Testspace accepts the JUnit XML formatted Test results. To produce such the ci_reporter_minitest needs to be configured with your test runner. Assuming you are using Minitest within a Rails application, configured to generated report files at ./test/reports, simply run your tests:

rake minitest test

In the Testspace client command line reference ./test/reports/*.xml as "test-results" files.

RSpec

RSpec is a Behaviour-Driven Development tool for Ruby programmers.

Testspace accepts the JUnit XML formatted Test results. To produce such the ci_reporter_rspec needs to be configured with your test runner. Assuming you are using RSpec within a Rails application, configured to generated report files at ./spec/reports, simply run your tests:

rake ci:setup:rspec spec

In the Testspace client command line reference ./spec/reports/*.xml as "test-results" files.


Code Coverage Tools

SimpleCov

SimpleCov is a code coverage analysis tool for Ruby.

Testspace accepts the Cobertura XML formatted results. Assuming Cobertura formatter is installed and configured with your Test Framework to put results at ./coverage, running your tests would also automatically produce the desired XML Report.

In the Testspace client command line reference ./coverage/coverage.xml as "code-coverage-results" file.


Static Analysis Tools

Brakeman

Brakeman is a vulnerability scanner specifically designed for Ruby on Rails applications.

Testspace accepts Checkstyle XML formatted results. Brakeman does not produce this natively, however BrakemanTranslateCheckstyleFormat could be used to interpret the native brakeman data files and generate the desired XML Report. Here is an example of how to produce such:

brakeman -o brakeman.json
brakeman_translate_checkstyle_format translate --file="brakeman.json" > analysis.xml

Note if you still want the full output of brakeman captured in the console use two `-o` options:

brakeman -o brakeman.json -o /dev/stdout

In the Testspace client command line reference analysis.xml as "static-analysis-results" file.

Rails Best Practices

Rails Best Practices is a code metric tool for Rails projects.

Testspace accepts Checkstyle XML formatted results. Here is an example of how to produce such:

rails_best_practices --format xml --output-file analysis.xml

In the Testspace client command line reference analysis.xml as "static-analysis-results" file.

Reek

Reek is a code smell detector for Ruby.

Testspace accepts Checkstyle XML formatted results. Here is an example of how to produce such:

reek --format xml > analysis.xml

In the Testspace client command line reference analysis.xml as "static-analysis-results" file.

Rubocop

Rubocop is a static code analyzer that enforces many of the guidelines outlined in the community Ruby Style Guide.

Testspace accepts GCC/Emacs style formatted output logs. Simply write your analysis 'emacs' formatted output to a file:

rubocop --format emacs --out analysis.log

In the Testspace client command line reference analysis.log{lint} as "static-analysis-results" file.


Page Tools