We use the 'Java / JUnit 4 / WebDriver' as the base template in this post as well.
The changes needed to be done
- Change the imports to TestNG
- Modify assertion methods according to TestNG specification
JUNIT ---> assertEquals(expected, actual);
TESTNG ---> assertEquals(actual, expected);Create a new template as described in the previous post using Java / JUnit 4 / WebDriver' template and give a new name. Then do the following changes to the source file in a text editor.
Replace following imports with the imports given next.
import org.junit.*;
import static org.junit.Assert.*;
New Importsimport org.testng.annotations.*;
import static org.testng.Assert.*;
Next we need to change the order of the arguments. Replace the Equals.prototype.assert section with the following.
Equals.prototype.assert = function() {
return "assertEquals(" + this.e2.toString() + ", " + this.e1.toString() + ");";
};
- Click Add button in the formats section mentioned in previous post.
- Copy and paste the customized source on it.
- Save and Close.
- Restart the Selenium-IDE.
No comments:
Post a Comment