Unable to run specs from command line

274 views
Skip to first unread message

Leelavathi K

unread,
Mar 10, 2020, 12:39:26 PM3/10/20
to getgauge
Hi Team,

I have created a gauge project combination of Maven-Java-Selenium.
I have added Chromedriver in libs folder.Other dependencies are downloaded by Maven into 'External Libraries' folder.
Scenarios runs successfully while running manually by clicking on each scenario.But fails while running from command prompt with all below commands.

mvn clean - Passed
mvn compile -Passed
mvn test - Failed
mvn gauge:execute -DspecsDir=specs - Failed
mvn gauge:execute -DspecsDir=specs/example.spec-Failed
mvn gauge:execute -DspecsDir=specs/demo.spec-Failed -My own code.

I am getting following error message1 while running using above Maven commands and error message 2 while using gauge run specs command.
Could you please help me to fix this issue.

Error message 1:

"C:\Program Files\Java\jdk1.8.0_211\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\lktr\Infoblitz_Demo "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\lib\idea_rt.jar=54630:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version2019.1.1 test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Infoblitz_Demo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Infoblitz_Demo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\lktr\Infoblitz_Demo\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Infoblitz_Demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Infoblitz_Demo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\lktr\Infoblitz_Demo\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Infoblitz_Demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Infoblitz_Demo ---
[INFO] 
[INFO] --- gauge-maven-plugin:1.1.0:execute (default) @ Infoblitz_Demo ---
unknown command "C:\\Users\\lktr\\Infoblitz_Demo\\specs" for "gauge"
Error: unknown command "C:\\Users\\lktr\\Infoblitz_Demo\\specs" for "gauge"
Run 'gauge --help' for usage.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.147 s
[INFO] Finished at: 2020-03-10T16:29:00+00:00
[INFO] Final Memory: 11M/243M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.1.0:execute (default) on project Infoblitz_Demo: Gauge Specs execution failed -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Process finished with exit code 1

Error message 2:

C:\Users\lktr\Infoblitz_Demo>gauge run specs
src\test\java\StepImplementation.java:7: error: package org.junit does not exist
import static org.junit.Assert.assertEquals;
                       ^
src\test\java\StepImplementation.java:7: error: static import only from classes and interfaces
import static org.junit.Assert.assertEquals;
^
src\test\java\web\pages\cakes.java:3: error: package org.junit does not exist
import org.junit.Assert;
                ^
src\test\java\web\pages\cakes.java:4: error: package org.openqa.selenium does not exist
                          ^
src\test\java\web\pages\cakes.java:5: error: package org.openqa.selenium does not exist
import org.openqa.selenium.Keys;
                          ^
src\test\java\web\pages\cakes.java:6: error: package org.openqa.selenium does not exist
import org.openqa.selenium.WebElement;
                          ^
src\test\java\web\pages\cakes.java:7: error: package org.openqa.selenium.support.ui does not exist
import org.openqa.selenium.support.ui.Select;
                                     ^
src\test\java\web\utils\Driver.java:6: error: package org.openqa.selenium does not exist
import org.openqa.selenium.WebDriver;
                          ^
src\test\java\web\pages\login.java:4: error: package org.openqa.selenium does not exist
                          ^
src\test\java\web\pages\login.java:5: error: package org.openqa.selenium does not exist
import org.openqa.selenium.JavascriptExecutor;
                          ^
src\test\java\web\pages\login.java:6: error: package org.openqa.selenium does not exist
import org.openqa.selenium.WebElement;
                          ^
src\test\java\web\pages\login.java:7: error: package org.openqa.selenium.support does not exist
import org.openqa.selenium.support.FindBy;
                                  ^
src\test\java\web\utils\Driver.java:11: error: cannot find symbol
    public static WebDriver driver;
                  ^
  symbol:   class WebDriver
  location: class Driver
