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

need maven instructions to run Spectrum test on a multi-module project #125

Open
braghome opened this issue Sep 14, 2017 · 8 comments
Open

Comments

@braghome
Copy link

I have created some Spectrum test which runs correctly through the IDE

I tried both Surefire and Failsafe plugins not able to run the Spectrum suit through mvn

@braghome
Copy link
Author

got it

			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-failsafe-plugin</artifactId>
			<configuration>
				<includes>
					<include>%regex[.*Specs.class]</include>
				</includes>
			</configuration>
		</plugin>

@braghome braghome reopened this Sep 14, 2017
@braghome
Copy link
Author

braghome commented Sep 14, 2017

I still have an issue with the maven runs through the command line, did anyone ever test that?

IDE still run correctly shows 36 tests whereas on command line

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.trulia.api.data.typebdd.BethInvitationSpecs
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.719 s - in com.trulia.api.data.typebdd.BethInvitationSpecs
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

@braghome braghome changed the title instruction see nowhere instructions to run Spectrum test on a multi-module project need maven instructions to run Spectrum test on a multi-module project Sep 14, 2017
@ashleyfrieze
Copy link
Contributor

Please show the source of your Specs file.

@greghaskins
Copy link
Owner

Specifically, @braghome, it would be helpful if you could share a version of our Specs file, perhaps with the contents of the tests removed if you can't share those. This will help us reproduce the issue and determine if there is a setup problem. It's also possible it could be configuration issue in one of your pom.xml files.

@braghome
Copy link
Author

braghome commented Sep 15, 2017

You guys are correct, I did start with some aggresive exclusions on the pom.xml which have now removed so everything on my Integration tests are now working but for command line runs which still show

