Rspec: Allure command line tool - ruby

After installing allure-rspec gem and adding require 'allure-rspec' in spec_helper.rb file. I am able to generate results in .xml format.
Now I want to convert this .xml to actual html report for this tutorial navigates us to here https://github.com/allure-framework/allure-cli
I don't understand how this would help in generating html reports.
I am using this line to generate .xml in results directory
bundle exec rspec spec/create_post/post_creation_spec.rb

From that github link clone(download zip) the allure-ci repo in your local machine.
Then go to project and create a directory a root level directory-with-results
copy the .xml you have in this directory.
Open terminal at root directory of this maven project
And run these commands one by one
allure generate directory-with-results
allure report open
if JAVA_HOME maven_home is configured properly,you will see the report generated in your default browser.

Related

How to parse a csv and use the content in the maven build in Jenkins

I'm new to Jenkins jobs. What I wanted to achieve is to parse the contents of a dynamically created CSV file for the list of names of test cases I want to execute in my maven build statement. The CSV file is available in my workspace under the /src/test/result directory and here is the build configuration:
Maven version: Maven-3.3.3
Root POM: pom.xml
Goals and options: clean install -Dinclude.tag=test1
I tried File Parameter and specified my csv's location but I don't know how to get the contents of the file so I can replace test1 in the Goals and option section by the list of names of my test cases to execute. I'm using the Execute windows batch command in my pre build steps. Any help is highly appreciated.

jasmine-allure-reporter, display test cases separately based on spec files

I'm using Protractor and jasmine-allure-reporter
And trying to run multiple specs that are defined in the config.js file.
specs: ['spec1.js','spec2.js']
spec1.js contains 3 tests and spec2.js contains single test.But the jasmine-allure-reporter displays all the four test cases(3+1) together and there is no specification about the spec files (spec file name). How can I display the test cases separately under each spec file-name in one HTML.
Please help me on this.
I am generating report using command "allure generate allure-results --clean -o allure-report || true"
allure-results >> Location where xml files are generated and
allure-report >> where html report is generated
Looking at the allure reporter repository, it doesn't look like it's supported. They set the outDir but do not expose a way to consolidateAll like how jasmine-reporter does. See jasmine-reporter GitHub. If you decide to switch to jasmine-reporter, consolidating XML files is pretty simple. See the Protractor cookbook for an example.

MsTest unable to copy test data files to build server

I am trying to implement automated unit testing with each build using TFS.
Problem statement :
I have created few xml files which stores test data and set to copy always. When run locally files are picked up from bin folder. When I schedule a build, build process looks for files in out folder under TestResults on Build Server. Out folder contains ddls but not the xml files. Hence unable to find files and results into build failure partially.
You can specify additional files to deploy in your test settings file:
More details here - https://msdn.microsoft.com/en-us/library/ms182475.aspx
You could also use the DeploymentItem Attribute.
https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute.aspx

Automatically generate Code Coverage during nightly build

I have some problems getting the code coverage .coverage file generated in nightly build.
What I have: I've configured my build to use a .runsettings file and Type of run settings : CodeCoverageEnabled
The build is correctly running all the required unit tests and measuring the code coverage, using only a selected number of assemblies (specified in the .runsettings file).
In the build report, within VS2013, I can manually export the code coverage file (a .coverage file).
What I need:
I would need to configure the build to automatically generate that .coverage file in a target folder.
How do I do that?
The .coverage file is present as a part of the test results. You can use the .runsettings to set a outputpath for the test results
<ResultsDirectory>c:\\TestResults</ResultsDirectory>
The .coverage file will be present in a subfolder within the results directory.
If you want to push it to another location you can do that via a post-build script in your nightly's build process template.

How to Build a maven project using script file?

I have created a maven project in STS.I completed the development and testing code for my project.If now I want to run or build this project, then I have to do the following
Right click on the project-->Run as-->Run on Server (or)
Right click on the project-->Run as-->Maven Build
If I want to run the test code then
Right click on the class file-->Run as-->Run JUnit
But I want to create a text file I mean script file to run all these commands when I run this script file from the cmd prompt. I have found out on a web site that I should create a PowerShell file, So I don't cognize how to compose a script file like this, is there any example file for it ?
Please, anybody can help me
You can just run mvn clean install on your project root folder (i.e. where your pom.xml file is) in cmd prompt. This command will trigger your project default build lifecycle covering a number of build phases including:
validate
compile
test
package
integration-test
integration
verify
install
During these build phases, Maven will validate and compile your project, run tests (if any) against your codes, package the resultant binaries into say, a JAR file, run integration tests (if any) against your JAR, verify it, and then install the verified package to your local .m2 repository.
If you really want a script, then just add mvn clean install to your batch file.

Resources