src\test\java\web\utils\Driver.java:23: error: cannot find symbol
    public static WebDriver getDriver() {
                  ^
  symbol:   class WebDriver
  location: class Driver
src\test\java\web\pages\login.java:13: error: cannot find symbol
    WebElement login1;
    ^
  symbol:   class WebElement
  location: class login
src\test\java\web\utils\DriverFactory.java:3: error: package org.openqa.selenium does not exist
import org.openqa.selenium.WebDriver;
                          ^
src\test\java\web\utils\DriverFactory.java:4: error: package org.openqa.selenium.chrome does not exist
import org.openqa.selenium.chrome.ChromeDriver;
                                 ^
src\test\java\web\utils\DriverFactory.java:5: error: package org.openqa.selenium.ie does not exist
import org.openqa.selenium.ie.InternetExplorerDriver;
                             ^
src\test\java\web\utils\DriverFactory.java:8: error: cannot find symbol
    public static WebDriver getDriver() {
                  ^
  symbol:   class WebDriver
  location: class DriverFactory
src\test\java\web\utils\DriverFactory.java:23: error: cannot find symbol
    public static void closeDriver(WebDriver driver)
                                   ^
  symbol:   class WebDriver
  location: class DriverFactory
src\test\java\web\utils\DriverFactory.java:36: error: cannot find symbol
    public static void quitDriver(WebDriver driver)
                                  ^
  symbol:   class WebDriver
  location: class DriverFactory
src\test\java\web\utils\commonUtils.java:7: error: package org.openqa.selenium does not exist
import org.openqa.selenium.*;
^
src\test\java\web\utils\commonUtils.java:8: error: package org.openqa.selenium.support.ui does not exist
import org.openqa.selenium.support.ui.ExpectedConditions;
                                     ^
src\test\java\web\utils\commonUtils.java:9: error: package org.openqa.selenium.support.ui does not exist
import org.openqa.selenium.support.ui.WebDriverWait;
                                     ^
src\test\java\web\utils\commonUtils.java:20: error: cannot find symbol
    public static void clickButton(WebElement element)
                                   ^
  symbol:   class WebElement
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:34: error: cannot find symbol
    public static void clickElement(By by)
                                    ^
  symbol:   class By
  location: class commonUtils
src\test\java\web\pages\login.java:12: error: cannot find symbol
    @FindBy(xpath = "//a[text()='Login']")
     ^
  symbol:   class FindBy
  location: class login
src\test\java\StepImplementation.java:24: error: cannot find symbol
        assertEquals(expectedCount, actualCount);
        ^
  symbol:   method assertEquals(int,int)
  location: class StepImplementation
src\test\java\StepImplementation.java:34: error: cannot find symbol
            assertEquals(expectedCount, actualCount);
            ^
  symbol:   method assertEquals(int,int)
  location: class StepImplementation
src\test\java\web\pages\cakes.java:26: error: cannot find symbol
   Driver.getDriver().findElement(By.xpath(search)).sendKeys("princess yellow doll");
                                  ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:27: error: cannot find symbol
    Driver.getDriver().findElement(By.xpath(search)).sendKeys(Keys.ENTER);
                                                              ^
  symbol:   variable Keys
  location: class cakes
src\test\java\web\pages\cakes.java:27: error: cannot find symbol
    Driver.getDriver().findElement(By.xpath(search)).sendKeys(Keys.ENTER);
                                   ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:28: error: cannot find symbol
    commonUtils.clickElement(By.xpath(cakemodel));
                             ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:35: error: cannot find symbol
    Select sponge=new Select(Driver.getDriver().findElement(By.name("super_attribute[135]")));
    ^
  symbol:   class Select
  location: class cakes
src\test\java\web\pages\cakes.java:35: error: cannot find symbol
    Select sponge=new Select(Driver.getDriver().findElement(By.name("super_attribute[135]")));
                      ^
  symbol:   class Select
  location: class cakes
src\test\java\web\pages\cakes.java:35: error: cannot find symbol
    Select sponge=new Select(Driver.getDriver().findElement(By.name("super_attribute[135]")));
                                                            ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:38: error: cannot find symbol
    Select size=new Select(Driver.getDriver().findElement(By.name("super_attribute[186]")));
    ^
  symbol:   class Select
  location: class cakes
src\test\java\web\pages\cakes.java:38: error: cannot find symbol
    Select size=new Select(Driver.getDriver().findElement(By.name("super_attribute[186]")));
                    ^
  symbol:   class Select
  location: class cakes
src\test\java\web\pages\cakes.java:38: error: cannot find symbol
    Select size=new Select(Driver.getDriver().findElement(By.name("super_attribute[186]")));
                                                          ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:41: error: cannot find symbol
     Driver.getDriver().findElement(By.id("options_32402_text")).sendKeys(tabletoMap.get("Message on Cake"));
                                    ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:42: error: cannot find symbol
    WebElement Quantity=Driver.getDriver().findElement(By.id("qty"));
    ^
  symbol:   class WebElement
  location: class cakes
src\test\java\web\pages\cakes.java:42: error: cannot find symbol
    WebElement Quantity=Driver.getDriver().findElement(By.id("qty"));
                                                       ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:43: error: cannot find symbol
     Quantity.sendKeys(Keys.CONTROL+"a");
                       ^
  symbol:   variable Keys
  location: class cakes
src\test\java\web\pages\cakes.java:44: error: cannot find symbol
     Quantity.sendKeys(Keys.DELETE);
                       ^
  symbol:   variable Keys
  location: class cakes
src\test\java\web\pages\cakes.java:48: error: cannot find symbol
     commonUtils.clickButton(Driver.getDriver().findElement(By.id("product-addtocart-button")));
                                                            ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:59: error: cannot find symbol
Driver.getDriver().findElement(By.xpath("//span[text()='View cart']")).click();
                               ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:60: error: cannot find symbol
Driver.getDriver().findElement(By.xpath("//a[@title='Remove item']")).click();
                               ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:66: error: cannot find symbol
    String carttext=Driver.getDriver().findElement(By.xpath("//p[text()='You have no items in your shopping cart.']")).getText();
                                                   ^
  symbol:   variable By
  location: class cakes
src\test\java\web\pages\cakes.java:67: error: cannot find symbol
    Assert.assertEquals(emptycart,carttext);
    ^
  symbol:   variable Assert
  location: class cakes
src\test\java\web\pages\login.java:25: error: cannot find symbol
        commonUtils.clickElement(By.xpath(login));
                                 ^
  symbol:   variable By
  location: class login
src\test\java\web\pages\login.java:31: error: cannot find symbol
        ((JavascriptExecutor)Driver.getDriver()).executeScript("scroll(0,300);");
          ^
  symbol:   class JavascriptExecutor
  location: class login
src\test\java\web\pages\login.java:35: error: cannot find symbol
        Driver.getDriver().findElement(By.xpath("//input[@title='Email']")).sendKeys(System.getenv(email));
                                       ^
  symbol:   variable By
  location: class login
src\test\java\web\pages\login.java:36: error: cannot find symbol
        Driver.getDriver().findElement(By.xpath("//input[@title='Password']")).sendKeys(System.getenv(password));
                                       ^
  symbol:   variable By
  location: class login
src\test\java\web\pages\login.java:41: error: cannot find symbol
        commonUtils.clickElement(By.xpath(Loginsubmit));
                                 ^
  symbol:   variable By
  location: class login
src\test\java\web\utils\DriverFactory.java:15: error: cannot find symbol
                return new InternetExplorerDriver();
                           ^
  symbol:   class InternetExplorerDriver
  location: class DriverFactory
src\test\java\web\utils\DriverFactory.java:18: error: cannot find symbol
                return new ChromeDriver();
                           ^
  symbol:   class ChromeDriver
  location: class DriverFactory
src\test\java\web\utils\commonUtils.java:24: error: cannot find symbol
           new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOf(element));
                                                   ^
  symbol:   variable ExpectedConditions
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:24: error: cannot find symbol
           new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOf(element));
               ^
  symbol:   class WebDriverWait
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:27: error: cannot find symbol
        catch (WebDriverException e)
               ^
  symbol:   class WebDriverException
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:29: error: cannot find symbol
            new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOf(element));
                                                    ^
  symbol:   variable ExpectedConditions
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:29: error: cannot find symbol
            new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOf(element));
                ^
  symbol:   class WebDriverWait
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:38: error: cannot find symbol
         new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOfElementLocated(by));
                                                 ^
  symbol:   variable ExpectedConditions
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:38: error: cannot find symbol
         new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOfElementLocated(by));
             ^
  symbol:   class WebDriverWait
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:41: error: cannot find symbol
     catch (WebDriverException e)
            ^
  symbol:   class WebDriverException
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:43: error: cannot find symbol
         new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOfElementLocated(by));
                                                 ^
  symbol:   variable ExpectedConditions
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:43: error: cannot find symbol
         new WebDriverWait(getDriver(),30).until(ExpectedConditions.visibilityOfElementLocated(by));
             ^
  symbol:   class WebDriverWait
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:78: error: cannot find symbol
            File srcFile = ((TakesScreenshot) Driver.getDriver()).getScreenshotAs(OutputType.FILE);
                                                                                  ^
  symbol:   variable OutputType
  location: class commonUtils
