question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to remove inserted record in test?

See original GitHub issue

I would now how to remove inserted record in a test environment:

@Test
@DataSet(transactional=true)
@ExpectedDataSet(value = "foo.csv", ignoreCols = "id")
public void runGenericTest() throws Exception {

Using CleanAfter/Before will remove records also in other tables. Using the following code:

@After
public void clean_all() {

it will remove records before ExpectedDataSet action.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rmpestanocommented, Jan 22, 2018

Let’s keep it opened until there.

Thank you.

0reactions
codewebcommented, Jan 22, 2018

Ok, thanks. I hope someone will do it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Will inserted records during a test be deleted?
Yes, all records you insert in test methods will never get committed to the database. You don't have to worry about cleaning up...
Read more >
apex test class to delete a record - Salesforce Developers
Just add this to your test class: Account deletedAccount = [SELECT Id, IsDeleted FROM Account WHERE Id = :testAcc.Id ALL ROWS]; System.
Read more >
How unit test insert record in spring (no delete method)
1 Answer 1 · open a transaction before the test · run the test (change the data, even change the schema - add...
Read more >
MySQL DELETE Query: How to Delete a Row from Table
MySQL Delete command is used to delete rows that are no longer required from the database tables. It deletes the whole row from...
Read more >
Salesforce Apex Test class for an Opportunity record delete ...
Test Class · 1. Create apex class with @isTest anotation. · 2. Create a user record with non admin users · 3. Use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found