Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper WebDriverFactory injection, ability to set custom "Injector" #72

Merged
merged 10 commits into from Mar 28, 2013

Conversation

@alex-okrushko
Copy link
Contributor

commented Mar 20, 2013

NOTE: this pull request is superior to @dmakhno4gd pull request It includes it (except for the test) and extends it.
So @dmakhno4gd should be accepted first, then this request should be accepted. (if any :) )

  1. Added ability to provide custom injector
  2. Modified the use of WebDriverFactory (so it's properly injected)

Now to provide custom Locator and Decorator for Thucydides is as easy as:

  1. Create custom MyWebDriverFactory from current WebDriverFactory
\\MyWebDriverFactory.java
public class MyWebDriverFactory extends WebDriverFactory {

    @Override
    public void initElementsWithAjaxSupport(final PageObject pageObject, final WebDriver driver) {
        ElementLocatorFactory finder = new MyDefaultElementLocatorFactory(driver);
        FieldDecorator decorator = new MyDefaultFieldDecorator(finder);
        PageFactory.initElements(decorator, pageObject);
    }

    @Override
    public void initElementsWithAjaxSupport(final PageObject pageObject, final WebDriver driver, int timeoutInSeconds) {
        ElementLocatorFactory finder = new MyDefaultElementLocatorFactory(driver);
        FieldDecorator decorator = new MyDefaultFieldDecorator(finder);
        PageFactory.initElements(decorator, pageObject);
    }
}
  1. Create custom Module that would point to the newly created MyWebDriverFactory
\\MyModule.java
public class MyModule extends AbstractModule {
    @Override
    protected void configure() {
        bind(WebDriverFactory.class).to(MyWebDriverFactory.class);
    }
}
  1. Create custom Runner
\\MyRunner.java
public class MyRunner extends ThucydidesRunner {

    public MyRunner(final Class<?> klass) throws InitializationError {
        super(klass,Injectors.setInjector(Guice.createInjector(Modules.override(new ThucydidesModule()).with(new MyModule()))));
    }
}
  1. Run your tests with new runner.
\\MyTest.java
@RunWith(MyRunner.class)
@Story(Application.LoginLogout.ValidUserLoginLogout.class)
public class ValidUserLoginLogoutTest {

    @Managed
    public WebDriver driver;
...
}
added ability to provide custom injector
@@ -13,8 +13,17 @@

public static synchronized Injector getInjector() {
if (injector == null) {
injector = Guice.createInjector(new ThucydidesModule());
throw new RuntimeException("Injector has not been initialized yet");

This comment has been minimized.

Copy link
@wakaleo

wakaleo Mar 20, 2013

Member

Something must have been overwritten in the merge - how did you get the tests to keep running with this change?

This comment has been minimized.

Copy link
@alex-okrushko

alex-okrushko Mar 20, 2013

Author Contributor

@wakaleo I couldn't run the tests when I checked out. I had net.thucydides.core.pages.integration.WhenManagingAPageObject.java failing even before I started doing anything at

@Test
    public void should_provide_a_fluent_api_for_entering_a_value_in_a_field_using_webelementfacade() {
        WebElement field = mock(WebElement.class);
        WebElementFacade facade = new WebElementFacade(driver, field, 0L);
        BasicPageObject page = new BasicPageObject(driver);
        when(field.isEnabled()).thenReturn(true);
        when(field.getTagName()).thenReturn("input");

        page.enter("some value").into(facade); // fails here (at line 414) "The method into(WebElement) in the type PageObject.FieldEntry is not applicable for the arguments (WebElementFacade)"

        verify(field).clear();
        verify(field).sendKeys("some value");
    }

Also for my change some of the tests might need to be modified. (ThucydidesRunner tests)

@wakaleo

This comment has been minimized.

Copy link
Member

commented Mar 21, 2013

Tried merging this today. It involves some non-automatic merges and some pretty major changes to about 675 tests - just spend most of today on this and didn't manage to get them working consistently. Could you merge with the latest code base on your side and see if you can get all of the tests running correctly?

reverted to create the default injector if It was not set prior
@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2013

Hey John,

So to make your tests work I've changed the the Injectors to:

public class Injectors {

    private static Injector injector;

    public static synchronized Injector getInjector() {
        if (injector == null) {
            injector = Guice.createInjector(new ThucydidesModule());
//put back the default **instantiation if Injector was not set explicitly through setInjector.
        }
        return injector;
    }

    public static synchronized Injector setInjector(Injector injector){
        if (Injectors.injector == null) {
            Injectors.injector = injector;
        } else {
            throw new IllegalStateException("injector is already set. Cannot
reset it");
        }
        return injector;
    }
}

Secondly,

I imported the 106-SNAPSHOT that you currently have, however I cannot
get the tests to pass on your master. (even without any of my changes)
thucydides-core keeps failing:

  1. I had WhenRunningPolledTests.java failing the
    should_be_able_to_wait_for_non_web_tests_too() test

  2. After I commented it out I get even more errors:

Running net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest
Tests run: 24, Failures: 0, Errors: 9, Skipped: 0, Time elapsed: 0.869
sec <<< FAILURE!

Results :

Tests in error:
  a_data_driven_test_should_also_be_able_to_use_data_from_a_CSV_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
  a_separate_xml_report_should_be_generated_for_each_scenario_when_using_data_from_a_CSV_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
  xml_report_names_should_reflect_the_test_scenarios_when_data_is_read_from_csv_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
  xml_report_contents_should_reflect_the_test_data_from_the_csv_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
  should_be_able_to_count_the_number_of_data_entries(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
  should_be_able_to_get_data_Table_from_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
  should_be_able_to_count_the_number_of_data_entries_using_a_class_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
  should_recognize_a_test_case_with_a_valid_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
  should_load_test_class_instances_using_a_provided_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
  should_load_test_class_instances_using_semicolons(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-semicolon-data.csv
  should_be_able_to_get_data_Table_from_a_semicolon_delimited_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-semicolon-data.csv
  should_load_test_data_from_a_specified_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-semicolon-data.csv
  should_load_test_data_from_several_possible_sources(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path:
does-not-exist\simple-semicolon-data.csv,test-data\simple-semicolon-data.csv

Am I doing something wrong?

[INFO] thucydides ........................................ SUCCESS [2.704s]
[INFO] thucydides-test-utils ............................. SUCCESS [2.527s]
[INFO] thucydides-report-resources ....................... SUCCESS [1.006s]
[INFO] thucydides-sample-alternative-resources ........... SUCCESS [0.964s]
[INFO] thucydides-core ................................... FAILURE [2:16.706s]
[INFO] thucydides-junit .................................. SKIPPED
[INFO] Thucydides Maven Plugin ........................... SKIPPED
[INFO] Thucydides Easyb Plugin ........................... SKIPPED

What I do is run maven clean on *thucydides *(which in turn runs on
all the sub-projects)

and then I run maven install.

Also I have thucydides-eay-b-plugin complaining about:
Plugin execution not covered by lifecycle configuration:
org.codehaus.gmaven:gmaven-plugin:1.3:testCompile (execution: default,
phase: test-compile)

I tried getting the aspectJ, however my Maven-lifecycles doesn't have it.
I've also tried pointing the Lifycecle MAppings to my
lifecycle-mapping-metadata.xml with the following configuration:

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <versionRange>[1.0,)</versionRange>
                <goals>
                    <goal>test-compile</goal>
                    <goal>compile</goal>
                    <goal>generateStubs</goal>
                    <goal>generateTestStubs</goal>
                    <goal>testCompile</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <execute />
            </action>
        </pluginExecution>
    </pluginExecutions>

</lifecycleMappingMetadata>

However this was unsuccessful as well :(

Any ideas? How do you get it working?

(Maven is a new thing for me too, however I think I understand how it works)

Regards,
Alex

@mikezx6r

This comment has been minimized.

Copy link
Contributor

commented Mar 21, 2013

I suspect your first error is that you haven't passed the ChromeDriver/set the ChromeDriver system property correctly. I run into this as well.

You'll need to download (if you don't already) the Webdriver ChromeDriver (downloadable from http://code.google.com/p/chromedriver/downloads/list). You'll then need to add -Dwebdriver.chrome.driver={location of chromedriver.exe} to your mvn command line. i.e 'mvn clean install -Dwebdriver.chrome.driver={chromedriver.exe location}'.

This gets me much further, although I'm now experiencing other failures. Having issues in WhenManagingAPageObject. Will keep you posted.

Also, which JDK version are you on, and which OS? I see the file issues you see on Windows and am wondering if it's a windows vs unix issue. I'm using JDK7, although I may have to switch to JDK6 for this project, as I introduced a non-backwards compatible change recently.

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2013

@mikezx6r The Chrome driver should not be a problem, since it's on my path and I see some tests launching it (thucydides-core tests I mean).

I'm using Windows 7 (since I need it for IE tests anyway) and I'm using JDK-1.6

@mikezx6r

This comment has been minimized.

Copy link
Contributor

commented Mar 21, 2013

In process of downgrading to jdk-1.6 to see if I can duplicate the issues you're seeing. I was seeing failures in that test with ChromeDriver, but if you already have it, then you're obviously seeing something else.

Also looking into issue you raised on my other pull request

@wakaleo

This comment has been minimized.

Copy link
Member

commented Mar 21, 2013

That's odd - what OS are you using?

On 22 March 2013 04:43, Alex Okrushko notifications@github.com wrote:

Hey John,

So to make your tests work I've changed the the Injectors to:

public class Injectors {

private static Injector injector;

public static synchronized Injector getInjector() {
    if (injector == null) {
        *injector = Guice.createInjector(new ThucydidesModule());//put back the default **instantiation if Injector was not setexplicitly through setInjector.*
    }
    return injector;
}

public static synchronized Injector setInjector(Injector injector){
    if (Injectors.injector == null) {
        Injectors.injector = injector;
    } else {
        throw new IllegalStateException("injector is already set. Cannotreset it");
    }
    return injector;
}}

Secondly,

I imported the 106-SNAPSHOT that you currently have, however I cannot
get the tests to pass on your master. (even without any of my changes)
thucydides-core keeps failing:

  1. I had WhenRunningPolledTests.java failing the
    should_be_able_to_wait_for_non_web_tests_too() test

  2. After I commented it out I get even more errors:

Running net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest
Tests run: 24, Failures: 0, Errors: 9, Skipped: 0, Time elapsed: 0.869
sec <<< FAILURE!

Results :

Tests in error:
a_data_driven_test_should_also_be_able_to_use_data_from_a_CSV_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
a_separate_xml_report_should_be_generated_for_each_scenario_when_using_data_from_a_CSV_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
xml_report_names_should_reflect_the_test_scenarios_when_data_is_read_from_csv_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
xml_report_contents_should_reflect_the_test_data_from_the_csv_file(net.thucydides.junit.runners.WhenRunningADataDrivenTestScenario):
No test data file found for path: test-data\simple-data.csv
should_be_able_to_count_the_number_of_data_entries(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
should_be_able_to_get_data_Table_from_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
should_be_able_to_count_the_number_of_data_entries_using_a_class_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
should_recognize_a_test_case_with_a_valid_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
should_load_test_class_instances_using_a_provided_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-data.csv
should_load_test_class_instances_using_semicolons(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-semicolon-data.csv
should_be_able_to_get_data_Table_from_a_semicolon_delimited_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-semicolon-data.csv
should_load_test_data_from_a_specified_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path: test-data\simple-semicolon-data.csv
should_load_test_data_from_several_possible_sources(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest):
No test data file found for path:
does-not-exist\simple-semicolon-data.csv,test-data\simple-semicolon-data.csv

Am I doing something wrong?

[INFO] thucydides ........................................ SUCCESS [2.704s]
[INFO] thucydides-test-utils ............................. SUCCESS [2.527s]
[INFO] thucydides-report-resources ....................... SUCCESS [1.006s]
[INFO] thucydides-sample-alternative-resources ........... SUCCESS [0.964s]
[INFO] thucydides-core ................................... FAILURE [2:16.706s]
[INFO] thucydides-junit .................................. SKIPPED
[INFO] Thucydides Maven Plugin ........................... SKIPPED
[INFO] Thucydides Easyb Plugin ........................... SKIPPED

What I do is run maven clean on *thucydides *(which in turn runs on
all the sub-projects)

and then I run maven install.

Also I have thucydides-eay-b-plugin complaining about:

Plugin execution not covered by lifecycle configuration:
org.codehaus.gmaven:gmaven-plugin:1.3:testCompile (execution: default,
phase: test-compile)

I tried getting the aspectJ, however my Maven-lifecycles doesn't have it.

I've also tried pointing the Lifycecle MAppings to my
lifecycle-mapping-metadata.xml with the following configuration:

<pluginExecutions>
    <pluginExecution>
        <pluginExecutionFilter>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <versionRange>[1.0,)</versionRange>
            <goals>
                <goal>test-compile</goal>
                <goal>compile</goal>
                <goal>generateStubs</goal>
                <goal>generateTestStubs</goal>
                <goal>testCompile</goal>
            </goals>
        </pluginExecutionFilter>
        <action>
            <execute />
        </action>
    </pluginExecution>
</pluginExecutions>

However this was unsuccessful as well :(

Any ideas? How do you get it working?

(Maven is a new thing for me too, however I think I understand how it
works)

Regards,
Alex

Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15254171
.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2013

@wakaleo Not sure If you are asking me or @mikezx6r , but I'm using Windows 7 Pro

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2013

@wakaleo, @mikezx6r
Ok, here is an update:

I commented out any usage of org.codehaus.gmaven gmaven-plugin, because it keeps giving me errors.

  • All Junit tests (which use chrome driver) on thucydides-core pass except for should_read_environment_variable_from_system() and should_read_environment_variable_from_system_using_an_enum() in WhenReadingEnvironmentVariables.java.

When I do debug (I put the breakpoint before environmentVariables.getValue() is called, and by doing so I put the delay) both those tests pass as well.

  • maven test on thucydides-core passes completely (however I don't think all the tests are executed)
  • maven install fails during integation-tests:
Results :

Tests in error: 
  page_will_wait_for_rendered_element_if_it_is_not_already_present(net.thucydides.core.pages.integration.WhenManagingAPageObject): Timed out after 0 seconds(..)
  should_wait_for_field_to_appear(net.thucydides.core.pages.integration.CheckingFieldContentWithTheFluentElementAPI): Timed out after 0 seconds waiting for net.thucydides.core.pages.WebElementFacade$1@4e1f52a(..)

Tests run: 438, Failures: 0, Errors: 2, Skipped: 7

The strange thing is that maven install is using Firefox for all of the tests and then just before failing starts using Chrome

@mikezx6r

This comment has been minimized.

Copy link
Contributor

commented Mar 22, 2013

Have you pulled John's latest change? He modified the pom so that it does
not run in parallel by default.

I was having a similar issue with the integration tests on Windows, and
running the tests one at a time fixed that.

As to the others, I don't know what to suggest.

By the way, do you also get errors from the tests trying to use csv files?
Those always fail with 'File Not Found' issues.

On Fri, Mar 22, 2013 at 11:38 AM, Alex Okrushko notifications@github.comwrote:

@wakaleo https://github.com/wakaleo, @mikezx6rhttps://github.com/mikezx6r
Ok, here is an update:

I commented out any usage of org.codehaus.gmaven gmaven-plugin, because
it keeps giving me errors.

  • All Junit tests (which use chrome driver) on thucydides-core pass
    except for should_read_environment_variable_from_system() and
    should_read_environment_variable_from_system_using_an_enum() in
    WhenReadingEnvironmentVariables.java.

When I do debug (I put the breakpoint before
environmentVariables.getValue() is called, and by doing so I put the
delay) both those tests pass as well.

maven test on thucydides-core passes completely (however I don't think
all the tests are executed)

maven install fails during integation-tests:

Results :

Tests in error:
page_will_wait_for_rendered_element_if_it_is_not_already_present(net.thucydides.core.pages.integration.WhenManagingAPageObject): Timed out after 0 seconds(..)
should_wait_for_field_to_appear(net.thucydides.core.pages.integration.CheckingFieldContentWithTheFluentElementAPI): Timed out after 0 seconds waiting for net.thucydides.core.pages.WebElementFacade$1@4e1f52a(..)

Tests run: 438, Failures: 0, Errors: 2, Skipped: 7

The strange thing is that maven install is using Firefox for all of the
tests and then just before failing starts using Chrome


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15303687
.

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2013

Have you pulled John's latest change?

Yes, I did and I though I've merged them, but looks like I didn't :(
Thanks Mike!

By the way, do you also get errors from the tests trying to use csv files?

where are those tests? are they on thucydides-core? If yes, then all my jUnit tests pass (except some of the above mentioned)

Running net.thucydides.core.csv.WhenCreatingNewDataDrivenTestSteps
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.223 sec

Running net.thucydides.core.csv.WhenConvertingColumnHeadingsToFieldNames
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.447 sec

Running net.thucydides.core.csv.WhenLoadingTestDataFromACSVFile
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.997 sec

All tests now pass in maven install as well.

@xsalefter

This comment has been minimized.

Copy link
Member

commented Mar 22, 2013

Hi all..

We have this issue about running test-suite on win os: http://java.net/jira/browse/THUCYDIDES-89. Having said that, I thought it have relationship with test resources (csv files, screenshot files) is being accessed by multiple JUnit's threads during test. This is force me to add synchronized method for some method in JUnit's TemporaryFolder, and the result was this file:
https://github.com/xsalefter/thucydides/blob/master/thucydides-core/src/main/java/net/thucydides/core/util/ExtendedTemporaryFolder.java

So if you guys still have this problem, feel free to report this issue to separated issue. However, my Jira issue about this is here:
http://java.net/jira/browse/THUCYDIDES-89

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2013

@xsalefter this commit fixed the issues for Windows with random failures for me - thucydides-core now passes completely.

@mikezx6r

By the way, do you also get errors from the tests trying to use csv files?

Is that the issues you are referring to?:

Tests in error: 
  should_be_able_to_count_the_number_of_data_entries(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
  should_be_able_to_get_data_Table_from_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
  should_be_able_to_count_the_number_of_data_entries_using_a_class_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
  should_recognize_a_test_case_with_a_valid_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
  should_load_test_class_instances_using_a_provided_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
  should_load_test_class_instances_using_semicolons(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-semicolon-data.csv
  should_be_able_to_get_data_Table_from_a_semicolon_delimited_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-semicolon-data.csv
  should_load_test_data_from_a_specified_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-semicolon-data.csv
  should_load_test_data_from_several_possible_sources(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: does-not-exist\simple-semicolon-data.csv,test-data\simple-semicolon-data.csv
@mikezx6r

This comment has been minimized.

Copy link
Contributor

commented Mar 22, 2013

That's exactly it! Does the previously mentioned fix commit also address
the above, or you're still seeing it?

On Fri, Mar 22, 2013 at 2:12 PM, Alex Okrushko notifications@github.comwrote:

@xsalefter https://github.com/xsalefter this commithttps://github.com/thucydides-webtests/thucydides/commit/48144417f1bf9719a9efac7f8d43c23ab1de08d2fixed the issues for Windows with random failures for me -
thucydides-core now passes completely.

@mikezx6r https://github.com/mikezx6r

By the way, do you also get errors from the tests trying to use csv files?

Is that the issues you are referring to?:

Tests in error:
should_be_able_to_count_the_number_of_data_entries(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
should_be_able_to_get_data_Table_from_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
should_be_able_to_count_the_number_of_data_entries_using_a_class_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
should_recognize_a_test_case_with_a_valid_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
should_load_test_class_instances_using_a_provided_test_data_source(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-data.csv
should_load_test_class_instances_using_semicolons(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-semicolon-data.csv
should_be_able_to_get_data_Table_from_a_semicolon_delimited_csv(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-semicolon-data.csv
should_load_test_data_from_a_specified_directory(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: test-data\simple-semicolon-data.csv
should_load_test_data_from_several_possible_sources(net.thucydides.junit.runners.WhenFindingTestDataInADataDrivenTest): No test data file found for path: does-not-exist\simple-semicolon-data.csv,test-data\simple-semicolon-data.csv


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15312711
.

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2013

@mikezx6r I see this issues with thucydides-junit
I'll try to debug them (since the files are actually there under \target\test-classes\test-data)

Conflicts:
	pom.xml
	thucydides-core/src/main/java/net/thucydides/core/webdriver/WebDriverFactory.java
@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 25, 2013

@wakaleo
Hey John,
Could it be that you test-classes\test-data is in environmental variable USERDIR or HOME in your OS?
I couldn't find from where @UseTestDataFrom("test-data/simple-data.csv") would pick up the rest of the path, unless thucydides.data.dir is set.

Thanks.

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2013

Hey John,

  • WebElementFacade elements can now be extended
  • WebElementFacadeImpl are also Proxy elements now as well :) Before you were instantiating every one anyway with Proxy WebElement inside.

how to extend:

  1. Create interface
@ImplementedBy(MyInputImpl.class)
public interface MyInput extends WebElementFacade {

public void doSomething();
}
  1. Create implementation
public interface MyInputImpl extends WebElementFacadeImpl implements MyInput {

public MyInputImpl(WebDriver driver, WebElement element, int timeout){
   super(driver, element, timeout);
}

public void doSomething(){
    element.type("done");
}

All unit tests (except the ones with test-data in Windows) pass

Haven't created an unit tests for the extension.

fix the broken test case for Default Element Locator
@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2013

@wakaleo ,
Hey John. So I corrected that test case. in thucydides-core I now only have the PermGen Size problem and test-data issue in Windows.

Can you clone it and see if you have the PermGen issue?

@wakaleo

This comment has been minimized.

Copy link
Member

commented Mar 28, 2013

OK, trying now.

Regarding memory issues, what is your MAVEN_OPTS variable set to? Mine is
-Xmx512m

On 28 March 2013 11:04, Alex Okrushko notifications@github.com wrote:

@wakaleo https://github.com/wakaleo ,
Hey John. So I corrected that test case. in thucydides-core I now only
have the PermGen Size problem.
Can you clone it and see if you have it?


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15561031
.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2013

I'm setting it through maven plugin in eclipse. For jUnit tests I had to
increase the PermGenSize to 256m and they work fine, however for maven
tests even PermGenSize 1024m haven't solved the problem. I'm setting the
total heap size to 1024 as well.

I've also tried to set it through env variable MAVEN_OPTS, however that was
unsuccessful also.
On Mar 27, 2013 8:07 PM, "John Ferguson Smart" notifications@github.com
wrote:

OK, trying now.

Regarding memory issues, what is your MAVEN_OPTS variable set to? Mine is
-Xmx512m

On 28 March 2013 11:04, Alex Okrushko notifications@github.com wrote:

@wakaleo https://github.com/wakaleo ,
Hey John. So I corrected that test case. in thucydides-core I now only
have the PermGen Size problem.
Can you clone it and see if you have it?


Reply to this email directly or view it on GitHub<
https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15561031>

.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15561119
.

@wakaleo

This comment has been minimized.

Copy link
Member

commented Mar 28, 2013

Interesting. It could be jacoco - I'll put this in an optional profile to
see if that changes anything.

On 28 March 2013 11:13, Alex Okrushko notifications@github.com wrote:

I'm setting it through maven plugin in eclipse. For jUnit tests I had to
increase the PermGenSize to 256m and they work fine, however for maven
tests even PermGenSize 1024m haven't solved the problem. I'm setting the
total heap size to 1024 as well.

I've also tried to set it through env variable MAVEN_OPTS, however that
was
unsuccessful also.
On Mar 27, 2013 8:07 PM, "John Ferguson Smart" notifications@github.com
wrote:

OK, trying now.

Regarding memory issues, what is your MAVEN_OPTS variable set to? Mine
is
-Xmx512m

On 28 March 2013 11:04, Alex Okrushko notifications@github.com wrote:

@wakaleo https://github.com/wakaleo ,
Hey John. So I corrected that test case. in thucydides-core I now only
have the PermGen Size problem.
Can you clone it and see if you have it?


Reply to this email directly or view it on GitHub<

https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15561031>

.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com


Reply to this email directly or view it on GitHub<
https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15561119>

.


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15561339
.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2013

Actually it must be jococo! Ive seen it taking big chunk of heap dump :-)
On Mar 27, 2013 8:15 PM, "John Ferguson Smart" notifications@github.com
wrote:

Interesting. It could be jacoco - I'll put this in an optional profile to
see if that changes anything.

On 28 March 2013 11:13, Alex Okrushko notifications@github.com wrote:

I'm setting it through maven plugin in eclipse. For jUnit tests I had to
increase the PermGenSize to 256m and they work fine, however for maven
tests even PermGenSize 1024m haven't solved the problem. I'm setting the
total heap size to 1024 as well.

I've also tried to set it through env variable MAVEN_OPTS, however that
was
unsuccessful also.
On Mar 27, 2013 8:07 PM, "John Ferguson Smart" notifications@github.com

wrote:

OK, trying now.

Regarding memory issues, what is your MAVEN_OPTS variable set to? Mine
is
-Xmx512m

On 28 March 2013 11:04, Alex Okrushko notifications@github.com
wrote:

@wakaleo https://github.com/wakaleo ,
Hey John. So I corrected that test case. in thucydides-core I now
only
have the PermGen Size problem.
Can you clone it and see if you have it?


Reply to this email directly or view it on GitHub<

https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15561031>

.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com


Reply to this email directly or view it on GitHub<

https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15561119>

.


Reply to this email directly or view it on GitHub<
https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15561339>

.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15561398
.

wakaleo added a commit that referenced this pull request Mar 28, 2013
Proper WebDriverFactory injection, ability to set custom "Injector"
@wakaleo wakaleo merged commit afe1515 into thucydides-webtests:master Mar 28, 2013
@wakaleo

This comment has been minimized.

Copy link
Member

commented Mar 28, 2013

Thanks for this. Could you add unit tests (preferably in Spock) for the new classes in the net.thucydides.core.webdriver.smart package, to illustrate how they work and as regression tests?

@alex-okrushko

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2013

Will definitely do. Your unit tests helped me integrate with Thucydides
pretty quickly. In fact, even catch some bugs :-) really excited for this
to be part of the framework.

I'll put some time in during the weekend. My "research automation
frameworks for webtests in Java" deadline is tomorrow. I'll have to demo it
on Monday-Tuesday. I haven't had a chance to take a look at the reporting
part yet, but now I'm Thucydides-committed :-)
On Mar 27, 2013 8:51 PM, "John Ferguson Smart" notifications@github.com
wrote:

Thanks for this. Could you add unit tests (preferably in Spock) for the
new classes in the net.thucydides.core.webdriver.smart package, to
illustrate how they work and as regression tests?


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15562499
.

@wakaleo

This comment has been minimized.

Copy link
Member

commented Mar 28, 2013

Awesome, thanks again and welcome abord!

On 28 March 2013 11:59, Alex Okrushko notifications@github.com wrote:

Will definitely do. Your unit tests helped me integrate with Thucydides
pretty quickly. In fact, even catch some bugs :-) really excited for this
to be part of the framework.

I'll put some time in during the weekend. My "research automation
frameworks for webtests in Java" deadline is tomorrow. I'll have to demo
it
on Monday-Tuesday. I haven't had a chance to take a look at the reporting
part yet, but now I'm Thucydides-committed :-)
On Mar 27, 2013 8:51 PM, "John Ferguson Smart" notifications@github.com
wrote:

Thanks for this. Could you add unit tests (preferably in Spock) for the
new classes in the net.thucydides.core.webdriver.smart package, to
illustrate how they work and as regression tests?


Reply to this email directly or view it on GitHub<
https://github.com/thucydides-webtests/thucydides/pull/72#issuecomment-15562499>

.


Reply to this email directly or view it on GitHubhttps://github.com//pull/72#issuecomment-15562721
.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.