src\test\java\web\utils\commonUtils.java:78: error: cannot find symbol
            File srcFile = ((TakesScreenshot) Driver.getDriver()).getScreenshotAs(OutputType.FILE);
                             ^
  symbol:   class TakesScreenshot
  location: class commonUtils
Note: src\test\java\web\pages\commonSteps.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
68 errors
Error ----------------------------------

Failed to start gauge API: Runner with pid 39888 quit unexpectedly(exit status 1).

Get Support ----------------------------
        Docs:          https://docs.gauge.org
        Bugs:          https://github.com/getgauge/gauge/issues
        Chat:          https://gitter.im/getgauge/chat

Your Environment Information -----------
        windows, 1.0.5, 562f036
        html-report (4.0.8), java (0.7.2), screenshot (0.0.1)




Srikanth V

unread,
Mar 11, 2020, 6:58:40 AM3/11/20
to getgauge
Hi,

Since it is a maven project, you cannot use `gauge run specs`. You will have to run it using `mvn`.

In your case, I see that the gauge-maven-plugin is outdated (v 1.1.0). Please update it and try running `mvn test-compile gauge:execute`.

HTH
Srikanth

Leelavathi K

unread,
Mar 11, 2020, 7:28:59 AM3/11/20
to getgauge
Thank you Srikanth. Issue resolved after updating version.
Reply all
Reply to author
Forward
0 new messages