[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.822 s - in com.trulia.api.data.typebdd.BethInvitationSpecs
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

whereas in the IDE the tests count is 36 and does not have any such reporting problems

@RunWith(Spectrum)
class BethInvitationSpecs {

	new() {
		feature('Bla can Beth', with(tags('bethInvitaion'), [
			scenarioOutline(
				'As an gent I want to be able to Beth to gent', [ zuid, entitySourceVersion, 
					checkProfile, decides, actualStatus |
					val myAgent = junitMixin(MyAgentMixin)
					val scenarioData = new Variable<PBAndJImmut>(
						new PBAndJImmut(BASE, null, null, new ArrayList, new ArrayList, null, null, null, null, null,
							null))
					given('''check Alan's profile «checkProfile», entity source «entitySourceVersion» and zuid «zuid» for login''', [
					])
					and('a Beth that does not have with Bla', [])
					when('Bla is able to Beth', [])
					and('Bla can confirm Beth', [])
					and('''Beth «decides» on the open''', [])
					then('''Alan can confirm «actualStatus» on detail''', [])
				], withExamples(
					example(308l, 'fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0', true, 'reject', 'UNKNOWN_AGENT'),
					example(308l, 'fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0', false, 'reject', 'NOT_WORKING_WITH_AGENT'),
					example(308l, 'fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0', false, 'reject', 'NOT_SHOPPING'),
					example(308l, 'fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0', false, 'reject', 'NONE_OF_THE_ABOVE'),
					example(308l, 'fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0', false, 'reject', 'NO_REASON_GIVEN'),
					example(308l, 'fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0', false, 'accept', 'ACCEPTED')
				))
		]))
	}
}

the mixin looks like
@ContextConfiguration(classes=TypedConfig)
class MyAgentMixin {
	public val LOG = LoggerFactory.getLogger(MyAgentMixin)
    @ClassRule
    public static final SpringClassRule classRule = new SpringClassRule();
    @Rule
    public SpringMethodRule methodRule = new SpringMethodRule();
	
	@Autowired protected UserProfileService userProfileImpl
	@Autowired protected PaLoginWithReaders paLoginWithReadersImpl
	@Autowired protected StatsCreterion statsCreterionImpl
}

I have to do the Spec in constructor as xtend language does not support intialisation blocks
All the above generate java code

@RunWith(Spectrum.class)
@SuppressWarnings("all")
public class BethInvitationSpecs {
  public BethInvitationSpecs() {
    final Block _function = () -> {
      final ParameterizedBlock.FiveArgBlock<Long, String, Boolean, String, String> _function_1 = (Long zuid, String entitySourceVersion, Boolean checkProfile, String decides, String actualStatus) -> {
        final Supplier<MyAgentMixin> myAgent = Configure.<MyAgentMixin>junitMixin(MyAgentMixin.class);
        ArrayList<CrmData> _arrayList = new ArrayList<CrmData>();
        ArrayList<CompactContactDetails> _arrayList_1 = new ArrayList<CompactContactDetails>();
        PBAndJImmut _pBAndJImmut = new PBAndJImmut(StatsCreterion.BASE, null, null, _arrayList, _arrayList_1, null, null, null, null, null, 
          null);
        final Variable<PBAndJImmut> scenarioData = new Variable<PBAndJImmut>(_pBAndJImmut);
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("check Alan\'s profile ");
        _builder.append(checkProfile);
        _builder.append(", entity source ");
        _builder.append(entitySourceVersion);
        _builder.append(" and zuid ");
        _builder.append(zuid);
        _builder.append(" for login");
        final Block _function_2 = () -> {
        };
        Gherkin.given(_builder.toString(), _function_2);
        final Block _function_3 = () -> {
        };
        Gherkin.and("a Beth that does not have with Bla", _function_3);
        final Block _function_4 = () -> {
        };
        Gherkin.when("Bla is able to Beth", _function_4);
        final Block _function_5 = () -> {
        };
        Gherkin.and("Bla can confirm Beth", _function_5);
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("Beth ");
        _builder_1.append(decides);
        _builder_1.append(" on the open");
        final Block _function_6 = () -> {
        };
        Gherkin.and(_builder_1.toString(), _function_6);
        StringConcatenation _builder_2 = new StringConcatenation();
        _builder_2.append("Alan can confirm ");
        _builder_2.append(actualStatus);
        _builder_2.append(" on detail");
        final Block _function_7 = () -> {
        };
        Gherkin.then(_builder_2.toString(), _function_7);
      };
      Gherkin.<ParameterizedBlock.FiveArgBlock<Long, String, Boolean, String, String>>scenarioOutline(
        "As an gent I want to be able to Beth to gent", _function_1, Gherkin.<ParameterizedBlock.FiveArgBlock<Long, String, Boolean, String, String>>withExamples(
        Gherkin.<Long, String, Boolean, String, String>example(Long.valueOf(308l), "fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0", Boolean.valueOf(true), "reject", "UNKNOWN_AGENT"), 
        Gherkin.<Long, String, Boolean, String, String>example(Long.valueOf(308l), "fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0", Boolean.valueOf(false), "reject", "NOT_WORKING_WITH_AGENT"), 
        Gherkin.<Long, String, Boolean, String, String>example(Long.valueOf(308l), "fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0", Boolean.valueOf(false), "reject", "NOT_SHOPPING"), 
        Gherkin.<Long, String, Boolean, String, String>example(Long.valueOf(308l), "fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0", Boolean.valueOf(false), "reject", "NONE_OF_THE_ABOVE"), 
        Gherkin.<Long, String, Boolean, String, String>example(Long.valueOf(308l), "fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0", Boolean.valueOf(false), "reject", "NO_REASON_GIVEN"), 
        Gherkin.<Long, String, Boolean, String, String>example(Long.valueOf(308l), "fbcaae13-8e73-4eafc4f161ba;TruliaAgent;4.23.0", Boolean.valueOf(false), "accept", "ACCEPTED")));
    };
    Gherkin.feature("Bla can Beth", Configure.with(Configure.tags("bethInvitaion"), _function));
  }
}

and the mixin looks like
@ContextConfiguration(classes = TypedConfig.class)
@SuppressWarnings("all")
public class MyAgentMixin {
  public final Logger LOG = LoggerFactory.getLogger(MyAgentMixin.class);
  
  @ClassRule
  public final static SpringClassRule classRule = new SpringClassRule();
  
  @Rule
  public SpringMethodRule methodRule = new SpringMethodRule();
  
  @Autowired
  protected UserProfileService userProfileImpl;
  
  @Autowired
  protected PaLoginWithReaders paLoginWithReadersImpl;
  
  @Autowired
  protected StatsCreterion statsCreterionImpl;
}

@ashleyfrieze
Copy link
Contributor

This example https://github.com/ashleyfrieze/spectrumexample works fine... Perhaps you could create a similar working example elsewhere on GitHub that doesn't work, so we can debug it?

@ashleyfrieze
Copy link
Contributor

I suggest a rename for this issue, since it's most likely a compatibility issue between Xtend, maven and Spectrum. The best I can suggest is that we look for volunteers who understand Xtend better to pitch in and help. A guess from me is that the maven build process might not be stringing together the Xtend compilation/preprocessing before the tests run.

@ashleyfrieze
Copy link
Contributor

@braghome - did you get any further with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants