Allure #Step annotation does not work - allure

I just connected Allure report to my TestNG tests and Maven build. All works fine and reports are supercool. Just one thing - #Step annotation doesn't work. Steps are not appearing in report. I followed the examples.

In order to make #Step, #Parameter and #Attachment annotations work you need to correctly enable AspectJ load-time weaving. Basically this is as simple as passing path to aspectjweaver.jar as -javaagent JVM argument.
Here’s how it can be done in Maven Surefire Plugin: https://github.com/allure-examples/allure-junit-example/blob/master/pom.xml#L63
You must have a aspectjweaver dependency in your pom too (like in the given example), so that this library will be downloaded automatically by Maven. Otherwise the annotations still won't work. Or maybe the tests will not even start, I'm not sure...
To run from the IDE you can specify the same option to the JVM (not the testclass) in the IDE runner window. Replacing the ${settings.localRepository} property with the real path of course. Since that's a maven property and the IDE doesn't know anything about it.

SOLVED!
I ran the tests via InteliJIDEA testng runner, but should have run via maven only.
You need to run mvn clean test
and then mvn site

Related

How to use TestNG in Eclipse

I have successfully installed TestNG in eclipse through Help->Install New Softwares but while configuring build path, it is not visible in Add Libraries.
The TestNG option is not even visible to create TestNG class.
I think you are confusing two different things. The TestNG that you can install from Eclipse the way you described is installing the TestNG plugin for eclipse. If you want to actually use TestNG to run your tests, you need the TestNG library.
You can download it and manually add to your classpath or, if you are using Maven, add it as a dependency to your pom file.

Does Selenium- Jenkins Integration needs TestNG or JUnit Framework

Should we need TestNG or Junit framework to integrate Selenium with Jenkins. I have project which is build without TestNG or JUnit can i integrate it with Jenkins.
You can use both JUnit and TestNG frameworks as Jenkins supports both.
Steps in details for TestNG integration with Jenkins.
Step 1: Create Free Style project in Jenkins and fill the details and Save the project.
Step 2: click on Configure
Step 3: In the Build section of Configure:
java -cp J:\taf\testng\*;J:\taf\workspace\TestNGExamples\bin;J:\automation\* org.testng.TestNG J:\taf\workspace\TestNGExamples\testng1.xml
Note: you have to change the paths as per your system.
In -cp argument, we must provide testng.jar, project location and ``selenium jarslocations/paths.
org.testng.TestNG- TestNG Main Class.
andlocation to the XML of testng configuration`
Download and install the testng-plugin for jenkins from here and restart Jenkins in order to take effect.
Step 4: In the Post-build Actions section,
Select Publish TestNG Results from Add post-build action dropdown.
provide the path where to look for TestNG results (.xml file containing results).
Click Apply and Save buttons.
Screenshot for reference:
TestNG and JUnit on simple terms can be visualised as "java code execution" mechanisms with support to do validations.
So instead of you having only one main() method that would be the single point of entry for execution of your selenium code, TestNG/JUnit takes up that role and lets you run multiple java classes via themselves.
Jenkins is an orchestrator tool that lets you build, test, deploy as per your wish.
The test phase can be skipped by not using TestNG and JUnit, and you resorting to executing your selenium based tests via a main() method which takes care of doing all validations as well (assertions in the JUnit/TestNG world)

TestNG Executable JAR files

Is the TestNG Executable JAR files alone is enough to work with TestNG framework or the TestNG plugin is essential? I have the JAR files, can i add to my library and work with TestNG?
Plugin just simplifies running things. You do not need it so to say. But, if you say want to run a single test or a suite file - a plugin would give you a simple way to right click and trigger it off. But with no plugin you will have to run with the java run command or through maven command if that's what you are running.
So the answer is yes - you can run but the plugin will always help while you are developing your tests.

APIs for maven dependency

Are there any API that helps to find dependency of maven packages.
I used the examples present in the answer of Programmatically resolving Maven dependencies outside of a plugin - get RepositorySystemSession and RepositorySystem
However the dependency list that I get using aether is different from the list given by APIs
AFAIK. The API did not resolve ranges, I am not sure whether it handles exclusions.
Is there any readily available API that takes care of resolving version ranges, exclusions (simillar to what i get when using "mvn dependency-list/tree)
I am looking for API that exactly returns result provided by mvn dependency:list/tree
Note: My code is running outside mvn plugin
I recommend to use two tools:
mvn help:effective-pom
This tool provides effective pom - the very detailed pom.xml with all actual dependencies and versions
mvn dependency:tree
Provides the dependency tree

Jasmine2 is not a valid framework error

I recently followed a tutorial on running protractor tests inside vs. To my surprise it works however i had to remove jasmine2 as the framework in the conf file or I would get this error
config.framework jasmine2 is not a valid framework.
This is also my first time running the chromedriver through vs and it cannot sendKeys as i was before.
Ex: this.passwordTextField.clear().sendKeys(browser.params.password);
I'm not sure how to get protractor to recognize jasmine2. I have installed jasmine manually also with the --save-dev tag. Protractor is at version 2.5.1
and jasmine is at 2.1.4
Any idea what is going on? Or if there is a better way of running protractor in vs?
I'm using this tutorial which didn't exactly work so I borrowed her sample code and edited that, that worked. Here is the site:
https://misaxionsoftware.wordpress.com/2014/01/30/angularjs-protractor-visual-studio-super-dry/
This error can only happen if protractor <= 1.5.0 is used. Check if tests are executed by the correct protractor executable. FYI, this is where it fails.
For instance, you may have an old globally installed protractor which is used instead of the one installed locally inside project's node_modules.
Or, what I've also seen in practice, the protractor executable located at .bin/protractor was updated by one of the packages that has protractor as a dependency (like grunt-protractor-runner, for instance).

Resources