How to use ExcelDocConfiguration class of com.consol.citrus.mvn.plugin.config.docs package

Best Citrus code snippet using com.consol.citrus.mvn.plugin.config.docs.ExcelDocConfiguration

Source:CreateDocsMojo.java Github

copy

Full Screen

...15 */16package com.consol.citrus.mvn.plugin;17import com.consol.citrus.docs.ExcelTestDocsGenerator;18import com.consol.citrus.docs.HtmlTestDocsGenerator;19import com.consol.citrus.mvn.plugin.config.docs.ExcelDocConfiguration;20import com.consol.citrus.mvn.plugin.config.docs.HtmlDocConfiguration;21import org.apache.maven.plugin.MojoExecutionException;22import org.apache.maven.plugins.annotations.*;23import org.codehaus.plexus.components.interactivity.Prompter;24import org.codehaus.plexus.components.interactivity.PrompterException;25import java.util.Arrays;26import java.util.Optional;27/**28 * Creates test documentation in interactive mode. Either uses mode excel for MS Excel output or29 * html for HTML web page output.30 *31 * @author Christoph Deppisch32 * @since 2.7.433 */34@Mojo(name = "create-docs")35public class CreateDocsMojo extends AbstractCitrusMojo {36 @Parameter(property = "citrus.skip.create.docs", defaultValue = "false")37 protected boolean skipCreateDocs;38 @Component39 private Prompter prompter;40 private final ExcelTestDocsGenerator excelTestDocsGenerator;41 private final HtmlTestDocsGenerator htmlTestDocsGenerator;42 /**43 * Default constructor.44 */45 public CreateDocsMojo() {46 this(new ExcelTestDocsGenerator(), new HtmlTestDocsGenerator());47 }48 /**49 * Constructor using final fields.50 * @param excelTestDocsGenerator51 * @param htmlTestDocsGenerator52 */53 public CreateDocsMojo(ExcelTestDocsGenerator excelTestDocsGenerator, HtmlTestDocsGenerator htmlTestDocsGenerator) {54 this.excelTestDocsGenerator = excelTestDocsGenerator;55 this.htmlTestDocsGenerator = htmlTestDocsGenerator;56 }57 @Override58 public void doExecute() throws MojoExecutionException {59 if (skipCreateDocs) {60 return;61 }62 try {63 String mode = prompter.prompt("Choose documentation mode:", Arrays.asList("excel", "html"), "html");64 if (mode.equals("excel")) {65 createExcelDoc();66 } else if (mode.equals("html")) {67 createHtmlDoc();68 }69 } catch (PrompterException e) {70 getLog().info(e);71 }72 }73 /**74 * Create HTML documentation in interactive mode.75 * @throws PrompterException76 */77 private void createHtmlDoc() throws PrompterException {78 HtmlDocConfiguration configuration = new HtmlDocConfiguration();79 String heading = prompter.prompt("Enter overview title:", configuration.getHeading());80 String columns = prompter.prompt("Enter number of columns in overview:", configuration.getColumns());81 String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());82 String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());83 String logo = prompter.prompt("Enter file path to logo:", configuration.getLogo());84 String confirm = prompter.prompt("Confirm HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'\n",85 Arrays.asList("y", "n"), "y");86 if (confirm.equalsIgnoreCase("n")) {87 return;88 }89 HtmlTestDocsGenerator generator = getHtmlTestDocsGenerator();90 generator.withOutputFile(outputFile + (outputFile.endsWith(".html") ? "" : ".html"))91 .withPageTitle(pageTitle)92 .withOverviewTitle(heading)93 .withColumns(columns)94 .useSrcDirectory(getTestSrcDirectory())95 .withLogo(logo);96 generator.generateDoc();97 getLog().info("Successfully created HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'");98 }99 /**100 * Create Excel documentation in interactive mode.101 * @throws PrompterException102 */103 private void createExcelDoc() throws PrompterException {104 ExcelDocConfiguration configuration = new ExcelDocConfiguration();105 String company = prompter.prompt("Enter company:", configuration.getCompany());106 String author = prompter.prompt("Enter author:", configuration.getAuthor());107 String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());108 String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());109 String headers = prompter.prompt("Enter custom headers:", configuration.getHeaders());110 String confirm = prompter.prompt("Confirm Excel documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".xls") ? "" : ".xls") + "'\n",111 Arrays.asList("y", "n"), "y");112 if (confirm.equalsIgnoreCase("n")) {113 return;114 }115 ExcelTestDocsGenerator generator = getExcelTestDocsGenerator();116 generator.withOutputFile(outputFile + (outputFile.endsWith(".xls") ? "" : ".xls"))117 .withPageTitle(pageTitle)118 .withAuthor(author)...

Full Screen

Full Screen

Source:GenerateDocsMojoTest.java Github

copy

Full Screen

...16package com.consol.citrus.mvn.plugin;17import com.consol.citrus.docs.ExcelTestDocsGenerator;18import com.consol.citrus.docs.HtmlTestDocsGenerator;19import com.consol.citrus.mvn.plugin.config.docs.DocsConfiguration;20import com.consol.citrus.mvn.plugin.config.docs.ExcelDocConfiguration;21import com.consol.citrus.mvn.plugin.config.docs.HtmlDocConfiguration;22import org.apache.maven.plugin.MojoExecutionException;23import org.apache.maven.plugin.MojoFailureException;24import org.codehaus.plexus.components.interactivity.PrompterException;25import org.mockito.Mockito;26import org.testng.annotations.BeforeMethod;27import org.testng.annotations.Test;28import static org.mockito.Mockito.reset;29import static org.mockito.Mockito.verify;30import static org.mockito.Mockito.when;31/**32 * @author Christoph Deppisch33 */34public class GenerateDocsMojoTest {35 private ExcelTestDocsGenerator excelTestDocGenerator = Mockito.mock(ExcelTestDocsGenerator.class);36 private HtmlTestDocsGenerator htmlTestDocGenerator = Mockito.mock(HtmlTestDocsGenerator.class);37 private GenerateDocsMojo mojo;38 39 @BeforeMethod40 public void setup() {41 mojo = new GenerateDocsMojo(excelTestDocGenerator, htmlTestDocGenerator);42 }43 44 @Test45 public void testCreateXls() throws PrompterException, MojoExecutionException, MojoFailureException {46 reset(excelTestDocGenerator);47 DocsConfiguration docs = new DocsConfiguration();48 ExcelDocConfiguration configuration = new ExcelDocConfiguration();49 configuration.setCompany("citrusframework.org");50 configuration.setAuthor("Citrus");51 configuration.setPageTitle("SampleTests");52 configuration.setOutputFile("SampleTests.xls");53 configuration.setHeaders("Id,Name,Description");54 docs.setExcel(configuration);55 when(excelTestDocGenerator.withCompany("citrusframework.org")).thenReturn(excelTestDocGenerator);56 when(excelTestDocGenerator.withAuthor("Citrus")).thenReturn(excelTestDocGenerator);57 when(excelTestDocGenerator.withPageTitle("SampleTests")).thenReturn(excelTestDocGenerator);58 when(excelTestDocGenerator.withOutputFile("SampleTests.xls")).thenReturn(excelTestDocGenerator);59 when(excelTestDocGenerator.useSrcDirectory("src/test/")).thenReturn(excelTestDocGenerator);60 when(excelTestDocGenerator.withCustomHeaders("Id,Name,Description")).thenReturn(excelTestDocGenerator);61 mojo.setDocs(docs);62 mojo.execute();...

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1import com.consol.citrus.mvn.plugin.config.docs.ExcelDocConfiguration;2public class ExcelDocConfigurationTest {3 public static void main(String[] args) {4 ExcelDocConfiguration excelDocConfiguration = new ExcelDocConfiguration();5 excelDocConfiguration.setSheetName("Sheet1");6 excelDocConfiguration.setPath("C:\\Users\\user\\Desktop\\test.xlsx");7 excelDocConfiguration.setStartRow(1);8 excelDocConfiguration.setStartColumn(1);9 excelDocConfiguration.setEndRow(4);10 excelDocConfiguration.setEndColumn(4);11 excelDocConfiguration.setRowOffset(1);12 excelDocConfiguration.setColumnOffset(1);13 excelDocConfiguration.setRowName("Row");14 excelDocConfiguration.setColumnName("Column");15 excelDocConfiguration.setRowNameColumn(1);16 excelDocConfiguration.setColumnNameRow(1);17 excelDocConfiguration.setRowNamePattern("Row {row}");18 excelDocConfiguration.setColumnNamePattern("Column {column}");19 excelDocConfiguration.setRowNamePatternStart(1);20 excelDocConfiguration.setColumnNamePatternStart(1);21 excelDocConfiguration.setRowNamePatternEnd(4);22 excelDocConfiguration.setColumnNamePatternEnd(4);23 excelDocConfiguration.setRowNamePatternStep(1);24 excelDocConfiguration.setColumnNamePatternStep(1);25 excelDocConfiguration.setRowNamePatternColumn(1);26 excelDocConfiguration.setColumnNamePatternRow(1);27 excelDocConfiguration.setRowNamePatternOffset(1);28 excelDocConfiguration.setColumnNamePatternOffset(1);29 excelDocConfiguration.setRowNamePatternStartColumn(1);30 excelDocConfiguration.setColumnNamePatternStartRow(1);31 excelDocConfiguration.setRowNamePatternEndColumn(4);32 excelDocConfiguration.setColumnNamePatternEndRow(4);33 excelDocConfiguration.setRowNamePatternStepColumn(1);34 excelDocConfiguration.setColumnNamePatternStepRow(1);35 excelDocConfiguration.setRowNamePatternOffsetColumn(1);36 excelDocConfiguration.setColumnNamePatternOffsetRow(1);37 excelDocConfiguration.setRowNamePatternStartOffset(1);38 excelDocConfiguration.setColumnNamePatternStartOffset(1);39 excelDocConfiguration.setRowNamePatternEndOffset(4);40 excelDocConfiguration.setColumnNamePatternEndOffset(4);41 excelDocConfiguration.setRowNamePatternStepOffset(1);42 excelDocConfiguration.setColumnNamePatternStepOffset(1);

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1import com.consol.citrus.mvn.plugin.config.docs.ExcelDocConfiguration;2import com.consol.citrus.mvn.plugin.config.docs.ExcelDocGenerator;3import com.consol.citrus.mvn.plugin.config.docs.ExcelDocGeneratorImpl;4import com.consol.citrus.mvn.plugin.config.docs.ExcelDocGeneratorOptions;5import com.consol.citrus.mvn.plugin.config.docs.ExcelDocGeneratorOptions.ExcelDocGeneratorOptionsBuilder;6import org.apache.maven.plugin.logging.Log;7import org.apache.maven.plugin.logging.SystemStreamLog;8import java.io.File;9import java.io.IOException;10import java.util.ArrayList;11import java.util.List;12import java.util.Map;13import java.util.Set;14public class ExcelDocGeneratorTest {15 public static void main(String[] args) throws IOException {16 ExcelDocGeneratorOptionsBuilder optionsBuilder = new ExcelDocGeneratorOptionsBuilder();17 optionsBuilder.setOutputFile(new File("/home/rahul/Desktop/output.xlsx"));18 optionsBuilder.setInputDirectory(new File("/home/rahul/Desktop/"));19 optionsBuilder.setInputFilePattern("*.xml");20 optionsBuilder.setInputFileEncoding("UTF-8");21 optionsBuilder.setInputFileType("xml");22 optionsBuilder.setInputFileName("input.xml");

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.mvn.plugin.config.docs;2import java.io.File;3import java.io.IOException;4import java.util.ArrayList;5import java.util.List;6import org.apache.commons.io.FileUtils;7import org.apache.poi.xssf.usermodel.XSSFWorkbook;8import com.consol.citrus.docs.ExcelDocConfiguration;9import com.consol.citrus.docs.TestDocGenerator;10public class ExcelDocGenerator {11 public static void main(String[] args) throws IOException {12 ExcelDocConfiguration excelDocConfiguration = new ExcelDocConfiguration();13 excelDocConfiguration.setExcelFilePath("C:/Users/Ankita/Desktop/ExcelDocGenerator.xlsx");14 excelDocConfiguration.setSheetName("TestSheet");15 excelDocConfiguration.setTestCaseName("Test Case 1");16 excelDocConfiguration.setTestCaseName("Test Case 2");17 excelDocConfiguration.setTestCaseName("Test Case 3");18 excelDocConfiguration.setTestCaseName("Test Case 4");19 excelDocConfiguration.setTestCaseName("Test Case 5");20 excelDocConfiguration.setTestCaseName("Test Case 6");21 excelDocConfiguration.setTestCaseName("Test Case 7");22 excelDocConfiguration.setTestCaseName("Test Case 8");23 excelDocConfiguration.setTestCaseName("Test Case 9");24 excelDocConfiguration.setTestCaseName("Test Case 10");25 excelDocConfiguration.setTestCaseName("Test Case 11");26 excelDocConfiguration.setTestCaseName("Test Case 12");27 excelDocConfiguration.setTestCaseName("Test Case 13");28 excelDocConfiguration.setTestCaseName("Test Case 14");

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.mvn.plugin.config.docs;2import com.consol.citrus.mvn.plugin.config.docs.ExcelDocConfiguration;3import org.apache.poi.ss.usermodel.Workbook;4import org.apache.poi.ss.usermodel.WorkbookFactory;5import org.apache.poi.xssf.usermodel.XSSFWorkbook;6import org.testng.Assert;7import org.testng.annotations.Test;8import java.io.File;9import java.io.FileInputStream;10import java.io.IOException;11import java.io.InputStream;12public class ExcelDocConfigurationTest {13 public void testExcelDocConfiguration() throws IOException {14 InputStream inputStream = new FileInputStream(new File("src/test/resources/sample.xlsx"));15 Workbook workbook = WorkbookFactory.create(inputStream);16 ExcelDocConfiguration excelDocConfiguration = new ExcelDocConfiguration(workbook);17 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(0).getStringCellValue(), "Test1");18 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(1).getStringCellValue(), "Test2");19 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(2).getStringCellValue(), "Test3");20 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(3).getStringCellValue(), "Test4");21 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(4).getStringCellValue(), "Test5");22 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(5).getStringCellValue(), "Test6");23 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(6).getStringCellValue(), "Test7");24 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(7).getStringCellValue(), "Test8");25 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(8).getStringCellValue(), "Test9");26 Assert.assertEquals(excelDocConfiguration.getWorkbook().getSheetAt(0).getRow(1).getCell(9).getStringCellValue(), "Test10");27 }28}

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.mvn.plugin.config.docs;2import java.io.File;3import java.io.IOException;4import java.util.ArrayList;5import java.util.List;6import org.apache.poi.ss.usermodel.Workbook;7import org.apache.poi.ss.usermodel.WorkbookFactory;8public class ExcelDocConfiguration {9 private Workbook workbook;10 private String path;11 private String sheetName;12 private List<String> rowValues = new ArrayList<String>();13 public ExcelDocConfiguration(String path, String sheetName) {14 this.path = path;15 this.sheetName = sheetName;16 }17 public void createExcelDoc() throws IOException {18 workbook = WorkbookFactory.create(new File(path));19 }20 public void addRowValues(List<String> rowValues) {21 this.rowValues = rowValues;22 }23 public Workbook getWorkbook() {24 return workbook;25 }26 public String getSheetName() {27 return sheetName;28 }29 public List<String> getRowValues() {30 return rowValues;31 }32}33package com.consol.citrus.mvn.plugin.config.docs;34import java.io.File;35import java.io.FileNotFoundException;36import java.io.FileOutputStream;37import java.io.IOException;38import java.util.ArrayList;39import java.util.List;40import org.apache.poi.ss.usermodel.Cell;41import org.apache.poi.ss.usermodel.Row;42import org.apache.poi.ss.usermodel.Sheet;43import org.apache.poi.ss.usermodel.Workbook;44import org.apache.poi.ss.usermodel.WorkbookFactory;45public class ExcelDocCreator {46 public static void main(String[] args) throws IOException {47 ExcelDocConfiguration excelDocConfiguration = new ExcelDocConfiguration("C:/Users/abhishek/Desktop/test.xlsx", "Sheet1");48 excelDocConfiguration.createExcelDoc();49 List<String> rowValues = new ArrayList<String>();50 rowValues.add("1");51 rowValues.add("Abhishek");52 rowValues.add("

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.mvn.plugin.config.docs;2import java.io.File;3import org.apache.maven.plugin.MojoExecutionException;4import org.apache.maven.plugin.MojoFailureException;5import org.apache.maven.plugins.annotations.Mojo;6import org.apache.maven.plugins.annotations.Parameter;7import com.consol.citrus.docs.ExcelDocGenerator;8import com.consol.citrus.docs.config.ExcelDocConfiguration;9@Mojo(name = "excel-docs")10public class ExcelDocMojo extends AbstractDocMojo {11 @Parameter(defaultValue = "${project.build.directory}/citrus-docs/excel")12 private File outputDirectory;13 @Parameter(defaultValue = "citrus-test-cases.xls")14 private String excelFileName;15 @Parameter(defaultValue = "Test Cases")16 private String excelSheetName;17 public void execute() throws MojoExecutionException, MojoFailureException {18 if (skip) {19 getLog().info("Skipping citrus-maven-plugin:excel-docs");20 return;21 }22 getLog().info("Generating excel test documentation ...");23 ExcelDocConfiguration configuration = new ExcelDocConfiguration();24 configuration.setExcelFileName(excelFileName);25 configuration.setExcelSheetName(excelSheetName);26 configuration.setOutputDirectory(outputDirectory);27 configuration.setTestSourceDirectory(testSourceDirectory);28 configuration.setTestResultsDirectory(testResultsDirectory);29 configuration.setTestResultsFilePattern(testResultsFilePattern);30 configuration.setTestResultsFileDateFormat(testResultsFileDateFormat);31 configuration.setTestResultsFileTimeZone(testResultsFileTimeZone);32 new ExcelDocGenerator(configuration).generate();33 }34}35package com.consol.citrus.mvn.plugin.config.docs;36import java.io.File;37import java.util.List;38import org.apache.maven.plugin.MojoExecutionException;39import org.apache.maven.plugin.MojoFailureException;40import org

Full Screen

Full Screen

ExcelDocConfiguration

Using AI Code Generation

copy

Full Screen

1public class ExcelDocConfigurationTest {2 public static void main(String[] args) {3 ExcelDocConfiguration excelDocConfiguration = new ExcelDocConfiguration();4 String path = "C:\\Users\\user\\Documents\\excelDoc.xls";5 excelDocConfiguration.setPath(path);6 excelDocConfiguration.setSheetName("ExcelDoc");7 excelDocConfiguration.setProjectName("ExcelDoc");8 excelDocConfiguration.setProjectVersion("1.0.0");9 excelDocConfiguration.setProjectDescription("ExcelDoc");10 excelDocConfiguration.setProjectUrl("www.excelDoc.com");11 excelDocConfiguration.setProjectLicense("Apache 2.0");12 excelDocConfiguration.setProjectOrganization("ExcelDoc");13 excelDocConfiguration.setProjectOrganizationUrl("www.excelDoc.com");14 excelDocConfiguration.setProjectOrganizationLogo("www.excelDoc.com/logo.png");15 excelDocConfiguration.setProjectIssueManagementSystem("ExcelDoc");16 excelDocConfiguration.setProjectIssueManagementUrl("www.excelDoc.com/issue");17 excelDocConfiguration.setProjectMailingLists("ExcelDoc");18 excelDocConfiguration.setProjectMailingListsUrl("www.excelDoc.com/mailing");19 excelDocConfiguration.setProjectScmConnection("ExcelDoc");20 excelDocConfiguration.setProjectScmDeveloperConnection("ExcelDoc");21 excelDocConfiguration.setProjectScmUrl("www.excelDoc.com/scm");22 excelDocConfiguration.setProjectCiManagementSystem("ExcelDoc");23 excelDocConfiguration.setProjectCiManagementUrl("www.excelDoc.com/ci");24 excelDocConfiguration.setProjectCiManagementNotifiers("ExcelDoc");25 excelDocConfiguration.setProjectCiManagementNotifiersType("www.excelDoc.com/notifiers");26 excelDocConfiguration.setProjectCiManagementNotifiersAddress("www.excelDoc.com/notifiers/address");27 excelDocConfiguration.setProjectCiManagementNotifiersConfiguration("www.excelDoc.com/notifiers/configuration");28 excelDocConfiguration.setProjectCiManagementNotifiersSendOnError("www.excelDoc.com/notifiers/sendOnError");29 excelDocConfiguration.setProjectCiManagementNotifiersSendOnFailure("www.excelDoc.com/notifiers/sendOnFailure");30 excelDocConfiguration.setProjectCiManagementNotifiersSendOnSuccess("www.excelDoc.com

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Citrus automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful