<commit_before># Sahagin

Make your Selenium Script more readable and maintainable!

Sahagin provides highly readable HTML test script viewer and test result report.

Sahagin is now beta version, and only supports JUnit4 and Selenium WebDriver Java binding in the current latest version.
If you want support for other languages or test frameworks, please request us by creating new [issue](https://github.com/SahaginOrg/sahagin-java/issues).

[![Build Status](https://travis-ci.org/SahaginOrg/sahagin-java.svg?branch=master)](https://travis-ci.org/SahaginOrg/sahagin-java)

# Getting started

## 1. Set up Java library

### If you use Maven
Add dependency to your pom.xml file.

```xml
  <dependencies>
    <dependency>
      <groupId>org.sahagin</groupId>  
       <artifactId>sahagin</artifactId>  
       <version>0.2.3</version> 
    </dependency>
  </dependencies>
```

and add test execution JVM argument.

```xml
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.18(or any other version)</version>
      <configuration>
        <argLine>
          -javaagent:${settings.localRepository}/org/sahagin/sahagin/0.2.3/sahagin-0.2.3.jar
        </argLine>
      </configuration>
    </plugin>
  </plugins>
```

### If you use Gradle
Add dependency to your build.gradle file.

```groovy
dependencies {
    compile 'org.sahagin:sahagin:0.2.3'
}
```

and add test execution JVM argument.

```groovy
test {
    doFirst {
        // search sahagin jar file in the local cache
        def sahaginJar = project.configurations.testCompile.find {
            it.name.startsWith('sahagin-0.2.3') 
        }
        jvmArgs '-javaagent:' + sahaginJar
    }
}

```

### If you use jar file directory
Download sahagin-0.2.3.zip from [here](https://github.com/SahaginOrg/sahagin-java/releases/tag/0.2.3) and add all jar files in the zip file to the Java class path.

## 2. Add annotations
Add @Page annotations to your page object class declarations, and add @TestDoc annotations to your page object methods or any other methods.

You don't need to add annotations to all your classes and methods.

```java
import org.sahagin.runlib.external.Page;
import org.sahagin.runlib.external.TestDoc;

@Page("Data input page")
public class DataInputPage {
    
    @TestDoc("Set user name {user}")<commit_msg>Fix README for version 0.2.4<commit_after># Sahagin

Make your Selenium Script more readable and maintainable!

Sahagin provides highly readable HTML test script viewer and test result report.

Sahagin is now beta version, and only supports JUnit4 and Selenium WebDriver Java binding in the current latest version.
If you want support for other languages or test frameworks, please request us by creating new [issue](https://github.com/SahaginOrg/sahagin-java/issues).

[![Build Status](https://travis-ci.org/SahaginOrg/sahagin-java.svg?branch=master)](https://travis-ci.org/SahaginOrg/sahagin-java)

# Getting started

## 1. Set up Java library

### If you use Maven
Add dependency to your pom.xml file.

```xml
  <dependencies>
    <dependency>
      <groupId>org.sahagin</groupId>  
       <artifactId>sahagin</artifactId>  
       <version>0.2.4</version> 
    </dependency>
  </dependencies>
```

and add test execution JVM argument.

```xml
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.18(or any other version)</version>
      <configuration>
        <argLine>
          -javaagent:${settings.localRepository}/org/sahagin/sahagin/0.2.4/sahagin-0.2.4.jar
        </argLine>
      </configuration>
    </plugin>
  </plugins>
```

### If you use Gradle
Add dependency to your build.gradle file.

```groovy
dependencies {
    compile 'org.sahagin:sahagin:0.2.4'
}
```

and add test execution JVM argument.

```groovy
test {
    doFirst {
        // search sahagin jar file in the local cache
        def sahaginJar = project.configurations.testCompile.find {
            it.name.startsWith('sahagin-0.2.4') 
        }
        jvmArgs '-javaagent:' + sahaginJar
    }
}

```

### If you use jar file directory
Download sahagin-0.2.4.zip from [here](https://github.com/SahaginOrg/sahagin-java/releases/tag/0.2.4) and add all jar files in the zip file to the Java class path.

## 2. Add annotations
Add @Page annotations to your page object class declarations, and add @TestDoc annotations to your page object methods or any other methods.

You don't need to add annotations to all your classes and methods.

```java
import org.sahagin.runlib.external.Page;
import org.sahagin.runlib.external.TestDoc;

@Page("Data input page")
public class DataInputPage {
    
    @TestDoc("Set user name {user}")
{'fraction_non_alphanumeric': 0.11424984306340238, 'fraction_numerical': 0.011927181418706842, 'mean_word_length': 3.3974241030358785, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1477082', 'n_tokens_mistral': 1647, 'n_tokens_neox': 1477, 'n_words': 445}