Open tomleightonstars opened 3 years ago
Thanks @tomleightonstars raising this. It will be a great help if we can do the above.
Hey.
Couple of question to see if I've understood your requirements :)
test001TestAFunnyThing
could become testHELLOTestAFunnyThing
?Thank you for all your hard work with this repo 😄❤️
Or, would it even possible to remove 'test' as well?
IIRC we added the numbers to make sure that tests were run sequentially as defined, because the order wasn't guaranteed when the tests were dynamic...?
I would be against the idea of running tests in some order as each test should be independent. The test name should be unique and should not contain static prefixes.
Personally, so would I. However, a guiding principle I've been following is "do what cucumber would do" and (I believe) it will run the tests in the order they are specified in the feature file.
That being said, if people want to opt out of that behaviour then that's fine by me :)
My current plan for this is for a user to be able to pass in a block which will return the test selector name - where the default would be this (backwards compatibility is important):
NativeScenario.selectorFactory = { (name: String, index: Int) -> String in
"\(self.leftPad(index))\(self.name.camelCaseify)"
}
This isn't final - there's probably some tweaking here.
FYI @tomleightonstars The prefix test
is what Xcode uses to determine which methods are tests - without it they don't get run.
Personally, so would I. However, a guiding principle I've been following is "do what cucumber would do" and (I believe) it will run the tests in the order they are specified in the feature file.
That being said, if people want to opt out of that behaviour then that's fine by me :)
My current plan for this is for a user to be able to pass in a block which will return the test selector name - where the default would be this (backwards compatibility is important):
NativeScenario.selectorFactory = { (name: String, index: Int) -> String in "\(self.leftPad(index))\(self.name.camelCaseify)" }
This isn't final - there's probably some tweaking here.
That sounds like a great plan! I had a go at trying to add something in but I couldn't get it working 🤦♂️
FYI @tomleightonstars The prefix
test
is what Xcode uses to determine which methods are tests - without it they don't get run.
fair enough! I thought that might be the case
Hi, me again! I hope you're well!
I'm just wondering if there's a way to implement a custom version of the SelectorString value in NativeScenario.swift? I'm aware I can change the value in there but then it won't be iterated through git to others.
I know similar is done when parsing the location of the Features folder, so maybe something similar could be done?
I can see 'test' is required in the returned name for the tests to actually run, it would be great to then be able to have something custom after that, if anything, e.g.: testAScenarioName test_AScenarioName test-AScenarioName
❤️